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 '../../ocmalloc/include',
34 '../../connectivity/inc',
35 '../../connectivity/api',
36 '../../connectivity/external/inc',
37 '../../connectivity/lib/libcoap-4.1.1',
39 '../include/internal',
40 '../../logger/include',
41 '../../ocmalloc/include',
42 '../../stack/include',
43 '../../stack/include/internal',
44 '../../../oc_logger/include',
45 '../../../../extlibs/gtest/gtest-1.7.0/include',
46 '../../../../extlibs/cjson/',
47 '../provisioning/include',
48 # '../../../../extlibs/tinydtls/',
52 srmtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
53 srmtest_env.AppendUnique(LIBS = ['-lpthread'])
54 srmtest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
55 srmtest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
56 srmtest_env.PrependUnique(LIBS = ['ocsrm',
59 'connectivity_abstraction',
64 if env.get('SECURED') == '1':
65 srmtest_env.AppendUnique(LIBS = ['tinydtls'])
67 if not env.get('RELEASE'):
68 srmtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
70 ######################################################################
71 # Source files and Targets
72 ######################################################################
73 unittest = srmtest_env.Program('unittest', ['aclresourcetest.cpp',
74 'amaclresourcetest.cpp',
78 'securityresourcemanager.cpp',
79 'credentialresource.cpp',
81 'iotvticalendartest.cpp',
83 'svcresourcetest.cpp',
85 'directpairingtest.cpp',
86 'crlresourcetest.cpp'])
88 Alias("test", [unittest])
90 unittest_src_dir = src_dir + '/resource/csdk/security/unittest/'
91 unittest_build_dir = env.get('BUILD_DIR') + 'resource/csdk/security/unittest'
93 srmtest_env.AppendUnique(CPPDEFINES = ['SECURITY_BUILD_UNITTEST_DIR='+unittest_build_dir])
95 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
96 unittest_src_dir + 'oic_unittest.json'))
97 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
98 unittest_src_dir + 'oic_unittest_acl1.json'))
99 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
100 unittest_src_dir + 'oic_unittest_default_acl.json'))
102 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
103 unittest_src_dir + 'oic_unittest.dat'))
104 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
105 unittest_src_dir + 'oic_unittest_acl1.dat'))
106 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
107 unittest_src_dir + 'oic_unittest_default_acl.dat'))
108 srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
109 unittest_src_dir + 'oic_svr_db_prov.dat'))
111 env.AppendTarget('test')
112 if env.get('TEST') == '1':
113 target_os = env.get('TARGET_OS')
114 if target_os == 'linux':
115 out_dir = env.get('BUILD_DIR')
116 result_dir = env.get('BUILD_DIR') + '/test_out/'
117 if not os.path.isdir(result_dir):
118 os.makedirs(result_dir)
119 srmtest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
120 srmtest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
121 srmtest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
122 ut = srmtest_env.Command ('ut', None, out_dir + '/resource/csdk/security/unittest/unittest')