##
# ResourceClient Unit Test build script
##
-import os
-Import('env')
-
-if env.get('RELEASE'):
- env.AppendUnique(CCFLAGS = ['-Os'])
- env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+# 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:
- env.AppendUnique(CCFLAGS = ['-g'])
+ lib_env.AppendUnique(CCFLAGS = ['-g'])
-if env.get('LOGGING'):
- env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+if lib_env.get('LOGGING'):
+ lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
# Add third party libraries
-lib_env = env.Clone()
-SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
-
-target_os = env.get('TARGET_OS')
-if target_os == 'linux':
- # Verify that 'google unit test' library is installed. If not,
- # get it and install it
- SConscript(env.get('SRC_DIR') + '/extlibs/gtest/SConscript')
+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(env.get('SRC_DIR') + '/extlibs/hippomocks.scons')
+ SConscript('#extlibs/hippomocks.scons')
rcs_test_env = lib_env.Clone()
#unit test setting
######################################################################
src_dir = lib_env.get('SRC_DIR')
-gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0'
######################################################################
# Build flags
######################################################################
-gtest = File(gtest_dir + '/lib/.libs/libgtest.a')
-gtest_main = File(gtest_dir + '/lib/.libs/libgtest_main.a')
-
rcs_test_env.AppendUnique(
CPPPATH = [
src_dir + '/extlibs/hippomocks-master',
- src_dir + '/extlibs/gtest/gtest-1.7.0/include',
'../include',
'../src/common/utils/include',
])
-if target_os not in ['windows', 'winrt']:
- rcs_test_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
- if target_os != 'android':
- rcs_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
- rcs_test_env.AppendUnique(LIBS = ['pthread'])
+if target_os not in ['windows']:
+ rcs_test_env.AppendUnique(LIBS = ['dl'])
+ rcs_test_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+ if target_os != 'android':
+ rcs_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
+ rcs_test_env.AppendUnique(LIBS = ['pthread'])
rcs_test_env.PrependUnique(LIBS = [
'connectivity_abstraction',
'rcs_client',
'rcs_server',
'rcs_common',
- gtest,
- gtest_main])
-
-rcs_test_env.AppendUnique(LIBS = ['dl'])
+ 'gtest',
+ 'gtest_main'])
######################################################################
# Build Test
######################################################################
-rcs_test_src = env.Glob('./*.cpp')
+rcs_test_src = rcs_test_env.Glob('./*.cpp')
rcs_client_test = rcs_test_env.Program('rcs_client_test', rcs_test_src)
Alias("rcs_client_test", rcs_client_test)
-env.AppendTarget('rcs_client_test')
+rcs_test_env.AppendTarget('rcs_client_test')
-if env.get('TEST') == '1':
- target_os = env.get('TARGET_OS')
- if target_os == 'linux':
+if rcs_test_env.get('TEST') == '1':
+ target_os = rcs_test_env.get('TARGET_OS')
+ if target_os in ['linux']:
from tools.scons.RunTest import *
run_test(rcs_test_env, '', 'service/resource-encapsulation/unittests/rcs_client_test')