IOT-1583: Removing /W4 warning from resource/c_common.
[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 from tools.scons.RunTest import *
24
25 Import('test_env')
26
27 # SConscript file for Local PKI google tests
28 catest_env = test_env.Clone()
29 target_os = catest_env.get('TARGET_OS')
30 target_transport = catest_env.get('TARGET_TRANSPORT')
31 rd_mode = catest_env.get('RD_MODE')
32
33 ######################################################################
34 # Build flags
35 ######################################################################
36 catest_env.PrependUnique(CPPPATH = [
37                 '../../logger/include',
38                 '../../stack/include',
39                 '../../../oc_logger/include',
40                ])
41
42 catest_env.AppendUnique(LIBPATH = [catest_env.get('BUILD_DIR')])
43 catest_env.PrependUnique(LIBS = ['octbstack_test',
44                                     'connectivity_abstraction',
45                                     'coap'])
46
47 if target_os not in ['arduino', 'darwin', 'ios', 'msys_nt', 'windows']:
48         catest_env.AppendUnique(LIBS=['rt'])
49
50 if catest_env.get('SECURED') == '1':
51         catest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
52
53 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
54         catest_env.PrependUnique(LIBS = ['resource_directory'])
55
56 if catest_env.get('LOGGING'):
57         catest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
58
59 if target_os not in ['msys_nt', 'windows']:
60         catest_env.AppendUnique(LIBS = ['m'])
61
62 ######################################################################
63 # Source files and Targets
64 ######################################################################
65
66 tests_src = [
67         'catests.cpp',
68         'caprotocolmessagetest.cpp',
69         'ca_api_unittest.cpp',
70         'octhread_tests.cpp',
71         'uarraylist_test.cpp',
72         'ulinklist_test.cpp',
73         'uqueue_test.cpp'
74 ]
75
76 if (('IP' in target_transport) or ('ALL' in target_transport)):
77         if target_os != 'arduino':
78                 tests_src = tests_src + ['cablocktransfertest.cpp']
79
80 if catest_env.get('SECURED') == '1' and catest_env.get('WITH_TCP') == True:
81         tests_src = tests_src + ['ssladapter_test.cpp']
82
83 catests = catest_env.Program('catests', tests_src)
84
85 Alias("test", [catests])
86
87 catest_env.AppendTarget('test')
88 # TODO: fix test in supported configurations
89 if catest_env.get('TEST') == '1' and catest_env.get('SECURED') != '1':
90         if target_os in ['linux', 'windows']:
91                 catest_env.AppendENVPath('PATH', catest_env.get('BUILD_DIR'))
92                 run_test(catest_env,
93                          'resource_csdk_connectivity_test.memcheck',
94                          'resource/csdk/connectivity/test/catests')