1#!/usr/bin/env bash 2 3###################################################################### 4# 8) show colored output of results 5###################################################################### 6 7set -eu 8 9# read our defined variables 10source /var/tmp/env.txt 11cd $RESPATH 12 13# helper function for showing some content with headline 14function showfile() { 15 content=$(dd if=$1 bs=1024 count=400k 2>/dev/null) 16 if [ -z "$2" ]; then 17 group1="" 18 group2="" 19 else 20 SIZE=$(stat --printf="%s" "$file") 21 SIZE=$((SIZE/1024)) 22 group1="##[group]$2 ($SIZE KiB)" 23 group2="##[endgroup]" 24 fi 25cat <<EOF > tmp$$ 26$group1 27$content 28$group2 29EOF 30 cat tmp$$ 31 rm -f tmp$$ 32} 33 34# overview 35cat /tmp/summary.txt 36echo "" 37 38if [ -f /tmp/have_failed_tests -a -s /tmp/failed.txt ]; then 39 echo "Debuginfo of failed tests:" 40 cat /tmp/failed.txt 41 echo "" 42 cat /tmp/summary.txt | grep -v '^/' 43 echo "" 44fi 45 46echo -e "\nFull logs for download:\n $1\n" 47 48for i in $(seq 1 $VMs); do 49 rv=$(cat vm$i/tests-exitcode.txt) 50 51 if [ $rv = 0 ]; then 52 vm="[92mvm$i[0m" 53 else 54 vm="[1;91mvm$i[0m" 55 fi 56 57 file="vm$i/dmesg-prerun.txt" 58 test -s "$file" && showfile "$file" "$vm: dmesg kernel" 59 60 file="/tmp/vm${i}log.txt" 61 test -s "$file" && showfile "$file" "$vm: test results" 62 63 file="vm$i/console.txt" 64 test -s "$file" && showfile "$file" "$vm: serial console" 65 66 file="/tmp/vm${i}dbg.txt" 67 test -s "$file" && showfile "$file" "$vm: failure logfile" 68done 69 70test -f /tmp/have_failed_tests && exit 1 71exit 0 72