######################################################################
malloctest_env.PrependUnique(CPPPATH = [
'../include',
- '../../../../extlibs/gtest/gtest-1.7.0/include'
- ])
+ '#extlibs/gtest/gtest-1.7.0/include' ])
malloctest_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common')])
malloctest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')
if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
- if not os.path.isdir(result_dir):
- os.makedirs(result_dir)
- malloctest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
- malloctest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- malloctest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- ut = malloctest_env.Command ('ut', None, 'valgrind -q --leak-check=full --xml=yes --xml-file=resource_ccommon_malloc_test.memcheck ' + out_dir + 'resource/c_common/oic_malloc/test/malloctests')
- AlwaysBuild ('ut')
+ from tools.scons.RunTest import *
+ run_test(malloctest_env,
+ 'resource_ccommon_malloc_test.memcheck',
+ 'resource/c_common/oic_malloc/test/malloctests')
######################################################################
stringtest_env.PrependUnique(CPPPATH = [
'../include',
- '../../../../extlibs/gtest/gtest-1.7.0/include'
- ])
+ '#extlibs/gtest/gtest-1.7.0/include' ])
stringtest_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource/c_common')])
stringtest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')
if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
- if not os.path.isdir(result_dir):
- os.makedirs(result_dir)
- stringtest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
- stringtest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- stringtest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- ut = stringtest_env.Command ('ut', None, 'valgrind -q --leak-check=full --xml=yes --xml-file=resource_ccommon_string_test.memcheck ' + out_dir + 'resource/c_common/oic_string/test/stringtests')
- AlwaysBuild ('ut')
+ from tools.scons.RunTest import *
+ run_test(stringtest_env,
+ 'resource_ccommon_string_test.memcheck',
+ 'resource/c_common/oic_string/test/stringtests')
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')
if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
- if not os.path.isdir(result_dir):
- os.makedirs(result_dir)
- catest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
- catest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- catest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- 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')
- AlwaysBuild ('ut')
+ from tools.scons.RunTest import *
+ run_test(catest_env,
+ 'resource_csdk_connectivity_test.memcheck',
+ 'resource/csdk/connectivity/test/catests')
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')
if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
- if not os.path.isdir(result_dir):
- os.makedirs(result_dir)
- randomtest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
- randomtest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- randomtest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- ut = randomtest_env.Command ('ut', None, 'valgrind -q --leak-check=full --xml=yes --xml-file=resource_csdk_random_test.memcheck ' + out_dir + 'resource/csdk/ocrandom/test/randomtests')
- AlwaysBuild ('ut')
+ from tools.scons.RunTest import *
+ run_test(randomtest_env,
+ 'resource_csdk_random_test.memcheck',
+ 'resource/csdk/ocrandom/test/randomtests')
'../../connectivity/external/inc',
'../../extlibs/cjson',
'../../../oc_logger/include',
- '../../../../extlibs/gtest/gtest-1.7.0/include'
+ '#extlibs/gtest/gtest-1.7.0/include'
])
stacktest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')
if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
- if not os.path.isdir(result_dir):
- os.makedirs(result_dir)
- stacktest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
- stacktest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- stacktest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- ut = stacktest_env.Command ('ut', None, 'valgrind -q --leak-check=full --xml=yes --xml-file=resource_csdk_stack_test.memcheck ' + out_dir + 'resource/csdk/stack/test/stacktests')
- AlwaysBuild ('ut')
+ from tools.scons.RunTest import *
+ run_test(stacktest_env,
+ 'resource_csdk_stack_test.memcheck',
+ 'resource/csdk/stack/test/stacktests')
'../csdk/ocsocket/include',
'../csdk/ocrandom/include',
'../csdk/logger/include',
- '../../extlibs/gtest/gtest-1.7.0/include',
- '../../extlibs/hippomocks-master/HippoMocks',
- '../../extlibs/hippomocks-master/HippoMocksTest'
+ '#extlibs/gtest/gtest-1.7.0/include',
+ '#extlibs/hippomocks-master/HippoMocks',
+ '#extlibs/hippomocks-master/HippoMocksTest'
])
unittests_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
if env.get('TEST') == '1':
target_os = env.get('TARGET_OS')
if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
- if not os.path.isdir(result_dir):
- os.makedirs(result_dir)
- unittests_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
- unittests_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- unittests_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- ut = unittests_env.Command ('ut', None,
- [ 'valgrind --leak-check=full --xml=yes --xml-file=resource_unittests_unittests.memcheck ' + out_dir + 'resource/unittests/unittests'])
- AlwaysBuild ('ut')
+ from tools.scons.RunTest import *
+ run_test(unittests_env,
+ 'resource_unittests_unittests.memcheck',
+ 'resource/unittests/unittests')
src_dir = unittests_env.get('SRC_DIR')
-svr_db_src_dir = src_dir + '/resource/examples/'
-svr_db_build_dir = env.get('BUILD_DIR') +'/resource/unittests/'
-unittests_env.Alias("install", unittests_env.Install( svr_db_build_dir,
- svr_db_src_dir + 'oic_svr_db_client.json'))
+svr_db_src_dir = os.path.join(src_dir, 'resource/examples/')
+svr_db_build_dir = os.path.join(env.get('BUILD_DIR'), 'resource/unittests/')
+unittests_env.Alias("install",
+ unittests_env.Install(svr_db_build_dir,
+ os.path.join(svr_db_src_dir,
+ 'oic_svr_db_client.json')))
--- /dev/null
+# ------------------------------------------------------------------------
+# Copyright 2015 Intel Corporation
+#
+# 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.
+# ------------------------------------------------------------------------
+
+__all__ = [ "scons" ]
--- /dev/null
+# ------------------------------------------------------------------------
+# Copyright 2015 Intel Corporation
+#
+# 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 os
+
+def run_test(env, xml_file, test):
+ """
+ Run test with the given SCons Environment, dumping Valgrind
+ results to the given XML file. If no Valgrind run is desired
+ simply pass in an empty string or None for the xml_file
+ parameter.
+
+ Note that the test path should not include the build directory
+ where binaries are placed. The build directory will be prepended
+ to the test path automatically.
+ """
+
+ build_dir = env.get('BUILD_DIR')
+ result_dir = os.path.join(build_dir, 'test_out/')
+ if not os.path.isdir(result_dir):
+ os.makedirs(result_dir)
+
+ # Dump test report in XML format to the results directory.
+ env.AppendENVPath('GTEST_OUTPUT', ['xml:' + result_dir])
+
+ # Make sure the Google Test libraries are in the dynamic
+ # linker/loader path.
+ env.AppendENVPath('LD_LIBRARY_PATH', [build_dir])
+ env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
+
+ test_cmd = os.path.join(build_dir, test)
+
+ if xml_file:
+ # Environment variables to be made available during the
+ # Valgrind run.
+ valgrind_environment = ''
+
+ # Valgrind suppressions file.
+ suppression_file = env.File('#tools/valgrind/iotivity.supp').srcnode().path
+
+ # Set up to run the test under Valgrind.
+ test_cmd = '%s valgrind --leak-check=full --suppressions=%s --xml=yes --xml-file=%s %s' % (valgrind_environment, suppression_file, xml_file, test_cmd)
+
+ ut = env.Command('ut', None, test_cmd)
+ env.AlwaysBuild('ut')
--- /dev/null
+# ------------------------------------------------------------------------
+# Copyright 2015 Intel Corporation
+#
+# 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.
+# ------------------------------------------------------------------------
+
+__all__ = [ "RunTest" ]
--- /dev/null
+# ------------------------------------------------------------------------
+# Copyright 2015 Intel Corporation
+#
+# 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.
+# ------------------------------------------------------------------------
+
+# This file contains Valgrind suppressions. It is meant to make
+# Valgrind ignore memory violations that are out of the control of
+# IoTivity developers. Do NOT abuse this file by adding suppressions
+# for memory violations that can be addressed in IoTivity itself.