diff --git a/configuration/scripts/tests/CTest/parse_timings.csh b/configuration/scripts/tests/CTest/parse_timings.csh new file mode 100755 index 000000000..9532a7dcb --- /dev/null +++ b/configuration/scripts/tests/CTest/parse_timings.csh @@ -0,0 +1,61 @@ +#!/bin/csh -f + +# This script parses the timings from the tests in the test suite and writes them to the CTest +# Test.xml file prior to submitting to CDash. + +# Loop through each line of the Test.xml file +set CTEST_TAG="`head -n 1 Testing/TAG`" +set testfile="`ls Testing/${CTEST_TAG}/Test.xml`" +set outfile="Testing/${CTEST_TAG}/Test.xml.generated" +set save_time=0 +foreach line ("`cat $testfile`") + if ( "$line" =~ *"Test Status"* ) then + if ( "$line" =~ *"passed"* ) then + set save_time=1 + else + set save_time=0 + endif + endif + if ( "$line" =~ *"FullName"* ) then + if ( $save_time == 1 ) then + if ( "$line" =~ *"_run<"* ) then + set save_time=1 + else if ("$line" =~ *"_run-initial<"*) then + set save_time=2 + else if ("$line" =~ *"run-restart"*) then + set save_time=3 + else + set save_time=0 + endif + # Grab the case name + set casename=`echo $line | grep -oP '(?<=\.\/).*?(?=)'` + set casename=`echo $casename | sed 's/_run\>\|_run-initial\>\|_run-restart\>//'` + else + set save_time=0 + endif + endif + if ( "$line" =~ *"Execution Time"* && $save_time > 0 ) then + # Find the case runlog + #set runlog=`ls ./${casename}.*/logs/*runlog*` + foreach file (`ls ./${casename}.*/logs/*runlog*`) + set runlog="$file" + if ( $save_time == 2 ) then + break + endif + end + foreach line1 ("`cat $runlog`") + if ( "$line1" =~ *"Timer 2:"*) then + set runtime=`echo $line1 | grep -oP "\d+\.(\d+)?" | sort -n | tail -1` + endif + end + set local_runtime=`echo $line | grep -oP "\d+\.(\d+)?" | sort -n | tail -1` + # Grab the leading whitespace + # Replace the timing in Test.xml with the timing from the runlog file + set line=`echo "$line" | sed "s/^\(.*\)${local_runtime}\(<\/Value>\)/\1${runtime}<\/Value>/"` + set save_time=0 + endif + echo "$line" >> $outfile +end + +mv $testfile ${testfile}.bak +mv $outfile $testfile diff --git a/configuration/scripts/tests/CTest/run_ctest.csh b/configuration/scripts/tests/CTest/run_ctest.csh index 69b334f97..425665683 100755 --- a/configuration/scripts/tests/CTest/run_ctest.csh +++ b/configuration/scripts/tests/CTest/run_ctest.csh @@ -5,6 +5,15 @@ set initargv = ( $argv[*] ) set dash = "-" set submit_only=0 +# Check if any of the results could not find the baseline dataset +grep --quiet 'baseline-does-not-exist' results.log +if ($status == 0) then + echo "Tests were not able to find the baseline datasets. No results" + echo "will be posted to CDash" + grep 'baseline-does-not-exist' results.log + exit -1 +endif + # Read in command line arguments set argv = ( $initargv[*] ) diff --git a/configuration/scripts/tests/CTest/steer.cmake b/configuration/scripts/tests/CTest/steer.cmake index 7c9a8dca2..ddeb9bedf 100644 --- a/configuration/scripts/tests/CTest/steer.cmake +++ b/configuration/scripts/tests/CTest/steer.cmake @@ -38,5 +38,6 @@ message("source directory = ${CTEST_SOURCE_DIRECTORY}") ctest_start(${MODEL} TRACK ${MODEL}) ctest_test( BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) - +message("Parsing timings into Test.xml") +execute_process(COMMAND "./parse_timings.csh") ctest_submit( RETURN_VALUE res) diff --git a/create.case b/create.case index d176aabbc..7cf44e865 100755 --- a/create.case +++ b/create.case @@ -231,6 +231,7 @@ if ( $testsuite != $spval ) then cp -f ${ICE_SCRIPTS}/tests/CTest/CTestTestfile.cmake ./${tsdir} cp -f ${ICE_SCRIPTS}/tests/CTest/steer.cmake ./${tsdir} cp -f ${ICE_SCRIPTS}/tests/CTest/run_ctest.csh ./${tsdir} + cp -f ${ICE_SCRIPTS}/tests/CTest/parse_timings.csh ./${tsdir} endif cat >! ./${tsdir}/suite.run << EOF0