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 # //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 # SConscript file for Local PKI google tests
27 pki_test_env = env.Clone()
29 src_dir = pki_test_env.get('SRC_DIR')
31 ######################################################################
33 ######################################################################
34 pki_test_env.PrependUnique(CPPPATH = ['../include/',
35 '../include/internal',
37 '../../include/internal',
39 '../../../include/internal',
40 '../../../../connectivity/inc',
41 '../../../../connectivity/api',
42 '../../../../logger/include',
43 '../../../../stack/include',
44 '../../../../../oc_logger/include',
45 '../../../../../../extlibs/gtest/gtest-1.7.0/include',
46 '../../../../../../extlibs/asn1cert',
47 '../../../../../../extlibs/tinydtls',
48 '../../../../../../extlibs/tinydtls/ecc',
49 '../../../../../../extlibs/tinydtls/sha2'
51 pki_test_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
52 pki_test_env.AppendUnique(LIBS = ['pthread'])
53 pki_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
54 pki_test_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
56 pki_test_env.AppendUnique(LIBS = ['octbstack'])
57 pki_test_env.AppendUnique(LIBS = ['CKManager'])
58 pki_test_env.AppendUnique(LIBS = ['asn1'])
59 pki_test_env.AppendUnique(LIBS = ['gtest'])
60 pki_test_env.AppendUnique(LIBS = ['gtest_main'])
62 if env.get('SECURED') == '1':
63 pki_test_env.AppendUnique(LIBS = ['tinydtls'])
65 if not env.get('RELEASE'):
66 pki_test_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
68 ######################################################################
69 # Source files and Targets
70 ######################################################################
71 unittest = pki_test_env.Program('unittest', ['pki_test.cpp'])
73 Alias("test", [unittest])
77 unittest_src_dir = src_dir + '/resource/csdk/security/provisioning/ck_manager/unittest/test_data/'
78 unittest_build_dir = env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/ck_manager/unittest'
80 pki_test_env.Alias("install",env.Install( unittest_build_dir, [ unittest_src_dir + '01.der',
81 unittest_src_dir + 'cacert.der',
82 unittest_src_dir + 'capub.der',
83 unittest_src_dir + 'cert_chain.dat',
84 unittest_src_dir + 'chain.der',
85 unittest_src_dir + 'CKMInfo.dat' ]))
87 env.AppendTarget('test')
88 if env.get('TEST') == '1':
89 target_os = env.get('TARGET_OS')
90 if target_os == 'linux':
91 out_dir = env.get('BUILD_DIR')
92 result_dir = env.get('BUILD_DIR') + '/test_out/'
93 if not os.path.isdir(result_dir):
94 os.makedirs(result_dir)
95 pki_test_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
96 pki_test_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
97 pki_test_env.AppendENVPath('LD_LIBRARY_PATH', [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
98 ut = pki_test_env.Command ('ut', None, out_dir + '/resource/csdk/security/unittest/unittest')