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"
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
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
}
# 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
QUICK=1
requires() {
- _have_program src/sg/syzkaller1 && _have_scsi_debug
+ _have_src_program sg/syzkaller1 && _have_scsi_debug
}
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