forked from binspector/binspector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smoke_test.sh
executable file
·76 lines (57 loc) · 1.96 KB
/
smoke_test.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Run a command, and echo before doing so. Also checks the exit
# status and quits if there was an error.
echo_run ()
{
echo "EXEC : $@"
"$@"
r=$?
if test $r -ne 0 ; then
exit $r
fi
}
echo_run cd `dirname $0`
cd ..
if [ "$BUILDMODE" == "debug" ] ; then
CURMODE="debug"
elif [ "$BUILDMODE" == "release" ] ; then
CURMODE="release"
else
echo "INFO : BUILDMODE unspecfied. Defaulting to debug."
CURMODE="debug"
fi
BINPATH="./bin/$CURMODE/binspector"
if [ ! -e $BINPATH ]; then
echo "INFO : $BINPATH not found: setting up."
./binspector/configure.sh
else
echo "INFO : $BINPATH found: skipping setup."
fi
# Always run build in case the sources have been touched.
./binspector/build.sh
if [ ! -e 'samples' ]; then
mkdir 'samples'
fi
JPEGPATH='samples/sample.jpg'
if [ ! -e $JPEGPATH ]; then
echo "INFO : $JPEGPATH not found; downloading."
# Image use license: http://creativecommons.org/licenses/by-sa/3.0/
SAMPLE_JPEG='http://upload.wikimedia.org/wikipedia/commons/b/b4/JPEG_example_JPG_RIP_100.jpg'
echo_run curl -L "$SAMPLE_JPEG" -o $JPEGPATH
else
echo "INFO : $JPEGPATH found: skipping download."
fi
PNGPATH='samples/sample.png'
if [ ! -e $PNGPATH ]; then
echo "INFO : $PNGPATH not found; downloading."
# Image use license: http://creativecommons.org/licenses/by-sa/3.0/
SAMPLE_PNG='http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png'
echo_run curl -L "$SAMPLE_PNG" -o $PNGPATH
else
echo "INFO : $PNGPATH found: skipping download."
fi
echo_run $BINPATH -t ./binspector/test/issue1.bfft -i ./binspector/test/empty.bin -m validate
echo_run $BINPATH -t ./binspector/test/issue11.bfft -i $JPEGPATH -m validate
echo_run $BINPATH -t ./binspector/test/issue19.bfft -i ./binspector/test/empty.bin -m validate
echo_run $BINPATH -t ./binspector/bfft/png.bfft -i $PNGPATH -m validate
echo_run $BINPATH -t ./binspector/bfft/jpg.bfft -i $JPEGPATH -m validate