From 40f145fa90f6b1f6a1998a528f47cfce1a77203d Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Tue, 26 Nov 2013 19:11:52 +0000 Subject: jtreg: add failed results as discrete attachments For each test that fails add the corresponding .jtr (jtreg result) for easier observation from the LAVA dashboard. Also attach a zip of the JTwork and JTreport directory sans the class files. This zip is now attached directly to the overall LAVA test using lava-test-run-attach. The overall execution is now run using jtreg and the results are then parsed and analysed for success/fail. Signed-off-by: Andrew McDermott Change-Id: Id5e918e196892e6935b3361f822f6f129f59772c --- openembedded/scripts/jtreg-test | 59 +++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 17 deletions(-) (limited to 'openembedded/scripts') diff --git a/openembedded/scripts/jtreg-test b/openembedded/scripts/jtreg-test index 7f3b82b..261e1fa 100755 --- a/openembedded/scripts/jtreg-test +++ b/openembedded/scripts/jtreg-test @@ -58,14 +58,13 @@ shift $((OPTIND-1)) output_dir=/tmp/jtreg/$test_case.$$ rm -rf $output_dir -lava-test-case $test_case --shell \ - jtreg \ - -J${java_vm} \ - -vmoption:${java_vm} \ - -jdk:"${product_home}" \ - -w:$output_dir/JTwork \ - -r:$output_dir/JTreport \ - "$@" +jtreg \ + -J${java_vm} \ + -vmoption:${java_vm} \ + -jdk:"${product_home}" \ + -w:$output_dir/JTwork \ + -r:$output_dir/JTreport \ + "$@" exit_code=$? @@ -75,26 +74,52 @@ shopt -s nullglob # By pushd'ing we make the attached filenames in the LAVA dashboard # much smaller. +mkdir -p $output_dir/JTwork/failed + if [ -d $output_dir/JTreport/text ]; then pushd $output_dir/JTreport/text for i in *.txt; do + lava-test-run-attach $i if [ $i = "summary.txt" ]; then grep 'Failed\.' $i > failed.txt - lava-test-case-attach $test_case failed.txt grep 'Passed\.' $i > success.txt - lava-test-case-attach $test_case success.txt - sed -i '/Not run\./d' $i + lava-test-run-attach failed.txt + lava-test-run-attach success.txt + while read -r line; do + tc=$(echo $line | awk '{print $1}') + y=$(dirname $tc) + z=$(basename $tc .java) + lava-test-case $z --result pass + echo "JTREG-SUCCESS $z" + done < success.txt + while read -r line; do + tc=$(echo $line | awk '{print $1}') + y=$(dirname $tc) + z=$(basename $tc .java) + test_result=$output_dir/JTwork/$y/${z}.jtr + if [ -e $test_result ]; then + pushd $output_dir/JTwork + mkdir -p failed-results/$y + cp $test_result failed-results/$y/${z}.jtr + pushd failed-results + lava-test-case $z --result fail + lava-test-case-attach $z $y/${z}.jtr text/plain + popd + echo "JTREG-FAIL $z" + popd + fi + done < failed.txt fi - lava-test-case-attach $test_case $i done popd fi -if [ -d $output_dir/JTwork/scratch ]; then - pushd $output_dir/JTwork/scratch - for i in hs*.log; do - lava-test-case-attach $test_case $i text/plain - done +if [ -d $output_dir ]; then + pushd $output_dir + # Remove .class files as they are quite large. + find . -name \*.class -print | xargs rm + zip --quiet -r RESULTS-BUNDLE.zip * + lava-test-run-attach RESULTS-BUNDLE.zip popd fi -- cgit v1.2.3