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"
19 if ! [ -r "$infile" ]; then
20 echo "Can not read input binary $infile"
25 asmfile="$TMPDIR/b43-asm-selftest-$rnd.asm"
26 outfile="$TMPDIR/b43-asm-selftest-$rnd.bin"
36 $DASM "$infile" "$asmfile"
38 if [ $err -ne 0 ]; then
39 echo "Disassembling FAILED: $err"
43 $ASM "$asmfile" "$outfile"
45 if [ $err -ne 0 ]; then
46 echo "Assembling FAILED: $err"
51 orig_sum="$($SUM "$infile" | cut -f1 -d ' ')"
53 if [ $err -ne 0 ] || [ -z "$orig_sum" ]; then
54 echo "Checksumming of input file failed: $err"
58 out_sum="$($SUM "$outfile" | cut -f1 -d ' ')"
60 if [ $err -ne 0 ] || [ -z "$out_sum" ]; then
61 echo "Checksumming of reassembled file failed: $err"
67 echo "Input file checksum: $orig_sum"
68 echo "Re-assembled checksum: $out_sum"
71 if [ "$orig_sum" != "$out_sum" ]; then
72 echo "FAILURE: Checksums don't match!"
75 echo "Checksums match"