[IOT-1911] Make resource/csdk/stack W4 compliant.
[platform/upstream/iotivity.git] / resource / csdk / stack / test / 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 from tools.scons.RunTest import *
24
25 Import('test_env')
26
27 # SConscript file for Local PKI google tests
28 stacktest_env = test_env.Clone()
29 target_os = stacktest_env.get('TARGET_OS')
30 rd_mode = stacktest_env.get('RD_MODE')
31
32 ######################################################################
33 # Build flags
34 ######################################################################
35 stacktest_env.PrependUnique(CPPPATH = [
36         '../../security/include',
37         '../../ocsocket/include',
38         '../../logger/include',
39         '../../../c_common/ocrandom/include',
40         '../../include',
41         '../../stack/include',
42         '../../stack/include/internal',
43         '../../connectivity/api',
44         '../../connectivity/inc/pkix',
45         '../../connectivity/external/inc',
46         '../../../oc_logger/include',
47         ])
48
49 stacktest_env.AppendUnique(LIBPATH = [stacktest_env.get('BUILD_DIR')])
50 stacktest_env.PrependUnique(LIBS = ['octbstack_test',
51                                     'ocsrm',
52                                     'connectivity_abstraction',
53                                     'coap'])
54 if target_os != 'darwin':
55     stacktest_env.PrependUnique(LIBS = ['oc_logger'])
56
57 if stacktest_env.get('SECURED') == '1':
58     stacktest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
59
60 if stacktest_env.get('LOGGING'):
61     stacktest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
62
63 if target_os in ['msys_nt', 'windows']:
64     stacktest_env.PrependUnique(LIBS = ['sqlite3'])
65     stacktest_env.AppendUnique(CCFLAGS=['/W4', '/WX'])
66 else:
67     stacktest_env.PrependUnique(LIBS = ['m'])
68
69 if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
70     stacktest_env.PrependUnique(LIBS = ['resource_directory'])
71
72 stacktest_env.AppendUnique(LIBS = ['timer'])
73 ######################################################################
74 # Source files and Targets
75 ######################################################################
76 stacktests = stacktest_env.Program('stacktests', ['stacktests.cpp'])
77 cbortests = stacktest_env.Program('cbortests', ['cbortests.cpp'])
78
79 Alias("test", [stacktests, cbortests])
80
81 stacktest_env.AppendTarget('test')
82 if stacktest_env.get('TEST') == '1':
83     if target_os in ['linux', 'windows']:
84                 run_test(stacktest_env,
85                          'resource_csdk_stack_test.memcheck',
86                          'resource/csdk/stack/test/stacktests')
87                 run_test(stacktest_env,
88                          'resource_csdk_stack_test.memcheck',
89                          'resource/csdk/stack/test/cbortests')