1 #******************************************************************
3 # Copyright 2014 Intel Mobile Communications GmbH 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 stacktest_env = env.Clone()
26 src_dir = stacktest_env.get('SRC_DIR')
28 ######################################################################
30 ######################################################################
31 stacktest_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 stacktest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
42 stacktest_env.AppendUnique(LIBS = ['-lpthread'])
43 stacktest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
44 stacktest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
45 stacktest_env.PrependUnique(LIBS = ['m',
48 'connectivity_abstraction',
53 if env.get('SECURED') == '1':
54 stacktest_env.AppendUnique(LIBS = ['tinydtls'])
55 stacktest_env.ParseConfig('pkg-config --libs glib-2.0');
57 if not env.get('RELEASE'):
58 stacktest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
60 ######################################################################
61 # Source files and Targets
62 ######################################################################
63 stacktests = stacktest_env.Program('stacktests', ['stacktests.cpp'])
65 Alias("test", [stacktests])
67 env.AppendTarget('test')
68 if env.get('TEST') == '1':
69 target_os = env.get('TARGET_OS')
70 if target_os == 'linux':
71 out_dir = env.get('BUILD_DIR')
72 result_dir = env.get('BUILD_DIR') + '/test_out/'
73 if not os.path.isdir(result_dir):
74 os.makedirs(result_dir)
75 stacktest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
76 stacktest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
77 stacktest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
78 ut = stacktest_env.Command ('ut', None, out_dir + '/resource/csdk/stack/test/stacktests')