added OCAccountManager class
[platform/upstream/iotivity.git] / resource / unittests / SConscript
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH 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 import os
22 import os.path
23
24 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 unittests_env = gtest_env.Clone()
27 src_dir = unittests_env.get('SRC_DIR')
28 target_os = unittests_env.get('TARGET_OS')
29
30 ######################################################################
31 # Build flags
32 ######################################################################
33 unittests_env.PrependUnique(CPPPATH = [
34                 '../include',
35                 '../oc_logger/include',
36                 '../csdk/stack/include',
37                 '../csdk/security/include',
38                 '../csdk/stack/include/internal',
39                 '../csdk/connectivity/api',
40                 '../csdk/connectivity/external/inc',
41                 '../csdk/ocsocket/include',
42                 '../c_common/ocrandom/include',
43                 '../csdk/logger/include',
44                 '#extlibs/hippomocks-master/HippoMocks',
45                 '#extlibs/hippomocks-master/HippoMocksTest'
46                 ])
47
48 unittests_env.AppendUnique(LIBPATH = [unittests_env.get('BUILD_DIR')])
49 unittests_env.PrependUnique(LIBS = [
50                 'oc',
51                 'octbstack',
52                 'oc_logger',
53                 'connectivity_abstraction',
54                 'coap'
55                 ])
56
57 if unittests_env.get('SECURED') == '1':
58         unittests_env.AppendUnique(LIBS = ['tinydtls'])
59
60 if unittests_env.get('LOGGING'):
61         unittests_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
62
63 if unittests_env.get('WITH_CLOUD'):
64         unittests_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
65
66 ######################################################################
67 # Source files and Targets
68 ######################################################################
69
70 unittests_src = [
71                 'ConstructResourceTest.cpp',
72                 'OCPlatformTest.cpp',
73                 'OCRepresentationTest.cpp',
74                 'OCRepresentationEncodingTest.cpp',
75                 'OCResourceTest.cpp',
76                 'OCExceptionTest.cpp',
77                 'OCResourceResponseTest.cpp',
78                 'OCHeaderOptionTest.cpp'
79         ]
80
81 if unittests_env.get('WITH_CLOUD'):
82         unittests_src = unittests_src + ['OCAccountManagerTest.cpp']
83
84 unittests = unittests_env.Program('unittests', unittests_src)
85
86 Alias("unittests", [unittests])
87
88 unittests_env.AppendTarget('unittests')
89 if unittests_env.get('TEST') == '1':
90         if target_os in ['linux']:
91                 from tools.scons.RunTest import *
92                 run_test(unittests_env,
93                          'resource_unittests_unittests.memcheck',
94                          'resource/unittests/unittests')
95
96 src_dir = unittests_env.get('SRC_DIR')
97 svr_db_src_dir = os.path.join(src_dir, 'resource/examples/')
98 svr_db_build_dir = os.path.join(unittests_env.get('BUILD_DIR'), 'resource', 'unittests') + os.sep
99 unittests_env.Alias("install",
100                     unittests_env.Install(svr_db_build_dir,
101                                           os.path.join(svr_db_src_dir,
102                                                        'oic_svr_db_client.dat')))