blob: f4705ee48f6cb93e13f1972569730140ce3c4b06 (
plain)
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
77
78
|
#!/bin/bash
#USE_CONFIG=0
#GENERATE_CONFIG=0
#HELP=$HELP
# for autotools compability (config can be passed by environment variable)
if [[ -n $USE_CONFIG ]]
then
CONFIG_FILE=$USE_CONFIG
elif [[ -n $GENERATE_CONFIG ]]
then
CONFIG_FILE=$GENERATE_CONFIG
fi
function usage {
echo "libusbg test suit"
echo "Usage: ./test.sh [option]"
echo "Options:"
echo " --generate-config filename - generates config to given file and exit"
echo " --use-config filename - runs test suit using config from given file"
echo " -h --help - print this message"
}
# Parse arguments
ARGS=$(getopt --long generate-config:,use-config:,help -o h -- "$@" )
if [ $? -ne 0 ]
then
HELP=1
fi
eval set -- $ARGS
while true; do
case $1 in
-h|--help)
HELP=1
shift
;;
--use-config)
USE_CONFIG=1
CONFIG_FILE=$2
shift 2
;;
--generate-config)
GENERATE_CONFIG=1
CONFIG_FILE=$2
shift 2
;;
--)
shift
break
;;
*)
HELP=1
shift
;;
esac
done
# Run test with io functions ovverride
if [[ -n $USE_CONFIG ]]
then
LD_LIBRARY_PATH=. ./test --use-config < $CONFIG_FILE
elif [[ -n $GENERATE_CONFIG ]]
then
LD_LIBRARY_PATH=. ./test --generate-config > $CONFIG_FILE
elif [[ -n $HELP ]]
then
usage
exit 77 # autotools consider it skipped
else
LD_LIBRARY_PATH=. ./test
fi
|