#****************************************************************** # # 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. # #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## # ThingsManager Unit Test build script ## import os # SConscript file for Local PKI google tests gtest_env = SConscript('#extlibs/gtest/SConscript') lib_env = gtest_env.Clone() target_os = lib_env.get('TARGET_OS') if lib_env.get('RELEASE'): lib_env.AppendUnique(CCFLAGS = ['-Os']) lib_env.AppendUnique(CPPDEFINES = ['NDEBUG']) else: lib_env.AppendUnique(CCFLAGS = ['-g']) if lib_env.get('LOGGING'): lib_env.AppendUnique(CPPDEFINES = ['TB_LOG']) # Add third party libraries SConscript('#service/third_party_libs.scons', 'lib_env') if target_os in ['linux']: # Verify that 'hippomocks' mocking code is installed. # If not, get it and install it SConscript('#extlibs/hippomocks.scons') ThingsManager_gtest_env = lib_env.Clone() ###################################################################### #unit test setting ###################################################################### src_dir = ThingsManager_gtest_env.get('SRC_DIR') ###################################################################### # Build flags ###################################################################### ThingsManager_gtest_env.AppendUnique( CPPPATH = [ src_dir + '/extlibs/hippomocks-master', '../sdk/inc', '../../../extlibs/timer' ]) if target_os not in ['windows', 'winrt']: ThingsManager_gtest_env.AppendUnique(LIBS = ['dl']) ThingsManager_gtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall']) if target_os != 'android': ThingsManager_gtest_env.AppendUnique(CXXFLAGS = ['-pthread']) ThingsManager_gtest_env.AppendUnique(LIBS = ['pthread']) ThingsManager_gtest_env.PrependUnique(LIBS = [ 'libTGMSDKLibrary', 'coap', 'connectivity_abstraction', 'oc_logger', 'oc_logger_core', 'oc', 'octbstack', 'gtest', 'gtest_main']) ###################################################################### # Build Test ###################################################################### ThingsManager_gtest_src = ThingsManager_gtest_env.Glob('./*.cpp') ThingsManagerTest = ThingsManager_gtest_env.Program('ThingsManagerTest', ThingsManager_gtest_src) Alias("ThingsManagerTest", ThingsManagerTest) ThingsManager_gtest_env.AppendTarget('ThingsManagerTest') if ThingsManager_gtest_env.get('TEST') == '1': if target_os in ['linux']: from tools.scons.RunTest import * run_test(ThingsManager_gtest_env, '', 'service/things-manager/unittests/ThingsManagerTest')