Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add minimal (and slightly broken) test suite
- Loading branch information
Showing
12 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
selftest/*.out | ||
selftest/*.bin | ||
genromfs | ||
genromfs.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0060 02d9 ccb2 -rom1fs-...`.... | ||
0000010: 454d 5054 5900 0000 0000 0000 0000 0000 EMPTY........... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0000 0000 0020 0000 0000 d1d1 ffe0 ....... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0090 d7d4 1ad9 -rom1fs-........ | ||
0000010: 5349 4e47 4c45 4649 4c45 0000 0000 0000 SINGLEFILE...... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0002 0000 0000 0000 0006 228a 928b ............"... | ||
0000070: 6475 6d6d 7900 0000 0000 0000 0000 0000 dummy........... | ||
0000080: 6475 6d6d 790a 0000 0000 0000 0000 0000 dummy........... | ||
0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 00b0 2f1d 0eba -rom1fs-..../... | ||
0000010: 4841 5244 4c49 4e4b 0000 0000 0000 0000 HARDLINK........ | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0092 0000 0000 0000 0006 228a 91fb ............"... | ||
0000070: 6475 6d6d 7900 0000 0000 0000 0000 0000 dummy........... | ||
0000080: 6475 6d6d 790a 0000 0000 0000 0000 0000 dummy........... | ||
0000090: 0000 0000 0000 0060 0000 0000 2b35 1ed1 .......`....+5.. | ||
00000a0: 6861 7264 6c69 6e6b 0000 0000 0000 0000 hardlink........ | ||
00000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0250 3b02 526e -rom1fs-...P;.Rn | ||
0000010: 414c 4947 4e45 4400 0000 0000 0000 0000 ALIGNED......... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 01e2 0000 0000 0000 0007 1255 cc9f .............U.. | ||
0000070: 7430 3178 797a 0000 0000 0000 0000 0000 t01xyz.......... | ||
0000080: 7430 3161 6263 0a00 0000 0000 0000 0000 t01abc.......... | ||
0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00001e0: 0000 0222 0000 0000 0000 001d 1558 cb4c ...".........X.L | ||
00001f0: 7430 3275 7677 0000 0000 0000 0000 0000 t02uvw.......... | ||
0000200: 2835 3132 616c 6967 6e65 6430 3132 3334 (512aligned01234 | ||
0000210: 3536 3738 3961 6263 6465 6629 0a00 0000 56789abcdef).... | ||
0000220: 0000 0002 0000 0000 0000 0007 185b cc85 .............[.. | ||
0000230: 7430 3372 7374 0000 0000 0000 0000 0000 t03rst.......... | ||
0000240: 7430 3367 6869 0a00 0000 0000 0000 0000 t03ghi.......... | ||
0000250: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0120 17fb d72b -rom1fs-... ...+ | ||
0000010: 4142 5341 4c49 474e 4544 0000 0000 0000 ABSALIGNED...... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0092 0000 0000 0000 0007 1255 cdef .............U.. | ||
0000070: 7430 3178 797a 0000 0000 0000 0000 0000 t01xyz.......... | ||
0000080: 7430 3161 6263 0a00 0000 0000 0000 0000 t01abc.......... | ||
0000090: 0000 00e2 0000 0000 0000 0007 1558 cca2 .............X.. | ||
00000a0: 7430 3275 7677 0000 0000 0000 0000 0000 t02uvw.......... | ||
00000b0: 7430 3264 6566 0a00 0000 0000 0000 0000 t02def.......... | ||
00000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
00000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
00000e0: 0000 0002 0000 0000 0000 001d 88d0 31b3 ..............1. | ||
00000f0: 7430 335f 3132 3361 6c69 676e 6564 0000 t03_123aligned.. | ||
0000100: 2831 3238 616c 6967 6e65 6430 3132 3334 (128aligned01234 | ||
0000110: 3536 3738 3961 6263 6465 6629 0a00 0000 56789abcdef).... | ||
0000120: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 00c0 0a64 6c20 -rom1fs-.....dl | ||
0000010: 4558 5444 4154 4100 0000 0000 0000 0000 EXTDATA......... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0092 0000 0000 0000 0010 b862 1db5 .............b.. | ||
0000070: 726f 6d31 612e 7478 7400 0000 0000 0000 rom1a.txt....... | ||
0000080: 3031 3233 3031 3233 7777 7731 3031 320a 01230123www1012. | ||
0000090: 0000 0002 0000 0000 0000 0010 b762 1e45 .............b.E | ||
00000a0: 726f 6d31 622e 7478 7400 0000 0000 0000 rom1b.txt....... | ||
00000b0: 3031 3233 3031 3233 7777 7731 3031 320a 01230123www1012. | ||
00000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0110 52ee 265d -rom1fs-....R.&] | ||
0000010: 4445 4641 4c49 474e 4544 0000 0000 0000 DEFALIGNED...... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 00e2 0000 0000 0000 0005 2a25 27eb ............*%'. | ||
0000070: 6162 632e 7478 7400 0000 0000 0000 0000 abc.txt......... | ||
0000080: 3031 3233 0a00 0000 0000 0000 0000 0000 0123............ | ||
0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00000e0: 0000 0002 0000 0000 0000 0005 2722 25cb ............'"%. | ||
00000f0: 6465 662e 7478 7400 0000 0000 0000 0000 def.txt......... | ||
0000100: 3435 3637 0a00 0000 0000 0000 0000 0000 4567............ | ||
0000110: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0810 c342 3775 -rom1fs-.....B7u | ||
0000010: 4d55 4c54 4941 4c49 474e 4544 0000 0000 MULTIALIGNED.... | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 01e0 0000 0020 0000 0000 d1d1 fe00 ....... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00001e0: 0000 07e2 0000 0000 0000 0008 f067 503c .............gP< | ||
00001f0: 6d36 386b 2e62 6f6f 7400 0000 0000 0000 m68k.boot....... | ||
0000200: 626f 6f74 3531 320a 0000 0000 0000 0000 boot512......... | ||
0000210: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00007e0: 0000 0002 0000 0000 0000 0009 b9ed 3c14 ..............<. | ||
00007f0: 7370 6172 632e 626f 6f74 0000 0000 0000 sparc.boot...... | ||
0000800: 626f 6f74 3230 3438 0a00 0000 0000 0000 boot2048........ | ||
0000810: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
0000bf0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
0000000: 2d72 6f6d 3166 732d 0000 0090 32c1 24d3 -rom1fs-....2.$. | ||
0000010: 4558 434c 5544 4553 0000 0000 0000 0000 EXCLUDES........ | ||
0000020: 0000 0049 0000 0020 0000 0000 d1ff ff97 ...I... ........ | ||
0000030: 2e00 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000040: 0000 0060 0000 0020 0000 0000 d1d1 ff80 ...`... ........ | ||
0000050: 2e2e 0000 0000 0000 0000 0000 0000 0000 ................ | ||
0000060: 0000 0002 0000 0000 0000 0007 9d9a 8b96 ................ | ||
0000070: 6265 7461 0000 0000 0000 0000 0000 0000 beta............ | ||
0000080: 6e65 6564 6564 0a00 0000 0000 0000 0000 needed.......... | ||
0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
* | ||
00003f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/bin/sh | ||
|
||
# requires: GNU md5sum and bash, xxd from vim | ||
# known bug: file ordering is not actually specified | ||
|
||
NTESTS=9 | ||
FAIL=0 | ||
I=0 | ||
V= | ||
tdir=`pwd` | ||
CMD=$tdir/../genromfs | ||
mkdir testimg | ||
cd testimg | ||
|
||
function testlabel () { | ||
I=`expr $I + 1` | ||
echo "$I/$NTESTS" "$@" | ||
rm -f * | ||
rm -f $tdir/img.bin | ||
} | ||
|
||
function testsummary () { | ||
xxd -a <$tdir/img.bin >$tdir/$I.out | ||
if ! diff -u $tdir/$I.ok $tdir/$I.out; then | ||
echo FAILED - Check differences above | ||
FAIL=`expr $FAIL + 1` | ||
else | ||
echo OK | ||
rm -f $tdir/$I.out | ||
fi | ||
} | ||
|
||
testlabel Test image with no files | ||
eval $CMD $V -V EMPTY -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test image with a single file | ||
echo dummy >dummy | ||
eval $CMD $V -V SINGLEFILE -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test image with a hard links | ||
echo dummy >dummy | ||
ln dummy hardlink | ||
eval $CMD $V -V HARDLINK -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test image with alignment | ||
echo t01abc >t01xyz | ||
echo '(512aligned0123456789abcdef)' >t02uvw | ||
echo t03ghi >t03rst | ||
eval $CMD $V -V ALIGNED -A '512,t02*' -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test image with alignment with absolute path | ||
echo t01abc >t01xyz | ||
echo t02def >t02uvw | ||
echo '(128aligned0123456789abcdef)' >t03_123aligned | ||
eval $CMD $V -V ABSALIGNED -A '128,/t03*' -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test image with file data | ||
echo 01230123www1012 >rom1a.txt | ||
echo 01230123www1012 >rom1b.txt | ||
eval $CMD $V -V EXTDATA -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test default alignment | ||
echo 0123 >abc.txt | ||
echo 4567 >def.txt | ||
eval $CMD $V -V DEFALIGNED -a128 -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test multiple alignment | ||
echo boot512 >m68k.boot | ||
echo boot2048 >sparc.boot | ||
eval $CMD $V -V MULTIALIGNED -A2048,*.boot -A1024,m68k.boot -A512,m68k.boot -f $tdir/img.bin | ||
testsummary | ||
|
||
testlabel Test excludes | ||
echo unwanted >alpha | ||
echo needed >beta | ||
echo unwanted >gamma | ||
eval $CMD $V -V EXCLUDES -x '"*a*a"' -f $tdir/img.bin | ||
testsummary | ||
|
||
# remove stray files | ||
rm -f * | ||
|
||
# end | ||
echo $FAIL failures found | ||
cd $tdir | ||
rm -f img.bin | ||
rmdir testimg |