From 24cdf47a6a80541448ee919b8dad19fd732a200b Mon Sep 17 00:00:00 2001 From: turner Date: Fri, 15 Dec 2017 14:52:27 -0600 Subject: [PATCH 1/3] Add new code to parse the timings from the log files and put them in Test.xml prior to submitting to CDash. Currently setup to use Timer 2: TimeLoop --- .../scripts/tests/CTest/parse_timings.csh | 46 +++++++++++++++++++ configuration/scripts/tests/CTest/steer.cmake | 3 +- create.case | 1 + 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100755 configuration/scripts/tests/CTest/parse_timings.csh diff --git a/configuration/scripts/tests/CTest/parse_timings.csh b/configuration/scripts/tests/CTest/parse_timings.csh new file mode 100755 index 000000000..f5664d312 --- /dev/null +++ b/configuration/scripts/tests/CTest/parse_timings.csh @@ -0,0 +1,46 @@ +#!/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 ( "$line" =~ *"_run<"* && $save_time == 1) then + set save_time=1 + # Grab the case name + set casename=`echo $line | grep -oP '(?<=\.\/).*?(?=)' | rev | cut -c 5- | rev` + else + set save_time=0 + endif + endif + if ( "$line" =~ *"Execution Time"* && $save_time == 1 ) then + # Find the case runlog + set runlog=`ls ./${casename}.*/logs/*runlog*` + 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/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 From 3156a89b2d94872581540ed261c5f343dd604eea Mon Sep 17 00:00:00 2001 From: turner Date: Fri, 15 Dec 2017 15:19:51 -0600 Subject: [PATCH 2/3] update parse_timings.csh to submit times for run-initial and run-restart tests --- .../scripts/tests/CTest/parse_timings.csh | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/configuration/scripts/tests/CTest/parse_timings.csh b/configuration/scripts/tests/CTest/parse_timings.csh index f5664d312..9532a7dcb 100755 --- a/configuration/scripts/tests/CTest/parse_timings.csh +++ b/configuration/scripts/tests/CTest/parse_timings.csh @@ -17,17 +17,32 @@ foreach line ("`cat $testfile`") endif endif if ( "$line" =~ *"FullName"* ) then - if ( "$line" =~ *"_run<"* && $save_time == 1) then - set save_time=1 + 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 '(?<=\.\/).*?(?=)' | rev | cut -c 5- | rev` + 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 == 1 ) then + if ( "$line" =~ *"Execution Time"* && $save_time > 0 ) then # Find the case runlog - set runlog=`ls ./${casename}.*/logs/*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` From b34e7f87f278f8a9d5b74e7768040ff4c2883e1d Mon Sep 17 00:00:00 2001 From: turner Date: Fri, 22 Dec 2017 11:35:51 -0600 Subject: [PATCH 3/3] Run_ctest.csh now checks to see if no baseline dataset was availble. If baseline datasets are missing, it aborts and does not post anything to CDash --- configuration/scripts/tests/CTest/run_ctest.csh | 9 +++++++++ 1 file changed, 9 insertions(+) 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[*] )