Commit a3ac1dbd authored by Robert Schmidt's avatar Robert Schmidt Committed by Jaroslava Fiedlerova

analyze-timing.sh: check only last measurement occurrence

For some physical simulators, we have multiple SNR iterations.

The previous version of the script correctly retained only the last
measurement, but if a previous measurement condition set RC=1, the
script would fail although the final "good" run might fulfil the
measurement condition (IOW, it would show SUCCESS, but still fail on the
check).

Instead, check if all measurement lines finish on SUCCESS, which handles
the above case.
parent b012700f
...@@ -6,12 +6,9 @@ ...@@ -6,12 +6,9 @@
function die() { echo $@ 1>&2; exit 1; } function die() { echo $@ 1>&2; exit 1; }
# RC will be the return code. If any rule fails, it will set RC=1, which will # Print every line, because the logs are piped into this script, but a user is
# make the script fail. Print also every line, because the logs are piped into # typically also interested into the raw logs.
# this script, but a user is typically also interested into the raw logs.
SCRIPT=' SCRIPT='
BEGIN { RC = 0; }
{ print $0 } { print $0 }
' '
...@@ -24,9 +21,9 @@ while [ $# -gt 0 ]; do ...@@ -24,9 +21,9 @@ while [ $# -gt 0 ]; do
shift 2 shift 2
# Add a rule that searches for a PATTERN + number, and checks against # Add a rule that searches for a PATTERN + number, and checks against
# CONDition. If the condition does not hold, it is counted as a failure (sets # CONDition. If the condition does not hold, it is counted as a failure. In
# RC to signal error). In both cases, the result is logged in an array to # both cases, the result is logged in an array to output at the end of the
# output at the end of the script. # script.
# #
# To search for the number, first substr() returns what has been matched # To search for the number, first substr() returns what has been matched
# (PATTERN + number), and sub() deletes PATTERN and whitespace, resulting in # (PATTERN + number), and sub() deletes PATTERN and whitespace, resulting in
...@@ -49,7 +46,6 @@ while [ $# -gt 0 ]; do ...@@ -49,7 +46,6 @@ while [ $# -gt 0 ]; do
r = "SUCCESS"; r = "SUCCESS";
} else { } else {
r = "FAIL"; r = "FAIL";
RC = 1;
} }
RESULTS['${NUM}']=sprintf("CHECK %-35s %7.2f %-8s %s", "'${PATTERN}'", meas, " '${COND}'", r); RESULTS['${NUM}']=sprintf("CHECK %-35s %7.2f %-8s %s", "'${PATTERN}'", meas, " '${COND}'", r);
} }
...@@ -63,7 +59,6 @@ while [ $# -gt 0 ]; do ...@@ -63,7 +59,6 @@ while [ $# -gt 0 ]; do
END { END {
if (!RESULTS['${NUM}']) { if (!RESULTS['${NUM}']) {
RESULTS['${NUM}']=sprintf("CHECK %-35s %-7s NOTFOUND", "'${PATTERN}'", "'${COND}'"); RESULTS['${NUM}']=sprintf("CHECK %-35s %-7s NOTFOUND", "'${PATTERN}'", "'${COND}'");
RC = 1;
} }
} }
' '
...@@ -75,8 +70,11 @@ done ...@@ -75,8 +70,11 @@ done
# (0 on success, i.e..all conditions checked, otherwise 1 on failure). # (0 on success, i.e..all conditions checked, otherwise 1 on failure).
SCRIPT+=' SCRIPT+='
END { END {
RC = 0;
for (i = 0; i < '${NUM}'; ++i) { for (i = 0; i < '${NUM}'; ++i) {
print RESULTS[i] print RESULTS[i]
if (!(RESULTS[i] ~ /SUCCESS$/))
RC = 1;
} }
exit RC exit RC
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment