From da793a230c956a02ac844de3e58e1f73f14bd440 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 26 Oct 2026 21:01:50 +0100 Subject: [PATCH] Update goldens --- src/main.c | 2 +- test/images.txt | 16 ++++++++-------- test/run.sh | 19 +++++++++++++------ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main.c b/src/main.c index 70d704c..2c6354c 100644 --- a/src/main.c +++ b/src/main.c @@ -291,7 +291,7 @@ int main(int argc, const char **argv) { R2F *r = r2f_new (&opt); if (!r) { r_list_free (fuseopts); - return 1; + return check? 2: 1; } int ret; if (check) { diff --git a/test/images.txt b/test/images.txt index 69d2bb3..dac2336 100644 --- a/test/images.txt +++ b/test/images.txt @@ -3,7 +3,7 @@ apfs.img - ok ext2.img - ok ext3.img - ok ext4.img - ok -ext4_advanced.img - fail ext2 grub plugin cannot mount it +ext4_advanced.img - ok fat.img - ok hfs.img - ok iso.img - ok @@ -11,18 +11,18 @@ iso2.img - ok iso3.img - ok iso-joliet-rockridge.iso - ok udf.img udf ok autodetected as iso9660 -haiku.bfs - fail bfs reads stop after the first block run +haiku.bfs - ok ntfs.img - fail $Extend metafiles cannot be opened ntfs-resident-oob.img - fail crafted image -reiserfs-link-root.img - fail symlinks reported as regular files -reiserfs-corrupt.img - fail crafted image +reiserfs-link-root.img - ok symlinks are reported as special files +reiserfs-corrupt.img - ok crafted image reiserfs-name-oob.img - ok crafted image sfs-btree-nodes.img sfs ok no sfs magic in r_fs_name sfs-dir-cycle.img sfs ok crafted image -sfs-blocksize-0.img sfs fail crafted image, must refuse to mount +sfs-blocksize-0.img sfs reject crafted image, must refuse to mount ubifs.img - ok ubifs-index-cycle.img - ok crafted image -ubifs-oversize.img - fail crafted image +ubifs-oversize.img - ok synthetic image with unknown volume size xfs-symlink-size.img - ok -bfs-sibling-cycle.img - fail crafted image, must refuse to mount -hfs-oobread.img - fail crafted image, must refuse to mount +bfs-sibling-cycle.img - reject crafted image, must refuse to mount +hfs-oobread.img - reject crafted image, must refuse to mount diff --git a/test/run.sh b/test/run.sh index e330516..10ba31b 100755 --- a/test/run.sh +++ b/test/run.sh @@ -57,29 +57,36 @@ while read -r img fstype expect notes; do fi set -- [ "$fstype" != "-" ] && set -- -t "$fstype" - if with_timeout "$R2FUSE" -s "$@" "$path" > "$TMP/out" 2>&1; then + rc=0 + with_timeout "$R2FUSE" -s "$@" "$path" > "$TMP/out" 2>&1 || rc=$? + case "$rc" in + 0) res=ok if [ -n "$R2FUSE_MOUNT" ] && ! mount_test "$path" "$@"; then res=fail fi - else - res=fail - fi + ;; + 1) res=fail ;; + 2) res=reject ;; + *) res=crash ;; + esac summary=$(tail -n 1 "$TMP/out") if [ "$res" = "$expect" ]; then if [ "$res" = ok ]; then echo "OK $img: $summary"; pass=$((pass + 1)) + elif [ "$res" = reject ]; then + echo "OK $img: rejected malformed image"; pass=$((pass + 1)) else echo "XFAIL $img: $notes"; xfail=$((xfail + 1)) fi elif [ "$res" = ok ]; then echo "XPASS $img: $summary (update test/images.txt)"; xpass=$((xpass + 1)) else - echo "FAIL $img: $summary" + echo "FAIL $img: exit $rc (expected $expect): $summary" grep -E '^(FAIL|ERROR)' "$TMP/out" | head -n 5 | sed 's/^/ /' fail=$((fail + 1)) fi done < "$HERE/images.txt" echo "# ok=$pass fail=$fail xfail=$xfail xpass=$xpass skip=$skip" -[ $fail -eq 0 ] +[ $fail -eq 0 ] && [ $xpass -eq 0 ]