From f413bef1358e014c9a6cb75bd2ec3e1f351e64ff Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Tue, 15 Aug 2017 07:09:02 +0200 Subject: make test: collect symlinks to failed tests Compress files in temporary directories of failed tests and symlink the directories under /tmp/vpp-failed-unittests location - preparation for jenkins archivation. Automatically cleanup the directory at start of test run. The compression is performed only when environment variable COMPRESS_FAILED_TEST_LOGS is set to one of "yes", "y", "1". This is set in verify target, but left unset by default, so when invoking make test by hand, files won't be compressed. Change-Id: I84c8f1c6aa79aa9c0b753357022b1f195f17a283 Signed-off-by: Klement Sekera --- test/scripts/compress_failed.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 test/scripts/compress_failed.sh (limited to 'test/scripts/compress_failed.sh') diff --git a/test/scripts/compress_failed.sh b/test/scripts/compress_failed.sh new file mode 100755 index 00000000..6076b3b3 --- /dev/null +++ b/test/scripts/compress_failed.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ "$(ls -A ${VPP_TEST_FAILED_DIR})" ] +then + if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" ] + then + echo -n "Compressing files in temporary directories from failed test runs..." + cd ${VPP_TEST_FAILED_DIR} + for d in * + do + cd ${d} + find . ! -path . -print0 | xargs -0 -n1 gzip + cd ${VPP_TEST_FAILED_DIR} + done + echo "done." + else + echo "Not compressing files in temporary directories from failed test runs." + fi +else + echo "No symlinks to failed tests' temporary directories found in ${VPP_TEST_FAILED_DIR}." +fi -- cgit 1.2.3-korg From e691345d7a888ad57848c86b86211192e07d5de7 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Sat, 30 Sep 2017 01:53:26 -0400 Subject: make test: archive failed test data with build logs. (VPP-1011) - Fix invocation of compress_failed.sh - Fix compress_failed to copy compressed results files to $WORKSPACE/archives and return failure exit code. Failed test case data will be copied to logs.fd.io and found in the archives/-FAILED directory in the build log link in the vpp-verify-master-ubuntu1604 jenkins job page. For example: https://logs.fd.io/production/vex-yul-rot-jenkins-1/vpp-verify-master-ubuntu1604/7353/archives/ Change-Id: Ife9a0737115e69c0a8441e3bb0133af1528d909b Signed-off-by: Dave Wallace (cherry picked from commit 25dc16715ee3fc0a600e2f58841173249bfae501) --- test/Makefile | 3 +-- test/scripts/compress_failed.sh | 46 +++++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 17 deletions(-) (limited to 'test/scripts/compress_failed.sh') diff --git a/test/Makefile b/test/Makefile index 721ec963..da77accc 100644 --- a/test/Makefile +++ b/test/Makefile @@ -86,8 +86,7 @@ $(PAPI_INSTALL_DONE): $(PIP_PATCH_DONE) @touch $@ define retest-func - @env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) scripts/setsid_wrapper.sh $(FORCE_FOREGROUND) $(PYTHON_VENV_PATH)/bin/activate python run_tests.py -d $(TEST_DIR) $(UNITTEST_EXTRA_OPTS) - @env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) scripts/compress_failed.sh + @env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) scripts/setsid_wrapper.sh $(FORCE_FOREGROUND) $(PYTHON_VENV_PATH)/bin/activate python run_tests.py -d $(TEST_DIR) $(UNITTEST_EXTRA_OPTS) || env VPP_TEST_FAILED_DIR=$(VPP_TEST_FAILED_DIR) COMPRESS_FAILED_TEST_LOGS=$(COMPRESS_FAILED_TEST_LOGS) scripts/compress_failed.sh endef .PHONY: sanity diff --git a/test/scripts/compress_failed.sh b/test/scripts/compress_failed.sh index 6076b3b3..9559e2ac 100755 --- a/test/scripts/compress_failed.sh +++ b/test/scripts/compress_failed.sh @@ -2,20 +2,36 @@ if [ "$(ls -A ${VPP_TEST_FAILED_DIR})" ] then - if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" ] - then - echo -n "Compressing files in temporary directories from failed test runs..." - cd ${VPP_TEST_FAILED_DIR} - for d in * - do - cd ${d} - find . ! -path . -print0 | xargs -0 -n1 gzip - cd ${VPP_TEST_FAILED_DIR} - done - echo "done." - else - echo "Not compressing files in temporary directories from failed test runs." - fi + if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" ] + then + echo -n "Compressing files in temporary directories from failed test runs... " + cd ${VPP_TEST_FAILED_DIR} + for d in * + do + cd ${d} + find . ! -path . -print0 | xargs -0 -n1 gzip + cd ${VPP_TEST_FAILED_DIR} + done + echo "done." + if [ -n "$WORKSPACE" ] + then + echo "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... " + for failed_test in $(ls $VPP_TEST_FAILED_DIR) + do + mkdir -p $WORKSPACE/archives/$failed_test + cp -a $VPP_TEST_FAILED_DIR/$failed_test/* $WORKSPACE/archives/$failed_test + done + echo "done." + fi + + else + echo "Not compressing files in temporary directories from failed test runs." + fi else - echo "No symlinks to failed tests' temporary directories found in ${VPP_TEST_FAILED_DIR}." + echo "No symlinks to failed tests' temporary directories found in ${VPP_TEST_FAILED_DIR}." fi + +# This script gets run only if there was a 'make test' failure, +# so return failure error status so that the build results are +# recorded correctly. +exit 1 -- cgit 1.2.3-korg