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 '../../ocsocket/include',
33 '../../logger/include',
34 '../../stack/include',
35 '../../ocmalloc/include',
36 '../../extlibs/cjson',
37 '../../../oc_logger/include',
38 '../../../../extlibs/gtest/gtest-1.7.0/include'
41 tmplist = catest_env['LINKFLAGS'][:]
42 if '-lpthread' in tmplist:
43 tmplist.remove('-lpthread')
44 catest_env.Replace(LINKFLAGS = tmplist)
46 catest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
47 catest_env.AppendUnique(LIBS = ['pthread'])
48 catest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
49 catest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
50 catest_env.PrependUnique(LIBS = ['m',
53 'connectivity_abstraction',
58 if env.get('SECURED') == '1':
59 catest_env.AppendUnique(LIBS = ['tinydtls'])
60 catest_env.ParseConfig('pkg-config --libs glib-2.0');
62 if env.get('LOGGING'):
63 catest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
65 ######################################################################
66 # Source files and Targets
67 ######################################################################
68 catests = catest_env.Program('catests', ['catests.cpp',
69 'caprotocolmessagetest.cpp',
70 'ca_api_unittest.cpp'])
72 Alias("test", [catests])
74 env.AppendTarget('test')
75 if env.get('TEST') == '1':
76 target_os = env.get('TARGET_OS')
77 if target_os == 'linux':
78 out_dir = env.get('BUILD_DIR')
79 result_dir = env.get('BUILD_DIR') + '/test_out/'
80 if not os.path.isdir(result_dir):
81 os.makedirs(result_dir)
82 catest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
83 catest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
84 catest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
85 ut = catest_env.Command ('ut', None, 'valgrind -q --leak-check=full --xml=yes --xml-file=resource_csdk_connectivity_test.memcheck ' + out_dir + 'resource/csdk/connectivity/test/catests')