Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctest timings #54

Merged
merged 3 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions configuration/scripts/tests/CTest/parse_timings.csh
Original file line number Diff line number Diff line change
@@ -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 '(?<=<FullName>\.\/).*?(?=</FullName>)'`
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/^\(.*<Value>\)${local_runtime}\(<\/Value>\)/\1${runtime}<\/Value>/"`
set save_time=0
endif
echo "$line" >> $outfile
end

mv $testfile ${testfile}.bak
mv $outfile $testfile
9 changes: 9 additions & 0 deletions configuration/scripts/tests/CTest/run_ctest.csh
Original file line number Diff line number Diff line change
Expand Up @@ -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[*] )

Expand Down
3 changes: 2 additions & 1 deletion configuration/scripts/tests/CTest/steer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions create.case
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down