10 echo "b43-(d)asm trivial selftest"
11 echo "This selftest will take the binary input file, disassemble"
12 echo "it, assemble it and compare the two binaries."
14 echo "Usage: $0 /path/to/binary [arch] [format]"
20 [ $# -eq 0 ] || arch="$1" && shift
21 [ $# -eq 0 ] || format="$1" && shift
24 if ! [ -r "$infile" ]; then
25 echo "Can not read input binary $infile"
30 asmfile="$TMPDIR/b43-asm-selftest-$rnd.asm"
31 outfile="$TMPDIR/b43-asm-selftest-$rnd.bin"
41 $DASM "$infile" "$asmfile" --arch $arch --format $format
43 if [ $err -ne 0 ]; then
44 echo "Disassembling FAILED: $err"
48 $ASM "$asmfile" "$outfile" --format $format
50 if [ $err -ne 0 ]; then
51 echo "Assembling FAILED: $err"
56 orig_sum="$($SUM "$infile" | cut -f1 -d ' ')"
58 if [ $err -ne 0 ] || [ -z "$orig_sum" ]; then
59 echo "Checksumming of input file failed: $err"
63 out_sum="$($SUM "$outfile" | cut -f1 -d ' ')"
65 if [ $err -ne 0 ] || [ -z "$out_sum" ]; then
66 echo "Checksumming of reassembled file failed: $err"
72 echo "Input file checksum: $orig_sum"
73 echo "Re-assembled checksum: $out_sum"
76 if [ "$orig_sum" != "$out_sum" ]; then
77 echo "FAILURE: Checksums don't match!"
80 echo "Checksums match"