Imported Upstream version 1.1.1
[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
24 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 stacktest_env = gtest_env.Clone()
27
28 src_dir = stacktest_env.get('SRC_DIR')
29 target_os = stacktest_env.get('TARGET_OS')
30
31 ######################################################################
32 # Build flags
33 ######################################################################
34 stacktest_env.PrependUnique(CPPPATH = [
35                 '../../security/include',
36                 '../../ocsocket/include',
37                 '../../logger/include',
38                 '../../../c_common/ocrandom/include',
39                 '../../stack/include',
40                 '../../stack/include/internal',
41                 '../../connectivity/api',
42                 '../../connectivity/external/inc',
43                 '../../extlibs/cjson',
44                 '../../../oc_logger/include',
45                 ])
46 if target_os not in ['windows']:
47         stacktest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
48 stacktest_env.AppendUnique(LIBPATH = [stacktest_env.get('BUILD_DIR')])
49 stacktest_env.PrependUnique(LIBS = ['octbstack',
50                                     'ocsrm',
51                                     'connectivity_abstraction',
52                                     'coap',
53                                     'gtest',
54                                     'gtest_main'])
55
56 if target_os != 'darwin':
57     stacktest_env.PrependUnique(LIBS = ['oc_logger'])
58
59 if stacktest_env.get('SECURED') == '1':
60     stacktest_env.AppendUnique(LIBS = ['tinydtls'])
61
62 if stacktest_env.get('LOGGING'):
63         stacktest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
64
65 if target_os not in ['msys_nt', 'windows']:
66         stacktest_env.PrependUnique(LIBS = ['m'])
67         stacktest_env.PrependUnique(LIBS = ['pthread'])
68
69 ######################################################################
70 # Source files and Targets
71 ######################################################################
72 stacktests = stacktest_env.Program('stacktests', ['stacktests.cpp'])
73 cbortests = stacktest_env.Program('cbortests', ['cbortests.cpp'])
74
75 Alias("test", [stacktests, cbortests])
76
77
78 stacktest_env.AppendTarget('test')
79 if stacktest_env.get('TEST') == '1':
80         if target_os in ['linux']:
81                 from tools.scons.RunTest import *
82                 run_test(stacktest_env,
83                          'resource_csdk_stack_test.memcheck',
84                          'resource/csdk/stack/test/stacktests')