]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
- fix swap sanity tests in blkid, and blkid tests
authorEric Sandeen <sandeen@redhat.com>
Mon, 12 May 2008 18:26:51 +0000 (13:26 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 12 May 2008 20:17:11 +0000 (16:17 -0400)
Swap is actually native-endian on disk, and with the latest
swapspace sanity checks I added we need to have native swapspace
examples in the blkid tests, so re-mkswap them during testing.

One one other required change, though; mkswap requires at least
10 pages of swap, so the image needs to be increased to 10x64k
if mkswap is to succeed...

Maybe it'd be better to just dd it out on the fly?

Addresses-redhat-bugzilla: 445786

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/blkid/probe.c
lib/blkid/test_probe.in

index 05b2d227a6c5996a76b2903f94ef87d4e93879c8..d8457a865e8e654c524b4fe8b63e99d00d31b9e8 100644 (file)
@@ -845,8 +845,7 @@ static int probe_swap1(struct blkid_probe *probe,
 
        /* check for wrong version or zeroed pagecount, for sanity */
        if (!memcmp(id->bim_magic, "SWAPSPACE2", id->bim_len) &&
-                       (blkid_le32(sws->sws_version) != 1 ||
-                        sws->sws_lastpage == 0))
+                       (sws->sws_version != 1 || sws->sws_lastpage == 0))
                return 1;
 
        /* arbitrary sanity check.. is there any garbage down there? */
index ce8c42f17567e3f721a67ce9b0d3cf092261661a..4051c17bba9443c13c9cd654e6d4af2e8638cca1 100644 (file)
@@ -20,6 +20,12 @@ do
                continue
        fi
        bunzip2 < $SRCDIR/tests/$i.img.bz2 > tests/tmp/test.img.$$
+       # swap is native-endian, so regenerate before testing
+       if [ "$i" == "swap0" ]; then
+               mkswap -v0 tests/tmp/test.img.$$ > /dev/null
+       elif [ "$i" == "swap1" ]; then
+               mkswap -v1 -L SWAP-TEST -U 8ff8e77f-8553-485e-8656-58be67a81666 tests/tmp/test.img.$$ >/dev/null
+       fi
        ./tst_probe tests/tmp/test.img.$$ > tests/$i.out
        /bin/rm -f tests/tmp/test.img.$$ tests/$i.ok tests/$i.failed
        cmp -s tests/$i.out $SRCDIR/tests/$i.results