-
Notifications
You must be signed in to change notification settings - Fork 14
/
run_test.sh
executable file
·133 lines (114 loc) · 2.79 KB
/
run_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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
read -rd "\000" helpmessage <<EOF
$(basename $0): Run common workflow tool description language conformance tests.
Syntax:
$(basename $0) [RUNNER=/path/to/cwl-runner] [EXTRA=--optional-arguments-to-cwl-runner]
Options:
-nT Run a specific test.
-l List tests
-jJ Specifies the number of tests to run simultaneously
(defaults to one).
--only-tools Only test CommandLineTools
--junit-xml=FILENAME Store results in JUnit XML format using the given
FILENAME
--classname=CLASSNAME In the JUnit XML, tag the results with the given
CLASSNAME
--verbose Print the cwltest invocation and pass --verbose to
cwltest
Note:
EXTRA is useful for passing --enable-dev to the CWL reference runner:
Example: RUNNER=cwltool EXTRA=--enable-dev
EOF
TEST_N=""
JUNIT_XML=""
RUNNER=cwl-runner
PLATFORM=$(uname -s)
COVERAGE="python"
EXTRA=""
CLASS=""
VERBOSE=""
while [[ -n "$1" ]]
do
arg="$1"; shift
case "$arg" in
--help)
echo >&2 "$helpmessage"
echo >&2
exit 1
;;
-n*)
TEST_N=$arg
;;
-j*)
TEST_J=$arg
;;
-l)
TEST_L=-l
;;
--only-tools)
ONLY_TOOLS=$arg
;;
--junit-xml=*)
JUNIT_XML=$arg
;;
--classname=*)
CLASS=$arg
;;
--verbose)
VERBOSE=$arg
;;
*=*)
eval $(echo $arg | cut -d= -f1)=\"$(echo $arg | cut -d= -f2-)\"
;;
esac
done
DRAFT_DIR="./tests"
if ! runner="$(which $RUNNER)" ; then
echo >&2 "$helpmessage"
echo >&2
echo >&2 "runner '$RUNNER' not found"
exit 1
fi
runs=0
failures=0
checkexit() {
if [[ "$?" != "0" ]]; then
failures=$((failures+1))
fi
}
runtest() {
echo "--- Running conformance test on $1 ---"
"$1" --version
runs=$((runs+1))
(cd $DRAFT_DIR
COMMAND="cwltest --tool $1 \
--test=conformance_tests.yaml ${CLASS} ${TEST_N} \
${VERBOSE} ${TEST_L} ${TEST_J} ${ONLY_TOOLS} ${JUNIT_XML} \
--basedir ${DRAFT_DIR} -- ${EXTRA}"
if [[ $VERBOSE == "--verbose" ]]; then echo ${COMMAND}; fi
${COMMAND}
)
checkexit
}
if [[ $PLATFORM == "Linux" ]]; then
runtest "$(readlink -f $runner)"
else
runtest "$(greadlink -f $runner)"
fi
if [[ -n "$TEST_L" ]] ; then
exit 0
fi
# Final reporting
echo
if [[ $failures != 0 ]]; then
echo "$failures tool tests failed"
else
if [[ $runs == 0 ]]; then
echo >&2 "$helpmessage"
echo >&2
exit 1
else
echo "All tool tests succeeded"
fi
fi
exit $failures