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 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
25 sptest_env = env.Clone()
27 src_dir = sptest_env.get('SRC_DIR')
28 target_os = env.get('TARGET_OS')
30 ######################################################################
32 ######################################################################
33 sptest_env.PrependUnique(CPPPATH = [
34 '../../../connectivity/inc',
35 '../../../connectivity/api',
37 '../../../../../extlibs/tinydtls',
38 '../include/internal',
40 '../../../logger/include',
41 '../../../stack/include',
42 '../../../../oc_logger/include',
43 '../../../../../extlibs/gtest/gtest-1.7.0/include',
47 sptest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
48 sptest_env.AppendUnique(LIBS = ['-lpthread','-ldl'])
49 sptest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
50 sptest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
51 sptest_env.PrependUnique(LIBS = [ 'ocpmapi',
56 'connectivity_abstraction',
61 if env.get('SECURED') == '1':
62 sptest_env.AppendUnique(LIBS = ['timer'])
63 sptest_env.AppendUnique(LIBS = ['tinydtls'])
64 if env.get('DTLS_WITH_X509') == '1':
65 sptest_env.AppendUnique(LIBS = ['CKManager'])
66 sptest_env.AppendUnique(LIBS = ['asn1'])
68 if not env.get('RELEASE'):
69 sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
71 if target_os in ['msys_nt', 'windows']:
72 sptest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
73 sptest_env.AppendUnique(LIBS = ['ws2_32',
77 ######################################################################
78 # Source files and Targets
79 ######################################################################
80 unittest = sptest_env.Program('unittest', ['pmutilitytest.cpp', 'otmunittest.cpp',
81 'secureresourceprovider.cpp',
82 'provisioningdatabasemanager.cpp',
83 'ocprovisioningmanager.cpp' ])
85 Alias("test", [unittest])
87 env.AppendTarget('test')
88 if env.get('TEST') == '1':
89 if target_os == 'linux':
90 out_dir = env.get('BUILD_DIR')
91 result_dir = env.get('BUILD_DIR') + '/test_out/'
92 if not os.path.isdir(result_dir):
93 os.makedirs(result_dir)
94 sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
95 sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
96 sptest_env.AppendENVPath('PATH', env.get('BUILD_DIR'))
97 sptest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
98 ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')