From: Klement Sekera Date: Mon, 6 May 2019 17:11:25 +0000 (+0200) Subject: make test: introduce COREDUMP_COMPRESS option X-Git-Tag: v20.01-rc0~657 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F19382%2F2;p=vpp.git 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 --- 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= - pass as unix { coredump-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 to out-of-tree test_.py files containing test cases" @echo " EXTERN_PLUGINS=- path to out-of-tree plugins to be loaded by vpp under test" @echo " EXTERN_COV_DIR=- 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)