1 # //******************************************************************
3 # // Copyright 2015 Intel Mobile Communications GmbH 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 srmtest_env = env.Clone()
27 src_dir = srmtest_env.get('SRC_DIR')
29 ######################################################################
31 ######################################################################
32 srmtest_env.PrependUnique(CPPPATH = [
33 '../../../c_common/oic_malloc/include',
34 '../../connectivity/inc',
35 '../../connectivity/api',
36 '../../connectivity/external/inc',
37 '../../connectivity/lib/libcoap-4.1.1',
38 '../include/internal',
39 '../../logger/include',
40 '../../stack/include',
41 '../../stack/include/internal',
42 '../../../oc_logger/include',
43 '../../../../extlibs/gtest/gtest-1.7.0/include',
44 '../../../../extlibs/cjson/',
45 '../provisioning/include',
49 srmtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
50 srmtest_env.AppendUnique(LIBS = ['-lpthread'])
51 srmtest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
52 srmtest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
53 srmtest_env.PrependUnique(LIBS = ['ocsrm',
56 'connectivity_abstraction',
61 if env.get('SECURED') == '1':
62 srmtest_env.AppendUnique(LIBS = ['tinydtls'])
64 if not env.get('RELEASE'):
65 srmtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
67 ######################################################################
68 # Source files and Targets
69 ######################################################################
70 unittest = srmtest_env.Program('unittest', ['aclresourcetest.cpp',
71 'amaclresourcetest.cpp',
75 'securityresourcemanager.cpp',
76 'credentialresource.cpp',
78 'iotvticalendartest.cpp',
80 'svcresourcetest.cpp',
82 'directpairingtest.cpp',
83 'crlresourcetest.cpp'])
85 Alias("test", [unittest])
87 unittest_src_dir = src_dir + '/resource/csdk/security/unittest/'
88 unittest_build_dir = env.get('BUILD_DIR') + 'resource/csdk/security/unittest'
90 srmtest_env.AppendUnique(CPPDEFINES = ['SECURITY_BUILD_UNITTEST_DIR='+unittest_build_dir])
92 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
93 unittest_src_dir + 'oic_unittest.json'))
94 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
95 unittest_src_dir + 'oic_unittest_acl1.json'))
96 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
97 unittest_src_dir + 'oic_unittest_default_acl.json'))
99 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
100 unittest_src_dir + 'oic_unittest.dat'))
101 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
102 unittest_src_dir + 'oic_unittest_acl1.dat'))
103 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
104 unittest_src_dir + 'oic_unittest_default_acl.dat'))
105 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
106 unittest_src_dir + 'oic_svr_db_prov.dat'))
108 env.AppendTarget('test')
109 if env.get('TEST') == '1':
110 target_os = env.get('TARGET_OS')
111 if target_os == 'linux':
112 out_dir = env.get('BUILD_DIR')
113 result_dir = env.get('BUILD_DIR') + '/test_out/'
114 if not os.path.isdir(result_dir):
115 os.makedirs(result_dir)
116 srmtest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
117 srmtest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
118 srmtest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
119 ut = srmtest_env.Command ('ut', None, out_dir + '/resource/csdk/security/unittest/unittest')