Skip to content

Commit

Permalink
Fix freebsd reporting on reruns
Browse files Browse the repository at this point in the history
Turns out, when your test-suite fails with
Results Summary
PASS	 1358
FAIL	   7
SKIP	  47

Running Time:	04:00:02
Percent passed:	96.2%
Log directory:	/var/tmp/test_results/20220225T092538
mktemp: illegal option -- p
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
mktemp: illegal option -- p
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
/usr/local/share/zfs/zfs-tests.sh: cannot create :
                                   No such file or directory
that's a bad thing!!

Fixes: 2320e6e ("Add zfs-test
 facility to automatically rerun failing tests")
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
  • Loading branch information
nabijaczleweli committed Feb 26, 2022
1 parent f2f6c18 commit 1439236
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/zfs-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -688,14 +688,16 @@ export __ZFS_POOL_EXCLUDE
export TESTFAIL_CALLBACKS
export PATH=$STF_PATH

if [ "$UNAME" = "FreeBSD" ] ; then
mkdir -p "$FILEDIR" || true
RESULTS_FILE=$(mktemp -u "${FILEDIR}/zts-results.XXXXXX")
REPORT_FILE=$(mktemp -u "${FILEDIR}/zts-report.XXXXXX")
else
RESULTS_FILE=$(mktemp -u -t zts-results.XXXXXX -p "$FILEDIR")
REPORT_FILE=$(mktemp -u -t zts-report.XXXXXX -p "$FILEDIR")
fi
mktemp_sotrue() {
if [ "$UNAME" = "FreeBSD" ] ; then
mktemp -u "${FILEDIR}/$1.XXXXXX"
else
mktemp -ut "$1.XXXXXX" -p "$FILEDIR"
fi
}
mkdir -p "$FILEDIR" || :
RESULTS_FILE=$(mktemp_sotrue zts-results)
REPORT_FILE=$(mktemp_sotrue zts-report)

#
# Run all the tests as specified.
Expand Down Expand Up @@ -725,8 +727,8 @@ RESULT=$?

if [ "$RESULT" -eq "2" ] && [ -n "$RERUN" ]; then
MAYBES="$($ZTS_REPORT --list-maybes)"
TEMP_RESULTS_FILE=$(mktemp -u -t zts-results-tmp.XXXXX -p "$FILEDIR")
TEST_LIST=$(mktemp -u -t test-list.XXXXX -p "$FILEDIR")
TEMP_RESULTS_FILE=$(mktemp_sotrue zts-results-tmp)
TEST_LIST=$(mktemp_sotrue test-list)
grep "^Test:.*\[FAIL\]" "$RESULTS_FILE" >"$TEMP_RESULTS_FILE"
for test_name in $MAYBES; do
grep "$test_name " "$TEMP_RESULTS_FILE" >>"$TEST_LIST"
Expand Down

0 comments on commit 1439236

Please sign in to comment.