131 lines
3.4 KiB
Bash
131 lines
3.4 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
HASHES=$( ls | awk -F\. '{print $4}' | sort -u )
|
||
|
ARCHES=$( ls *log | awk -F- '{print $(NF-1) }' | awk -F. '{print $NF}' | sort -u )
|
||
|
|
||
|
declare -A MAXTESTS
|
||
|
|
||
|
for p in $HASHES; do
|
||
|
MAXTESTS[$p]=0
|
||
|
for a in $ARCHES; do
|
||
|
c=$( ls *log | grep $p | grep $a | wc -l )
|
||
|
test $c -gt ${MAXTESTS[$p]} && MAXTESTS[$p]=$c
|
||
|
done
|
||
|
done
|
||
|
|
||
|
TESTCASES=$( cat *log | awk '/^Running\ \.\/systemtap/ {print $2}' | sort -u )
|
||
|
|
||
|
TEMPFILE=$( mktemp )
|
||
|
|
||
|
function getCaseResults() {
|
||
|
casename=$1
|
||
|
logfile=$2
|
||
|
casename=$( echo $casename | tr "/" "." )
|
||
|
cmd="cat $logfile | sed -e '/$casename/,/^Running/ !d'"
|
||
|
eval "$cmd" | head -n -1
|
||
|
}
|
||
|
|
||
|
function getWorstResult() {
|
||
|
results="$1"
|
||
|
retval='UNKNOWN'
|
||
|
echo "$results" | grep -q '^PASS' && retval='PASS'
|
||
|
echo "$results" | grep -q '^KPASS' && retval='KPASS'
|
||
|
echo "$results" | grep -q '^XPASS' && retval='XPASS'
|
||
|
echo "$results" | grep -q '^UNTESTED' && retval='UNTESTED'
|
||
|
echo "$results" | grep -q '^KFAIL' && retval='KFAIL'
|
||
|
echo "$results" | grep -q '^XFAIL' && retval='XFAIL'
|
||
|
echo "$results" | grep -q '^FAIL' && retval='FAIL'
|
||
|
echo "$results" | grep -q '^ERROR' && retval='ERROR'
|
||
|
echo $retval
|
||
|
}
|
||
|
|
||
|
function getResult() {
|
||
|
casename=$1
|
||
|
logfile=$2
|
||
|
worstResult=$( getWorstResult "$( getCaseResults "$casename" "$logfile" )" )
|
||
|
if test -s $logfile; then
|
||
|
loglink="http://nfs.englab.brq.redhat.com/scratch/mcermak/testlogs/out/$( echo $logfile | sed 's/log/tar\.xz/' )"
|
||
|
echo "[[$loglink|$worstResult]]"
|
||
|
else
|
||
|
echo $worstResult
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function getLogs() {
|
||
|
package=$1
|
||
|
arch=$2
|
||
|
logcnt=$3
|
||
|
availogcont=$( ls *log | grep $package | grep $arch | wc -l )
|
||
|
remainlogcnt=$(( $logcnt - $availogcont ))
|
||
|
logs=$( ls *log | grep $package | grep $arch )
|
||
|
for i in $( seq 1 $remainlogcnt ); do
|
||
|
logs="$logs $TEMPFILE"
|
||
|
done
|
||
|
echo $logs
|
||
|
}
|
||
|
|
||
|
function colorizeResult() {
|
||
|
result=$1
|
||
|
if echo $result | egrep -q '(KFAIL|XFAIL)'; then
|
||
|
echo "<#a2eea2> $result"
|
||
|
elif echo $result | egrep -q '(FAIL|ERROR)'; then
|
||
|
echo "<#f30000> $result"
|
||
|
elif echo $result | egrep -q '(UNKNOWN)'; then
|
||
|
echo "<#ffffff> $result"
|
||
|
else
|
||
|
echo "<#a2eea2> $result"
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function getResultSet() {
|
||
|
package=$1
|
||
|
arch=$2
|
||
|
testcase=$3
|
||
|
#echo -n "|| $package ($arch) "
|
||
|
echo -n "|| '''$arch''' "
|
||
|
for logfile in $( getLogs "$package" "$arch" ${MAXTESTS[$package]} ); do
|
||
|
result=$( getResult "$testcase" "$logfile" )
|
||
|
echo -n "||$( colorizeResult "$result" ) "
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function getBugsForTestcase() {
|
||
|
testcase=$1
|
||
|
testcase=$( echo $testcase | sed 's/^\.\///' | tr "/" "." )
|
||
|
cmd="awk '/$testcase/ {print \$2}' bugs.txt"
|
||
|
eval "$cmd"
|
||
|
}
|
||
|
|
||
|
function getBugLinksForTestcase() {
|
||
|
bznos="$1"
|
||
|
if ! test -z "$bznos"; then
|
||
|
echo
|
||
|
for bzno in $bznos; do
|
||
|
echo -e "[[https://bugzilla.redhat.com/show_bug.cgi?id=$bzno|bz$bzno]]"
|
||
|
done
|
||
|
echo
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
echo -n "== "
|
||
|
first=1
|
||
|
for package in $HASHES; do
|
||
|
test $first -eq 0 && echo -n "<-> "
|
||
|
echo -n "$package "
|
||
|
first=0
|
||
|
done
|
||
|
echo " =="
|
||
|
|
||
|
for testcase in $TESTCASES; do
|
||
|
echo -e "\n=== $testcase ===\n"
|
||
|
getBugLinksForTestcase "$( getBugsForTestcase "$testcase" )"
|
||
|
for arch in $ARCHES; do
|
||
|
for __hash in $HASHES; do
|
||
|
getResultSet $__hash $arch $testcase
|
||
|
done
|
||
|
echo " ||"
|
||
|
done
|
||
|
done
|
||
|
|
||
|
|