Imported Upstream version 1.1.1
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceCache / unittests / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Samsung Electronics All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
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
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ##
22 # ResourceCache Unit Test build script
23 ##
24
25 # SConscript file for Local PKI google tests
26 gtest_env = SConscript('#extlibs/gtest/SConscript')
27 lib_env = gtest_env.Clone()
28
29
30 if lib_env.get('RELEASE'):
31     lib_env.AppendUnique(CCFLAGS = ['-Os'])
32     lib_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
33 else:
34     lib_env.AppendUnique(CCFLAGS = ['-g'])
35
36 if lib_env.get('LOGGING'):
37     lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
38
39 SConscript(lib_env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
40
41 ######################################################################
42 # unit test setting
43 ######################################################################
44 cache_test_env = lib_env.Clone()
45 target_os = cache_test_env.get('TARGET_OS')
46
47 ######################################################################
48 # Build flags
49 ######################################################################
50
51 cache_test_env.AppendUnique(CPPPATH = ['../include'])
52 cache_test_env.AppendUnique(CPPPATH = ['../../../include'])
53 cache_test_env.AppendUnique(CPPPATH = ['../../common/primitiveResource/include'])
54 cache_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/include'])
55 cache_test_env.AppendUnique(CPPPATH = ['../../common/expiryTimer/src'])
56 cache_test_env.AppendUnique(CPPPATH = ['../../common/utils/include'])
57 cache_test_env.PrependUnique(CPPPATH = [cache_test_env.get('SRC_DIR')+'/extlibs/hippomocks-master'])
58 cache_test_env.AppendUnique(LIBPATH = [cache_test_env.get('BUILD_DIR')])
59 cache_test_env.PrependUnique(LIBS = ['rcs_client', 'rcs_common', 'oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'coap', 'gtest', 'gtest_main'])
60
61 if target_os not in ['windows', 'winrt']:
62     cache_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
63
64 if target_os == 'linux':
65     cache_test_env.AppendUnique(LIBS = ['pthread'])
66
67 ######################################################################
68 # Build Test
69 ######################################################################
70 cache_test_src = cache_test_env.Glob('./*.cpp')
71 cache_test = cache_test_env.Program('cache_test', cache_test_src)
72 Alias("cache_test", cache_test)
73 cache_test_env.AppendTarget('cache_test')
74
75 if cache_test_env.get('TEST') == '1':
76         if target_os == 'linux':
77                 from tools.scons.RunTest import *
78                 run_test(cache_test_env,
79                          'cache_test.memcheck',
80                          'service/resource-encapsulation/src/resourceCache/unittests/cache_test')