#****************************************************************** # # Copyright 2015 Samsung Electronics All Rights Reserved. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Import('env') import os import os.path catest_env = env.Clone() src_dir = catest_env.get('SRC_DIR') ###################################################################### # Build flags ###################################################################### catest_env.PrependUnique(CPPPATH = [ '../../logger/include', '../../stack/include', '../../extlibs/cjson', '../../../oc_logger/include', '../../../../extlibs/gtest/gtest-1.7.0/include' ]) tmplist = catest_env['LINKFLAGS'][:] if '-lpthread' in tmplist: tmplist.remove('-lpthread') catest_env.Replace(LINKFLAGS = tmplist) catest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread']) catest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) catest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs']) catest_env.PrependUnique(LIBS = ['octbstack', 'connectivity_abstraction', 'coap', 'gtest', 'gtest_main']) target_os = env.get('TARGET_OS') if target_os not in ['arduino', 'darwin', 'ios', 'msys_nt', 'windows']: catest_env.AppendUnique(LIBS=['rt']) if env.get('SECURED') == '1': catest_env.AppendUnique(LIBS = ['tinydtls']) catest_env.AppendUnique(LIBS = ['timer']) if env.get('WITH_RD') == '1': catest_env.PrependUnique(LIBS = ['resource_directory']) if env.get('LOGGING'): catest_env.AppendUnique(CPPDEFINES = ['TB_LOG']) if target_os in ['msys_nt', 'windows']: catest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE']) catest_env.AppendUnique(LIBS = ['ws2_32', 'advapi32', 'iphlpapi']) else: catest_env.PrependUnique(LIBS = ['m', 'pthread']) ###################################################################### # Source files and Targets ###################################################################### target_os = env.get('TARGET_OS') target_transport = env.get('TARGET_TRANSPORT') if (('IP' in target_transport) or ('ALL' in target_transport)): if target_os != 'arduino': catests = catest_env.Program('catests', ['catests.cpp', 'caprotocolmessagetest.cpp', 'cablocktransfertest.cpp', 'ca_api_unittest.cpp', 'camutex_tests.cpp', 'uarraylist_test.cpp' ]) else: catests = catest_env.Program('catests', ['catests.cpp', 'caprotocolmessagetest.cpp', 'ca_api_unittest.cpp', 'camutex_tests.cpp', 'uarraylist_test.cpp' ]) Alias("test", [catests]) env.AppendTarget('test') if env.get('TEST') == '1': if target_os in ['linux', 'windows']: catest_env.AppendENVPath('PATH', env.get('BUILD_DIR')) from tools.scons.RunTest import * run_test(catest_env, 'resource_csdk_connectivity_test.memcheck', 'resource/csdk/connectivity/test/catests')