1 #******************************************************************
3 # Copyright 2015 Samsung Electronics All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 catest_env = env.Clone()
26 src_dir = catest_env.get('SRC_DIR')
28 ######################################################################
30 ######################################################################
31 catest_env.PrependUnique(CPPPATH = [
32 '../../logger/include',
33 '../../stack/include',
34 '../../extlibs/cjson',
35 '../../../oc_logger/include',
36 '../../../../extlibs/gtest/gtest-1.7.0/include'
39 tmplist = catest_env['LINKFLAGS'][:]
40 if '-lpthread' in tmplist:
41 tmplist.remove('-lpthread')
42 catest_env.Replace(LINKFLAGS = tmplist)
44 catest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
45 catest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
46 catest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
47 catest_env.PrependUnique(LIBS = ['octbstack',
48 'connectivity_abstraction',
53 target_os = env.get('TARGET_OS')
55 if target_os not in ['arduino', 'darwin', 'ios', 'msys_nt', 'windows']:
56 catest_env.AppendUnique(LIBS=['rt'])
58 if env.get('SECURED') == '1':
59 catest_env.AppendUnique(LIBS = ['tinydtls'])
60 catest_env.AppendUnique(LIBS = ['timer'])
62 if env.get('WITH_RD') == '1':
63 catest_env.PrependUnique(LIBS = ['resource_directory'])
65 if env.get('LOGGING'):
66 catest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
68 if target_os in ['msys_nt', 'windows']:
69 catest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE'])
70 catest_env.AppendUnique(LIBS = ['ws2_32',
74 catest_env.PrependUnique(LIBS = ['m', 'pthread'])
76 ######################################################################
77 # Source files and Targets
78 ######################################################################
80 target_os = env.get('TARGET_OS')
81 target_transport = env.get('TARGET_TRANSPORT')
83 if (('IP' in target_transport) or ('ALL' in target_transport)):
84 if target_os != 'arduino':
85 catests = catest_env.Program('catests', ['catests.cpp',
86 'caprotocolmessagetest.cpp',
87 'cablocktransfertest.cpp',
88 'ca_api_unittest.cpp',
93 catests = catest_env.Program('catests', ['catests.cpp',
94 'caprotocolmessagetest.cpp',
95 'ca_api_unittest.cpp',
100 Alias("test", [catests])
102 env.AppendTarget('test')
103 if env.get('TEST') == '1':
104 if target_os in ['linux', 'windows']:
105 catest_env.AppendENVPath('PATH', env.get('BUILD_DIR'))
106 from tools.scons.RunTest import *
108 'resource_csdk_connectivity_test.memcheck',
109 'resource/csdk/connectivity/test/catests')