aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/pintos-check-forever
diff options
context:
space:
mode:
authorklaar36 <klas.arvidsson@liu.se>2017-05-19 15:05:06 +0200
committerklaar36 <klas.arvidsson@liu.se>2017-05-19 15:05:06 +0200
commit3b39301d34d7a000325a42bbcfe880b53ac26154 (patch)
tree9f5a239bf47da78358645c2ad1136972121cece7 /src/utils/pintos-check-forever
parent6fea0f8ce4ba0d08a414a1650c829afbef285f70 (diff)
downloadpintos-rs-3b39301d34d7a000325a42bbcfe880b53ac26154.tar.gz
imported misc scripts
Diffstat (limited to 'src/utils/pintos-check-forever')
-rwxr-xr-xsrc/utils/pintos-check-forever79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/utils/pintos-check-forever b/src/utils/pintos-check-forever
new file mode 100755
index 0000000..d8223e2
--- /dev/null
+++ b/src/utils/pintos-check-forever
@@ -0,0 +1,79 @@
+#!/bin/bash
+if [ "$1" = "-h" -o "$1" = "--help" ]; then
+ printf "Usage: $0 [-a]\nRun with -a to abort on first error.\n";
+ exit;
+fi
+
+PWD=`pwd`;
+DIR=`basename $PWD`;
+ABORT_ON_FAIL="false"
+FAIL="true"
+
+for i in $*; do
+ if [ "$i" = "-a" ] ; then
+ ABORT_ON_FAIL="true"
+ fi
+done
+
+if [ "_$DIR" != "_userprog" ] ; then
+ printf "You must be in userprog directory\n";
+ exit;
+fi
+
+if expr $(uname -s) : 'Linux.*' > /dev/null; then
+ MAKE=make
+else
+ MAKE=gmake
+fi
+
+let i=1;
+while (true); do
+
+ printf "Test run %2d started ...\n" $i;
+
+ # Clear previous test results
+ find ./build -name '*.allput' -exec rm {} \; ;
+ find ./build -name '*.output' -exec rm {} \; ;
+ find ./build -name '*.errors' -exec rm {} \; ;
+ find ./build -name '*.result' -exec rm {} \; ;
+
+ # Is it failsafe to run several Pintos concurrently?
+ # YES!! tests use different fs.dsk in /tmp !
+ FAIL="false"
+ if ! nice -n 20 ${MAKE} -j8 check > check.tmp 2> check.err ; then
+ cat check.err
+ printf "ERROR: '${MAKE} check' failed.\n"
+ FAIL="true"
+ fi
+
+ if grep FAIL check.tmp ; then
+ FAIL="true"
+ printf "ERROR: 'grep found FAIL in result file'\n"
+ printf "ERROR: 'saving result files...'\n"
+
+ for test in $(grep '^FAIL tests/.*$' check.tmp | sort | uniq | cut -d' ' -f2 ) ; do
+ printf "mv -f build/${test}.allput build/${test}.allput.${i}\n"
+ mv -f build/${test}.allput build/${test}.allput.${i}
+ mv -f build/${test}.output build/${test}.output.${i}
+ mv -f build/${test}.errors build/${test}.errors.${i}
+ mv -f build/${test}.result build/${test}.result.${i}
+ done
+ fi
+
+ printf "Test run %2d DONE.\n" $i;
+
+ if [ "$FAIL" == "true" ] && [ "$ABORT_ON_FAIL" = "true" ] ; then
+ break;
+ fi
+ let ++i;
+done
+
+printf "Completed $i test runs.\n";
+printf "The result of last run is in 'check.tmp'\n";
+printf "The result of failed runs is in respective test result files.\n";
+
+printf "Consider erasing old test failures:\n";
+printf "find ./build -name '*.allput.*' -exec rm {} \;\n"
+printf "find ./build -name '*.output.*' -exec rm {} \;\n"
+printf "find ./build -name '*.errors.*' -exec rm {} \;\n"
+printf "find ./build -name '*.result.*' -exec rm {} \;\n"