X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=assembler%2Fselftest.sh;h=54462b9f0f142eacaeeb70b4dd3597f082142588;hb=e21b92e66ad6c143da489331d4d56abfa2092160;hp=7f2f0c556929274156ab34a0df4678f1cb6c5256;hpb=81e43677e8666f7a00ab0ef38050324cc206f248;p=b43-tools.git diff --git a/assembler/selftest.sh b/assembler/selftest.sh index 7f2f0c5..54462b9 100755 --- a/assembler/selftest.sh +++ b/assembler/selftest.sh @@ -6,15 +6,20 @@ SUM="sha1sum" TMPDIR="/tmp" -if [ $# -ne 1 ]; then +if [ $# -lt 1 ]; then echo "b43-(d)asm trivial selftest" echo "This selftest will take the binary input file, disassemble" echo "it, assemble it and compare the two binaries." echo - echo "Usage: $0 /path/to/binary" + echo "Usage: $0 /path/to/binary [arch] [format]" exit 1 fi -infile="$1" +arch="5" +format="b43" +infile="$1" && shift +[ $# -eq 0 ] || arch="$1" && shift +[ $# -eq 0 ] || format="$1" && shift + if ! [ -r "$infile" ]; then echo "Can not read input binary $infile" @@ -33,14 +38,14 @@ function cleanup cleanup -$DASM "$infile" "$asmfile" +$DASM "$infile" "$asmfile" --arch $arch --format $format err=$? if [ $err -ne 0 ]; then echo "Disassembling FAILED: $err" cleanup exit 1 fi -$ASM "$asmfile" "$outfile" +$ASM "$asmfile" "$outfile" --format $format err=$? if [ $err -ne 0 ]; then echo "Assembling FAILED: $err" @@ -72,6 +77,6 @@ if [ "$orig_sum" != "$out_sum" ]; then echo "FAILURE: Checksums don't match!" exit 1 fi -echo "Everything is OK" +echo "Checksums match" exit 0