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')
29 ######################################################################
31 ######################################################################
32 sptest_env.PrependUnique(CPPPATH = [
35 '../include/internal',
36 '../../../stack/include',
37 '../../../ocrandom/include',
38 '../../../logger/include',
39 '../../../stack/include',
40 '../../../security/include',
41 '../../../security/include/internal',
42 '../../../security/provisioning/include/internal',
43 '../../../../oc_logger/include',
45 '../../../../../extlibs/tinydtls',
46 '../../../../../extlibs/cjson',
47 '../../../../../extlibs/base64',
48 '../../../connectivity/inc',
49 '../../../connectivity/common/inc',
50 '../../../connectivity/lib/libcoap-4.1.1',
51 '../../../connectivity/api',
52 '../../../../../extlibs/tinydtls',
53 '../../../../../extlibs/gtest/gtest-1.7.0/include'
55 sptest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
56 sptest_env.AppendUnique(LIBS = ['-lpthread','-ldl'])
57 sptest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
58 sptest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
59 sptest_env.PrependUnique(LIBS = [ 'ocpmapi',
64 'connectivity_abstraction',
69 if env.get('SECURED') == '1':
70 sptest_env.AppendUnique(LIBS = ['tinydtls'])
71 if env.get('DTLS_WITH_X509') == '1':
72 sptest_env.AppendUnique(LIBS = ['CKManager'])
73 sptest_env.AppendUnique(LIBS = ['asn1'])
75 if not env.get('RELEASE'):
76 sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
78 ######################################################################
79 # Source files and Targets
80 ######################################################################
81 unittest = sptest_env.Program('unittest', ['pmutilitytest.cpp',
82 'secureresourceprovider.cpp',
83 'provisioningdatabasemanager.cpp',
84 'ocprovisioningmanager.cpp','otmunittest.cpp' ])
86 sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
87 sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
89 provisioning_unittest_src_dir = src_dir + '/resource/csdk/security/provisioning/unittest/'
90 provisioning_unittest_build_dir = env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/unittest/'
92 Alias("test", [unittest, sample_server1, sample_server2])
94 env.AppendTarget('test')
95 if env.get('TEST') == '1':
96 target_os = env.get('TARGET_OS')
97 if target_os == 'linux':
98 out_dir = env.get('BUILD_DIR')
99 result_dir = env.get('BUILD_DIR') + '/test_out/'
100 if not os.path.isdir(result_dir):
101 os.makedirs(result_dir)
102 sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
103 sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
104 sptest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
105 ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')