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 # ResourceCache Unit Test build script
27 if env.get('RELEASE'):
28 env.AppendUnique(CCFLAGS = ['-Os'])
29 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
31 env.AppendUnique(CCFLAGS = ['-g'])
33 if env.get('LOGGING'):
34 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
37 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
39 ######################################################################
41 ######################################################################
42 src_dir = lib_env.get('SRC_DIR')
43 gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0'
45 cache_test_env = lib_env.Clone()
46 target_os = env.get('TARGET_OS')
48 ######################################################################
50 ######################################################################
51 gtest = File(gtest_dir + '/lib/.libs/libgtest.a')
52 gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a')
54 cache_test_env.AppendUnique(CPPPATH = ['../include'])
55 cache_test_env.AppendUnique(CPPPATH = ['../../../include'])
56 cache_test_env.AppendUnique(CPPPATH = ['../../common/primitiveResource/include'])
57 cache_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/include'])
58 cache_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/src'])
59 cache_test_env.AppendUnique(CPPPATH = ['../../common/utils/include'])
60 cache_test_env.PrependUnique(CPPPATH = [env.get('SRC_DIR')+'/extlibs/hippomocks-master',
61 gtest_dir + '/include'])
62 cache_test_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
63 cache_test_env.PrependUnique(LIBS = ['rcs_client', 'rcs_common', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', gtest, gtest_main])
65 if target_os not in ['windows', 'winrt']:
66 cache_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
68 if target_os == 'linux':
69 cache_test_env.AppendUnique(LIBS = ['pthread'])
71 ######################################################################
73 ######################################################################
74 cache_test_src = env.Glob('./*.cpp')
75 cache_test = cache_test_env.Program('cache_test', cache_test_src)
76 Alias("cache_test", cache_test)
77 env.AppendTarget('cache_test')
79 if env.get('TEST') == '1':
80 target_os = env.get('TARGET_OS')
81 if target_os == 'linux':
82 from tools.scons.RunTest import *
83 run_test(cache_test_env,
84 'cache_test.memcheck',
85 'service/resource-encapsulation/src/resourceCache/unittests/cache_test')