1 # //******************************************************************
3 # // Copyright 2015 Samsung Electronics All Rights Reserved.
5 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # // Licensed under the Apache License, Version 2.0 (the "License");
8 # // you may not use this file except in compliance with the License.
9 # // You may obtain a copy of the License at
11 # // http://www.apache.org/licenses/LICENSE-2.0
13 # // Unless required by applicable law or agreed to in writing, software
14 # // distributed under the License is distributed on an "AS IS" BASIS,
15 # // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # // See the License for the specific language governing permissions and
17 # // limitations under the License.
19 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 sptest_env = gtest_env.Clone()
27 src_dir = sptest_env.get('SRC_DIR')
28 target_os = sptest_env.get('TARGET_OS')
30 ######################################################################
32 ######################################################################
33 sptest_env.PrependUnique(CPPPATH = [
36 '../include/internal',
37 '../../../stack/include',
38 '../../../ocrandom/include',
39 '../../../logger/include',
40 '../../../stack/include',
41 '../../../security/include',
42 '../../../security/include/internal',
43 '../../../security/provisioning/include/internal',
44 '../../../../oc_logger/include',
46 '../../../../../extlibs/tinydtls',
47 '../../../../../extlibs/cjson',
48 '../../../../../extlibs/base64',
49 '../../../connectivity/inc',
50 '../../../connectivity/inc/pkix',
51 '../../../connectivity/common/inc',
52 '../../../connectivity/lib/libcoap-4.1.1',
53 '../../../connectivity/api',
54 '../../../../../extlibs/tinydtls'
56 sptest_env.AppendUnique(LIBPATH = [sptest_env.get('BUILD_DIR')])
57 sptest_env.PrependUnique(LIBS = [ 'ocpmapi',
62 'connectivity_abstraction',
65 if sptest_env.get('SECURED') == '1':
66 sptest_env.AppendUnique(LIBS = ['timer'])
67 sptest_env.AppendUnique(LIBS = ['tinydtls'])
69 if sptest_env.get('DTLS_WITH_X509') == '1':
70 sptest_env.AppendUnique(LIBS = ['CKManager'])
71 sptest_env.AppendUnique(LIBS = ['asn1'])
73 if sptest_env.get('WITH_TCP') == True:
74 sptest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
76 if not sptest_env.get('RELEASE'):
77 sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
79 if target_os in ['msys_nt', 'windows']:
80 sptest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
81 sptest_env.AppendUnique(LIBS = ['ws2_32',
85 ######################################################################
86 # Source files and Targets
87 ######################################################################
88 unittest_src = ['pmutilitytest.cpp',
89 'secureresourceprovider.cpp',
90 'provisioningdatabasemanager.cpp',
91 'ocprovisioningmanager.cpp',
92 'credentialgeneratortest.cpp',
95 if target_os not in ['windows']:
96 unittest_src += [ 'otmunittest.cpp' ]
98 unittest = sptest_env.Program('unittest', unittest_src)
100 if target_os not in ['windows']:
101 sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
102 sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
103 Alias("test", [sample_server1, sample_server2])
105 Alias("test", [unittest])
107 sptest_env.AppendTarget('test')
108 if sptest_env.get('TEST') == '1':
109 if target_os in ['linux', 'windows']:
110 out_dir = sptest_env.get('BUILD_DIR')
111 result_dir = os.path.join(sptest_env.get('BUILD_DIR'), 'test_out') + os.sep
112 if not os.path.isdir(result_dir):
113 os.makedirs(result_dir)
114 sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
115 sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
116 sptest_env.AppendENVPath('PATH', sptest_env.get('BUILD_DIR'))
117 ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')