-
Notifications
You must be signed in to change notification settings - Fork 15
/
run_validate.sh
executable file
·82 lines (76 loc) · 2.14 KB
/
run_validate.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
77
78
79
80
81
82
#!/bin/bash
#
# Designed to be run by Travis CI and so accumulates any error responses
# in $errors which is then used as the exit code. Exit code will be
# zero for no errors.
#
# -v to be more verbose
# -d for debugging info
#
# See http://tldp.org/LDP/abs/html/arithexp.html for bash arithmetic
verbosity='--quiet'
test_netpbm=true
show_test_name=false
while getopts "nvd" opt; do
case $opt in
n)
test_netpbm=false
;;
v)
verbosity=''
show_test_name=true
;;
d)
verbosity='--verbose'
show_test_name=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
# Set up test server
if $show_test_name; then
echo "Starting test server..."
fi
./iiif_testserver.py --quiet --manipulators=netpbm,pil 2>&1 > /dev/null &
sleep 2
# Run validations against test server
errors=0
if $show_test_name; then
echo "Testing PIL manipulator, API version 1.1"
fi
iiif-validate.py -s localhost:8000 -p 1.1_pil -i 67352ccc-d1b0-11e1-89ae-279075081939 --version=1.1 --level 2 $verbosity
((errors+=$?))
if $show_test_name; then
echo "Testing PIL manipulator, API version 2.0"
fi
iiif-validate.py -s localhost:8000 -p 2.0_pil -i 67352ccc-d1b0-11e1-89ae-279075081939 --version=2.0 --level 2 $verbosity
((errors+=$?))
if $show_test_name; then
echo "Testing PIL manipulator, API version 3.0 "
fi
iiif-validate.py -s localhost:8000 -p 3.0_pil -i 67352ccc-d1b0-11e1-89ae-279075081939 --version=3.0 --level 2 $verbosity
((errors+=$?))
if $test_netpbm; then
if $show_test_name; then
echo "Testing netpbm manipulator, API version 1.1"
fi
iiif-validate.py -s localhost:8000 -p 1.1_netpbm -i 67352ccc-d1b0-11e1-89ae-279075081939 --version=1.1 --level 2 $verbosity
((errors+=$?))
if $show_test_name; then
echo "Testing netpbm manipulator, API version 2.0"
fi
iiif-validate.py -s localhost:8000 -p 2.0_netpbm -i 67352ccc-d1b0-11e1-89ae-279075081939 --version=2.0 --level 2 $verbosity
((errors+=$?))
fi
# Kill test server
kill `cat iiif_testserver.pid`
if test $errors -eq 0; then
msg="no errors"
else
msg="$errors errors, use -v or -d for details"
fi
echo "$0 finished ($msg)"
exit $errors