summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-05-06 19:11:25 +0200
committerDave Barach <openvpp@barachs.net>2019-05-08 22:14:44 +0000
commitf40ee3a206b2abd2ca2b8b94e0d233c2f1ade801 (patch)
treec50d286a56ea3913313c854e6d25f4afb4360b95 /test
parent0e573f56dc4986b2f21ffedddb1c5a2424f88b0d (diff)
make test: introduce COREDUMP_COMPRESS option
setting COREDUMP_COMPRESS=y (or =1) indicates that any core file is to be compressed by the test framework unless DEBUG=core is set. Change-Id: Ib0d6d30a7398dbeb6ab5e5dbb411bf5c641b5206 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/Makefile1
-rw-r--r--test/run_tests.py29
2 files changed, 17 insertions, 13 deletions
diff --git a/test/Makefile b/test/Makefile
index 724b50457aa..a5788223623 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -285,6 +285,7 @@ help:
@echo " COREDUMP_SIZE=<size> - pass <size> as unix { coredump-size <size> } argument to vpp"
@echo " e.g. COREDUMP_SIZE=4g"
@echo " COREDUMP_SIZE=unlimited"
+ @echo " COREDUMP_COMPRESS=1 - compress core files if not debugging them"
@echo " EXTERN_TESTS=<path> - path to out-of-tree test_<name>.py files containing test cases"
@echo " EXTERN_PLUGINS=<path>- path to out-of-tree plugins to be loaded by vpp under test"
@echo " EXTERN_COV_DIR=<path>- path to out-of-tree prefix, where source, object and .gcda files can be found for coverage report"
diff --git a/test/run_tests.py b/test/run_tests.py
index 0c3b3f11299..55b8123756c 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -282,20 +282,23 @@ def handle_failed_suite(logger, last_test_temp_dir, vpp_pid):
def check_and_handle_core(vpp_binary, tempdir, core_crash_test):
if is_core_present(tempdir):
- print('VPP core detected in %s. Last test running was %s' %
- (tempdir, core_crash_test))
- print(single_line_delim)
- spawn_gdb(vpp_binary, get_core_path(tempdir))
- print(single_line_delim)
+ if debug_core:
+ print('VPP core detected in %s. Last test running was %s' %
+ (tempdir, core_crash_test))
+ print(single_line_delim)
+ spawn_gdb(vpp_binary, get_core_path(tempdir))
+ print(single_line_delim)
+ elif compress_core:
+ print("Compressing core-file in test directory `%s'" % tempdir)
+ os.system("gzip %s" % get_core_path(tempdir))
def handle_cores(failed_testcases):
- if debug_core:
- for failed_testcase in failed_testcases:
- tcs_with_core = failed_testcase.testclasess_with_core
- if tcs_with_core:
- for test, vpp_binary, tempdir in tcs_with_core.values():
- check_and_handle_core(vpp_binary, tempdir, test)
+ for failed_testcase in failed_testcases:
+ tcs_with_core = failed_testcase.testclasess_with_core
+ if tcs_with_core:
+ for test, vpp_binary, tempdir in tcs_with_core.values():
+ check_and_handle_core(vpp_binary, tempdir, test)
def process_finished_testsuite(wrapped_testcase_suite,
@@ -726,6 +729,7 @@ if __name__ == '__main__':
debug = os.getenv("DEBUG", "n").lower() in ["gdb", "gdbserver"]
debug_core = os.getenv("DEBUG", "").lower() == "core"
+ compress_core = os.getenv("CORE_COMPRESS", "").lower() in ("y", "yes", "1")
step = os.getenv("STEP", "n").lower() in ("y", "yes", "1")
@@ -813,8 +817,7 @@ if __name__ == '__main__':
handle_failed_suite(test_case_info.logger,
test_case_info.tempdir,
test_case_info.vpp_pid)
- if debug_core and \
- test_case_info in result.core_crash_test_cases_info:
+ if test_case_info in result.core_crash_test_cases_info:
check_and_handle_core(test_case_info.vpp_bin_path,
test_case_info.tempdir,
test_case_info.core_crash_test)