]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
sg/001: put syzkaller temporary crap in $TMPDIR
authorOmar Sandoval <osandov@fb.com>
Wed, 7 Jun 2017 06:32:07 +0000 (23:32 -0700)
committerOmar Sandoval <osandov@fb.com>
Wed, 7 Jun 2017 06:39:43 +0000 (23:39 -0700)
Signed-off-by: Omar Sandoval <osandov@fb.com>
check
common/rc
new
tests/sg/001

diff --git a/check b/check
index 22dedec2cf8b2f447000dcdda3bcfab046a4bf3b..f2f9d33639195937d890d6b35bab7b97316d9d7c 100755 (executable)
--- a/check
+++ b/check
@@ -318,8 +318,10 @@ _call_test() {
        fi
 
        TIMEFORMAT="%Rs"
+       pushd . >/dev/null
        { time "$test_func" >"${seqres}.out" 2>&1; } 2>"${seqres}.runtime"
        TEST_RUN[exit_status]=$?
+       popd >/dev/null
        TEST_RUN[runtime]="$(cat "${seqres}.runtime")"
        rm -f "${seqres}.runtime"
 
@@ -479,6 +481,8 @@ _find_sysfs_dir() {
 
 declare -A TEST_DEV_SYSFS_DIRS
 _check() {
+       SRCDIR="$(realpath src)"
+
        local test_dev
        for test_dev in "${TEST_DEVS[@]}"; do
                if [[ ! -e $test_dev ]]; then
index 540e81e05955472b937feaf1750bea0376bbcc07..b01f936b878b44dda8b45d8559e7542dbc65ebbd 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -66,6 +66,14 @@ _have_program() {
        fi
 }
 
+_have_src_program() {
+       if [[ ! -x "$SRCDIR/$1" ]]; then
+               SKIP_REASON="$1 was not built; run \`make\`"
+               return 1
+       fi
+       return 0
+}
+
 _have_loop() {
        _have_module loop && _have_program losetup
 }
diff --git a/new b/new
index 4f5a8b493e2a4ccf9bbd294f075c2e66431e2a2b..7447d1544f45ee08971f1468691f53f5acf06e30 100755 (executable)
--- a/new
+++ b/new
@@ -216,6 +216,7 @@ DESCRIPTION=""
 # Various variables are defined for the test:
 #    - \$TEST_NAME -- the full name of the test.
 #    - \$TMPDIR -- a temporary directory deleted after the test is run.
+#    - \$SRCDIR -- absolute path of the src/ subdirectory
 #    - \$FULL -- a file where the test may log verbose output (e.g., the output
 #               of fio or mkfs).
 #    - \$TEST_RUN -- an associative array of additional test data to display
index 1dc6b446076a211f5ed70f28eb6027f26a08a68c..a4e4809e34832586996c0991b6bb404b1a9abca4 100755 (executable)
@@ -24,7 +24,7 @@ DESCRIPTION="try triggering a kernel GPF with 0 byte SG reads"
 QUICK=1
 
 requires() {
-       _have_program src/sg/syzkaller1 && _have_scsi_debug
+       _have_src_program sg/syzkaller1 && _have_scsi_debug
 }
 
 test() {
@@ -35,7 +35,8 @@ test() {
        fi
 
        SG_DEV="/dev/$(_get_sg_from_blockdev "$SCSI_DEBUG_NAME")"
-       timeout -s INT 10s ./src/sg/syzkaller1 "$SG_DEV"
+       cd "$TMPDIR"
+       timeout -s INT 10s "$SRCDIR/sg/syzkaller1" "$SG_DEV"
 
        _put_scsi_debug_dev