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 # ResourceHosting Unit Test build script
24 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 lib_env = gtest_env.Clone()
28 if lib_env.get('RELEASE'):
29 lib_env.AppendUnique(CCFLAGS = ['-Os'])
30 lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
32 lib_env.AppendUnique(CCFLAGS = ['-g'])
34 if lib_env.get('LOGGING'):
35 lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
38 SConscript('#service/third_party_libs.scons', 'lib_env')
40 ######################################################################
42 ######################################################################
43 src_dir = lib_env.get('SRC_DIR')
45 hosting_test_env = lib_env.Clone()
46 target_os = hosting_test_env.get('TARGET_OS')
48 ######################################################################
50 ######################################################################
52 hosting_test_env.AppendUnique(LIBPATH = [hosting_test_env.get('BUILD_DIR')])
53 hosting_test_env.AppendUnique(LIBS = [
54 'resource_hosting', 'rcs_server', 'rcs_client','rcs_common',
55 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap',
56 'gtest_main', 'gtest'])
58 if target_os not in ['windows', 'winrt']:
59 hosting_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
61 if target_os in ['linux']:
62 hosting_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
63 hosting_test_env.AppendUnique(LIBS = ['pthread'])
65 hosting_test_env.PrependUnique(CPPPATH = [ src_dir + '/extlibs/hippomocks-master'])
66 hosting_test_env.AppendUnique(CPPPATH = ['../src'])
67 hosting_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/include'])
68 hosting_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/src/common/primitiveResource/include'])
69 hosting_test_env.AppendUnique(CPPPATH = ['../../resource-encapsulation/src/common/utils/include'])
70 ######################################################################
72 ######################################################################
74 hosting_test_src = hosting_test_env.Glob('./*.cpp')
75 hosting_test = hosting_test_env.Program('hosting_test', hosting_test_src)
76 Alias("hosting_test", hosting_test)
77 hosting_test_env.AppendTarget('hosting_test')
79 if hosting_test_env.get('TEST') == '1':
80 target_os = hosting_test_env.get('TARGET_OS')
81 if target_os in ['linux']:
82 from tools.scons.RunTest import *
83 run_test(hosting_test_env, '', 'service/resource-hosting/unittest/hosting_test')