-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-scan-dump.sh
executable file
·59 lines (43 loc) · 987 Bytes
/
test-scan-dump.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
#!/bin/sh
set -eu
# enable -x while debugging tests
set -x
SD=./build/libiw/scan-dump
echo "run some simple scan-dump tests"
if [ ! -f $SD ] ; then
echo "failure! can't find scan-dump at $SD"
exit 1
fi
function fail {
# not sure how to find the failed test; run with -x for now
echo "test failure!"
exit 1
}
function wiface {
for f in /sys/class/net/wl*
do
. $f/uevent
# for now, take the first entry found
break
done
}
trap fail err
# verify can at least run
$SD 2> /dev/null && exit 1
# verify bad interface detected
$SD dave0 2> /dev/null && exit 1
INTERFACE=
wiface
if [ -z "$INTERFACE" ] ; then
echo "failure: no wifi devices found"
exit 1
fi
echo found interface=$INTERFACE
# this should succeed
$SD $INTERFACE &> /dev/null || exit 1
# -i and -o cannot be used at the same time
$SD -i /tmp/dave.dat -o /tmp/dave.dat $INTERFACE 2> /dev/null && exit 1
# -h should give us some nice help
sdhelp=$($SD -h 2>&1 && exit 1)
echo $sdhelp
echo "success!"