-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·50 lines (42 loc) · 1.13 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Call as
# ./test.sh path-to-firmware
# to test the emulator. The firmware has to be the one with md5 checksum
# 823609edf7fd72863ca37e7e4868cb3d
set -e
usage () {
echo "usage: ./test.sh path-to-firmware"
exit 1
}
[ "x$0" = "x./test.sh" ] || usage
firmware=$1
dumpfile=/tmp/lapocket-dump.tmp
errfile=/tmp/lapocket-err.tmp
cardfile=/tmp/lapocket-card.tmp
exefile=/tmp/lapocket-exe.tmp
cleanup () {
rm -f $dumpfile $errfile $cardfile $exefile
}
trap cleanup EXIT
fail () {
echo "FAILURE"
mv $errfile ../failure.out
exit 1
}
# Preserve the executable in case it changes during the tests
cp ./lapocket "$exefile"
touch "$cardfile"
truncate -s 256M "$cardfile"
rm -rf ./tests/bin
cd ./tests
mkdir bin
for filename in *.out; do
echo -n "${filename%.out}... "
# Tests that mention "CompactFlash" are the ones that use the card
if grep -q CompactFlash ${filename%.out}; then
"$exefile" --headless -f ${filename%.out} -C $cardfile $firmware > $dumpfile 2>$errfile || fail
else
"$exefile" --headless -f ${filename%.out} $firmware > $dumpfile 2>$errfile || fail
fi
diff $filename $dumpfile > $errfile 2>&1 || fail
echo "SUCCESS"
done