Skip to content

Commit

Permalink
update test reporting (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
apcraig authored Apr 10, 2020
1 parent 9305c64 commit 6757006
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 36 deletions.
7 changes: 7 additions & 0 deletions configuration/scripts/icepack.test.setup.csh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ if ( ! -f ${ICE_RUNDIR}/icepack ) then
exit 99
endif
# Initial test results and Reset test results for rerun
mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev
echo "#---" >! ${ICE_CASEDIR}/test_output
cat ${ICE_CASEDIR}/test_output.prev | grep -i "${ICE_TESTNAME} build" >> ${ICE_CASEDIR}/test_output
echo "PEND ${ICE_TESTNAME} run" >> ${ICE_CASEDIR}/test_output
rm -f ${ICE_CASEDIR}/test_output.prev
EOF2

if ( -f ${ICE_SCRIPTS}/tests/test_${ICE_TEST}.script) then
Expand Down
38 changes: 30 additions & 8 deletions configuration/scripts/tests/report_results.csh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/bin/csh -f

if ($#argv == 0) then
echo "${0}: Running results.csh"
./results.csh >& /dev/null
else if ($#argv == 1) then
if ("$argv[1]" =~ "-n") then
#continue
else
echo "$0 usage:"
echo "$0 [-n]"
echo " -n : do NOT run results.csh (by default it does)"
exit -1
endif
endif

if (! -e results.log) then
echo " "
echo "${0}: ERROR results.log does not exist, try running results.csh"
Expand Down Expand Up @@ -79,13 +93,21 @@ unset noglob

foreach compiler ( ${compilers} )

set ofile = "${shhash}.${mach}.${compiler}.${xcdat}.${xctim}"
set outfile = "${wikiname}/${tsubdir}/${ofile}.md"
set cnt = 0
set found = 1
while ($found == 1)
set ofile = "${shhash}.${mach}.${compiler}.${xcdat}.${xctim}.$cnt"
set outfile = "${wikiname}/${tsubdir}/${ofile}.md"
if (-e ${outfile}) then
@ cnt = $cnt + 1
else
set found = 0
endif
end

mkdir -p ${wikiname}/${tsubdir}
echo "${0}: writing to ${outfile}"

if (-e ${outfile}) rm -f ${outfile}

cat >! ${outfile} << EOF
|Bld|Run|Test| Regr | Compare | Timing | Case |
Expand All @@ -103,7 +125,7 @@ EOF
foreach case ( ${cases} )
if ( ${case} =~ *_${compiler}_* ) then

# check thata case results are meaningful
# check that case results are meaningful
set fbuild = `grep " ${case} " results.log | grep " build" | cut -c 1-4`
set frun = `grep " ${case} " results.log | grep " run" | cut -c 1-4`
set ftest = `grep " ${case} " results.log | grep " test" | cut -c 1-4`
Expand All @@ -115,8 +137,8 @@ if ( $fbuild != "" || $frun != "" || $ftest != "" ) then
set ftest = `grep " ${case} " results.log | grep " test" | cut -c 1-4`
set fregr = `grep " ${case} " results.log | grep " compare" | cut -c 1-4`
set fcomp = `grep " ${case} bfbcomp " results.log | cut -c 1-4`
if (${ftest} == "PASS") set frun = "PASS"
if (${frun} == "PASS") set fbuild = "PASS"
# if (${ftest} == "PASS") set frun = "PASS"
# if (${frun} == "PASS") set fbuild = "PASS"

set vregr = `grep " ${case} " results.log | grep " compare" | cut -d " " -f 4 | sed 's/\./ /g' `
set vcomp = `grep " ${case} bfbcomp " results.log | cut -d " " -f 4`
Expand Down Expand Up @@ -145,7 +167,7 @@ if ( $fbuild != "" || $frun != "" || $ftest != "" ) then
if (${fregr} == "FAIL") set rregr = ${red}
if (${fcomp} == "FAIL") set rcomp = ${red}

if (${fbuild} == "") set rbuild = ${red}
if (${fbuild} == "") set rbuild = ${gray}
if (${frun} == "") set rrun = ${red}
if (${ftest} == "") set rtest = ${red}
if (${fregr} == "") set rregr = ${gray}
Expand Down
8 changes: 0 additions & 8 deletions configuration/scripts/tests/test_restart.script
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ cp icepack_in icepack_in.0
${ICE_CASEDIR}/casescripts/parse_namelist.sh icepack_in ${ICE_CASEDIR}/casescripts/test_nml.restart1
cp icepack_in icepack_in.1

mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev
cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} run" >! ${ICE_CASEDIR}/test_output
mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev
cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} test" >! ${ICE_CASEDIR}/test_output
rm -f ${ICE_CASEDIR}/test_output.prev
echo "RUN ${ICE_TESTNAME} run " >> ${ICE_CASEDIR}/test_output
echo "PEND ${ICE_TESTNAME} test " >> ${ICE_CASEDIR}/test_output

./icepack.run
set res="$?"

Expand Down
5 changes: 0 additions & 5 deletions configuration/scripts/tests/test_smoke.script
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
# Run the ICEPACK model
# icepack.run returns -1 if run did not complete successfully

mv -f ${ICE_CASEDIR}/test_output ${ICE_CASEDIR}/test_output.prev
cat ${ICE_CASEDIR}/test_output.prev | grep -iv "${ICE_TESTNAME} run" >! ${ICE_CASEDIR}/test_output
rm -f ${ICE_CASEDIR}/test_output.prev
echo "RUN ${ICE_TESTNAME} run " >> ${ICE_CASEDIR}/test_output

./icepack.run
set res="$?"

Expand Down
6 changes: 5 additions & 1 deletion doc/source/user_guide/ug_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ To post results, once a test suite is complete, run ``results.csh`` and
./results.csh
./report_results.csh

The reporting can also be automated by adding ``--report``
``report_results.csh`` will run ``results.csh`` by default automatically, but
we recommmend running it manually first to verify results before publishing
them. ``report_results.csh -n`` will turn off automatic running of ``results.csh``.

The reporting can also be automated in a test suite by adding ``--report`` to ``icepack.setup``
::

./icepack.setup --suite base_suite --mach conrad --env cray --testid v01a --report
Expand Down
55 changes: 41 additions & 14 deletions icepack.setup
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,6 @@ EOF2
exit -1
endif
# Initial test_output file
echo "#---" >! test_output
echo "PEND ${testname_noid} " >> test_output
endif
#------------------------------------------------------------
Expand Down Expand Up @@ -837,24 +833,55 @@ if ( ${dosuite} == 1 ) then
# Add code to results.csh to count the number of failures
cat >> ${tsdir}/results.csh << EOF
cat ./results.log
set pends = \`cat ./results.log | grep PEND | wc -l\`
set failures = \`cat ./results.log | grep FAIL | wc -l\`
set success = \`cat ./results.log | grep PASS | wc -l\`
set comments = \`cat ./results.log | grep "#" | wc -l\`
set alltotal = \`cat ./results.log | wc -l\`
set pends = \`cat ./results.log | grep PEND | wc -l\`
set misses = \`cat ./results.log | grep MISS | wc -l\`
set failures = \`cat ./results.log | grep FAIL | wc -l\`
set failbuild = \`cat ./results.log | grep FAIL | grep " build " | wc -l\`
set failrun = \`cat ./results.log | grep FAIL | grep " run " | wc -l\`
set failtest = \`cat ./results.log | grep FAIL | grep " test " | wc -l\`
set failcomp = \`cat ./results.log | grep FAIL | grep " compare " | wc -l\`
set failbfbc = \`cat ./results.log | grep FAIL | grep " bfbcomp " | wc -l\`
set failgen = \`cat ./results.log | grep FAIL | grep " generate " | wc -l\`
set success = \`cat ./results.log | grep 'PASS\|COPY' | wc -l\`
set comments = \`cat ./results.log | grep "#" | wc -l\`
set alltotal = \`cat ./results.log | wc -l\`
@ total = \$alltotal - \$comments
@ chkcnt = \$pends + \$misses + \$failures + \$success
echo "#------- " >> results.log
echo " " >> results.log
echo "#totl = \$total" >> results.log
echo "#totl = \$total total" >> results.log
echo "#chkd = \$chkcnt checked" >> results.log
echo "#pass = \$success" >> results.log
echo "#fail = \$failures" >> results.log
echo "#pend = \$pends" >> results.log
echo "#miss = \$misses" >> results.log
echo "#fail = \$failures" >> results.log
echo " #failbuild = \$failbuild" >> results.log
echo " #failrun = \$failrun" >> results.log
echo " #failtest = \$failtest" >> results.log
echo " #failcomp = \$failcomp" >> results.log
echo " #failbfbc = \$failbfbc" >> results.log
echo " #failgen = \$failgen" >> results.log
echo ""
echo "\$success of \$total tests PASSED"
echo "\$failures of \$total tests FAILED"
echo "\$pends of \$total tests PENDING"
echo "Descriptors:"
echo " PASS - successful completion"
echo " COPY - previously compiled code was copied for new test"
echo " MISS - comparison data is missing"
echo " PEND - status is undertermined; test may still be queued, running, or timed out"
echo " FAIL - test failed"
echo ""
echo "\$chkcnt measured results of \$total total results"
echo "\$success of \$chkcnt tests PASSED"
echo "\$pends of \$chkcnt tests PENDING"
echo "\$misses of \$chkcnt tests MISSING data"
echo "\$failures of \$chkcnt tests FAILED"
#echo " \$failbuild of \$failures FAILED build"
#echo " \$failrun of \$failures FAILED run"
#echo " \$failtest of \$failures FAILED test"
#echo " \$failcomp of \$failures FAILED compare"
#echo " \$failbfbc of \$failures FAILED bfbcomp"
#echo " \$failgen of \$failures FAILED generate"
exit \$failures
EOF
Expand Down

0 comments on commit 6757006

Please sign in to comment.