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 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # ResourceClient Unit Test build script
24 # SConscript file for Local PKI google tests
26 from tools.scons.RunTest import run_test
28 gtest_env = SConscript('#extlibs/gtest/SConscript')
29 lib_env = gtest_env.Clone()
30 target_os = lib_env.get('TARGET_OS')
32 if lib_env.get('RELEASE'):
33 lib_env.AppendUnique(CCFLAGS = ['-Os'])
34 lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
36 lib_env.AppendUnique(CCFLAGS = ['-g'])
38 if lib_env.get('LOGGING'):
39 lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
41 # Add third party libraries
42 SConscript('#service/third_party_libs.scons', 'lib_env')
44 if target_os in ['linux']:
45 # Verify that 'hippomocks' mocking code is installed. If not,
46 # get it and install it
47 SConscript('#extlibs/hippomocks.scons')
49 rcs_test_env = lib_env.Clone()
51 ######################################################################
53 ######################################################################
54 src_dir = lib_env.get('SRC_DIR')
56 ######################################################################
58 ######################################################################
59 rcs_test_env.AppendUnique(
61 src_dir + '/extlibs/hippomocks-master',
63 '../src/common/utils/include',
66 rcs_test_env.PrependUnique(LIBS = [
67 'connectivity_abstraction',
76 if lib_env.get('SECURED') == '1':
77 rcs_test_env.AppendUnique(CPPDEFINES = ['SECURED'])
78 if lib_env.get('WITH_TCP') == True:
79 rcs_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
81 if 'g++' in rcs_test_env.get('CXX'):
82 rcs_test_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
84 ######################################################################
86 ######################################################################
87 rcs_test_src = rcs_test_env.Glob('./*.cpp')
89 rcs_client_test = rcs_test_env.Program('rcs_client_test', rcs_test_src)
90 Alias("rcs_client_test", rcs_client_test)
91 rcs_test_env.AppendTarget('rcs_client_test')
93 if rcs_test_env.get('TEST') == '1':
94 target_os = rcs_test_env.get('TARGET_OS')
95 # TODO: fix this test on linux and remove this comment line
96 if target_os in ['linux']:
97 run_test(rcs_test_env,
99 # 'service_resource-encapsulation_unittests_rcs_client_test.memcheck',
100 'service/resource-encapsulation/unittests/rcs_client_test')
102 rcs_test_env.AppendUnique(CPPDEFINES = ['LOCAL_RUNNING'])
103 if lib_env.get('SECURED') == '1':
104 src_dir = rcs_test_env.get('SRC_DIR')
105 svr_db_src_dir = os.path.join(src_dir, 'service/resource-encapsulation/unittests/')
106 svr_db_build_dir = os.path.join(rcs_test_env.get('BUILD_DIR'), 'service', 'resource-encapsulation', 'unittests') + os.sep
107 rcs_test_env.Alias("install",
108 rcs_test_env.Install(svr_db_build_dir,
109 os.path.join(svr_db_src_dir,
110 'oic_svr_db_re_client.dat')))