[test-suite] RunSafely.sh adds an exit code to stdout

I’m curious to know the reasoning why RunSafely.sh adds “exit $exitval” to the end of the standard output capture ($OUTFILE) instead of creating another file that is just the exit value of the program:

echo “$exitval” > $OUTFILE.exitval

I’ve encountered two scenarios where this method has complicated things.

First, a co-worker and I were trying to compare SPEC runs in test-suite to SPEC runs executed outside of test. Patching SPEC to add “exit 0” to output is a no-no and post-processing the output files is a bit hackish.

Second, we have a couple of tests failing here that convert their output to an MD5 sum for comparisons. We have to add the “exit 0” to the output of manual execution runs before generating the MD5 to match.

Finally, any code or program that greps for "^exit " to locate the exit code in a *.out file might run into false positives if the literal word “exit” is generated by the test itself.

All in all I’d prefer these two pieces of data to be stored separately. It’d make it easier to write scripts/tools to first check for an exit code and if it’s 0 then process the output file.

Outside of test-suite i have no idea what programs or tools expect “exit” to be in *.out files of a test.