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 # SConscript file for Local PKI google tests
25 gtest_env = SConscript('#extlibs/gtest/SConscript')
26 catest_env = gtest_env.Clone()
28 src_dir = catest_env.get('SRC_DIR')
29 target_os = catest_env.get('TARGET_OS')
30 target_transport = catest_env.get('TARGET_TRANSPORT')
32 ######################################################################
34 ######################################################################
35 catest_env.PrependUnique(CPPPATH = [
36 '../../ocsocket/include',
37 '../../logger/include',
38 '../../stack/include',
39 '../../extlibs/cjson',
40 '../../../oc_logger/include',
43 tmplist = catest_env['LINKFLAGS'][:]
44 if '-lpthread' in tmplist:
45 tmplist.remove('-lpthread')
46 catest_env.Replace(LINKFLAGS = tmplist)
48 if target_os not in ['windows']:
49 catest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
50 catest_env.AppendUnique(LIBPATH = [catest_env.get('BUILD_DIR')])
51 catest_env.PrependUnique(LIBS = ['gtest', 'gtest_main'])
52 catest_env.PrependUnique(LIBS = ['octbstack',
53 'connectivity_abstraction',
56 if target_os not in ['arduino', 'darwin', 'ios']:
57 catest_env.AppendUnique(LIBS=['rt'])
59 if catest_env.get('SECURED') == '1':
60 catest_env.AppendUnique(LIBS = ['tinydtls'])
62 if catest_env.get('LOGGING'):
63 catest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
65 if target_os not in ['msys_nt', 'windows']:
66 catest_env.AppendUnique(LIBS = ['m'])
67 catest_env.PrependUnique(LIBS = ['pthread'])
69 ######################################################################
70 # Source files and Targets
71 ######################################################################
72 catests = catest_env.Program('catests', ['catests.cpp',
73 'caprotocolmessagetest.cpp',
74 'ca_api_unittest.cpp',
79 Alias("test", [catests])
81 catest_env.AppendTarget('test')
82 if catest_env.get('TEST') == '1':
83 if target_os in ['linux']:
84 catest_env.AppendENVPath('PATH', catest_env.get('BUILD_DIR'))
85 from tools.scons.RunTest import *
87 'resource_csdk_connectivity_test.memcheck',
88 'resource/csdk/connectivity/test/catests')