Enabled IP CAGetNetworkInformation() API
[platform/upstream/iotivity.git] / resource / csdk / connectivity / test / 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 import os
22 import os.path
23
24 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 catest_env = gtest_env.Clone()
27 target_os = catest_env.get('TARGET_OS')
28 target_transport = catest_env.get('TARGET_TRANSPORT')
29
30 ######################################################################
31 # Build flags
32 ######################################################################
33 catest_env.PrependUnique(CPPPATH = [
34                 '../../logger/include',
35                 '../../stack/include',
36                 '../../extlibs/cjson',
37                 '../../../oc_logger/include',
38                ])
39
40 catest_env.AppendUnique(LIBPATH = [catest_env.get('BUILD_DIR')])
41 catest_env.PrependUnique(LIBS = ['gtest', 'gtest_main'])
42 catest_env.PrependUnique(LIBS = ['octbstack',
43                                     'connectivity_abstraction',
44                                     'coap'])
45
46 if target_os not in ['arduino', 'darwin', 'ios', 'msys_nt', 'windows']:
47         catest_env.AppendUnique(LIBS=['rt'])
48
49 if catest_env.get('SECURED') == '1':
50         catest_env.AppendUnique(LIBS = ['tinydtls'])
51         catest_env.AppendUnique(LIBS = ['timer'])
52
53 if catest_env.get('LOGGING'):
54         catest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
55
56 if target_os in ['msys_nt', 'windows']:
57         catest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
58         catest_env.AppendUnique(LIBS = ['ws2_32',
59                                         'advapi32',
60                                         'iphlpapi'])
61 else:
62         catest_env.AppendUnique(LIBS = ['m'])
63
64 ######################################################################
65 # Source files and Targets
66 ######################################################################
67
68 if (('IP' in target_transport) or ('ALL' in target_transport)):
69         if target_os != 'arduino':
70                 catests = catest_env.Program('catests', ['catests.cpp',
71                                                          'caprotocolmessagetest.cpp',
72                                                          'cablocktransfertest.cpp',
73                                                          'ca_api_unittest.cpp',
74                                                          'camutex_tests.cpp',
75                                                          'uarraylist_test.cpp',
76                                                          'ulinklist_test.cpp',
77                                                          'uqueue_test.cpp'
78                                                                ])
79 else:
80         # Include all unit test files
81                 catests = catest_env.Program('catests', ['catests.cpp',
82                                                          'caprotocolmessagetest.cpp',
83                                                          'ca_api_unittest.cpp',
84                                                          'camutex_tests.cpp',
85                                                          'uarraylist_test.cpp',
86                                                          'ulinklist_test.cpp',
87                                                          'uqueue_test.cpp'
88                                                                ])
89
90 Alias("test", [catests])
91
92 catest_env.AppendTarget('test')
93 if catest_env.get('TEST') == '1':
94         if target_os in ['linux', 'windows']:
95                 catest_env.AppendENVPath('PATH', catest_env.get('BUILD_DIR'))
96                 from tools.scons.RunTest import *
97                 run_test(catest_env,
98                          'resource_csdk_connectivity_test.memcheck',
99                          'resource/csdk/connectivity/test/catests')