~ salmonella-environment-setup (master) c2fc58a60fb16578d23e7a1d15b5777a5de9d0d2


commit c2fc58a60fb16578d23e7a1d15b5777a5de9d0d2
Author:     Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Sun Dec 24 19:16:08 2017 +0100
Commit:     Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Sun Dec 24 19:16:08 2017 +0100

    salmonella: add hunt-async-io-tests.sh
    
    Script for linux to detect when async-io's test is hanging and kill
    it.

diff --git a/scripts/linux/hunt-async-io-tests.sh b/scripts/linux/hunt-async-io-tests.sh
new file mode 100644
index 0000000..3fd9891
--- /dev/null
+++ b/scripts/linux/hunt-async-io-tests.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+pid=`ps aux | grep '[s]almonella-run-publish/chicken/bin/csi -script run.scm' | grep -v dev/null | awk '{print $2}'`
+
+if [ -n "$pid" ]; then
+    if readlink /proc/$pid/cwd | grep async-io/tests; then
+        test_start=`stat -c "%Y" /proc/$pid`
+        now=`date +%s`
+        if [ `expr $now - $test_start` -gt 300 ]; then
+            kill $pid >/dev/null 2>&1
+        fi
+    fi
+fi
Trap