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/common/inc',
51 '../../../connectivity/lib/libcoap-4.1.1',
52 '../../../connectivity/api',
53 '../../../../../extlibs/tinydtls'
55 sptest_env.AppendUnique(LIBPATH = [sptest_env.get('BUILD_DIR')])
56 sptest_env.PrependUnique(LIBS = [ 'ocpmapi',
61 'connectivity_abstraction',
64 if sptest_env.get('SECURED') == '1':
65 sptest_env.AppendUnique(LIBS = ['timer'])
66 sptest_env.AppendUnique(LIBS = ['tinydtls'])
68 if sptest_env.get('DTLS_WITH_X509') == '1':
69 sptest_env.AppendUnique(LIBS = ['CKManager'])
70 sptest_env.AppendUnique(LIBS = ['asn1'])
72 if not sptest_env.get('RELEASE'):
73 sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
75 if target_os in ['msys_nt', 'windows']:
76 sptest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
77 sptest_env.AppendUnique(LIBS = ['ws2_32',
81 ######################################################################
82 # Source files and Targets
83 ######################################################################
84 unittest_src = ['pmutilitytest.cpp',
85 'secureresourceprovider.cpp',
86 'provisioningdatabasemanager.cpp',
87 'ocprovisioningmanager.cpp',
88 'credentialgeneratortest.cpp',
91 if target_os not in ['windows']:
92 unittest_src += [ 'otmunittest.cpp' ]
94 unittest = sptest_env.Program('unittest', unittest_src)
96 if target_os not in ['windows']:
97 sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
98 sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
99 Alias("test", [sample_server1, sample_server2])
101 Alias("test", [unittest])
103 sptest_env.AppendTarget('test')
104 if sptest_env.get('TEST') == '1':
105 if target_os in ['linux', 'windows']:
106 out_dir = sptest_env.get('BUILD_DIR')
107 result_dir = os.path.join(sptest_env.get('BUILD_DIR'), 'test_out') + os.sep
108 if not os.path.isdir(result_dir):
109 os.makedirs(result_dir)
110 sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
111 sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
112 sptest_env.AppendENVPath('PATH', sptest_env.get('BUILD_DIR'))
113 ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')