[libvirt PATCH 7/7] ci: integration: Bundle only failed Avocado test results

Erik Skultety eskultet at redhat.com
Fri Oct 14 11:28:45 UTC 2022


Latest versions of Avocado create 'by-status' symlink shortcuts to test
results, IOW:

 # this is the main test results directory containing all data
 $ ls <path>/avocado/job-results/latest/test-results/
 01-scripts_networks_050-transient-lifecycle.t
 02-scripts_networks_051-transient-autostart.t
 ...
 22-scripts_networks_400-guest-bandwidth.t
 by_status/

 # list only the failed tests
 $ ls -l <path>/avocado/job-results/latest/test-results/by-status/FAIL
 19-scripts_networks_360-guest-network-vepa.t ->
    <path>/avocado/job-results/latest/test-results/19-scripts_networks_360-guest-network-vepa.t

Therefore, let's bundle only the failed ones, it's going to make the
log artifacts more obvious when looking for libvirt errors.

Signed-off-by: Erik Skultety <eskultet at redhat.com>
---
 ci/integration-template.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ci/integration-template.yml b/ci/integration-template.yml
index 48e71e2dd9..f01de7845d 100644
--- a/ci/integration-template.yml
+++ b/ci/integration-template.yml
@@ -56,10 +56,16 @@
 
 .collect-logs: &collect-logs
   - set +e
+  - shopt -s nullglob
   - mkdir logs
   - test -d "$SCRATCH_DIR"/avocado && mkdir logs/avocado
   - sudo coredumpctl &>/dev/null && sudo coredumpctl info --no-pager > logs/coredumpctl.txt
   - sudo mv /var/log/libvirt logs/libvirt
+  # filter only the failed tests, omitting successful job logs
+  - for test_log in "$SCRATCH_DIR"/avocado/latest/test-results/by-status/{ERROR,FAIL}/*;
+    do
+      sudo mv "$(realpath $test_log)" logs/avocado;
+    done;
   - sudo chown -R $(whoami):$(whoami) logs
     # rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type
   - find logs/avocado/ -type f ! -name "*.log" -exec
-- 
2.37.3



More information about the libvir-list mailing list