1
1
#! /bin/bash
2
2
3
- read -rd " \000" helpmessage << EOF
4
- $( basename $0 ) : Run common workflow tool description language conformance tests.
3
+ func () {
4
+ helpmessage=$( cat)
5
+ }
6
+ func << EOF
7
+ $( basename " $0 " ) : Run common workflow tool description language conformance tests.
5
8
6
9
Syntax:
7
- $( basename $0 ) [RUNNER=/path/to/cwl-runner]
10
+ $( basename " $0 " ) [RUNNER=/path/to/cwl-runner]
8
11
[EXTRA=--optional-arguments-to-cwl-runner]
9
12
10
13
Options:
@@ -17,24 +20,33 @@ Options:
17
20
FILENAME
18
21
--classname=CLASSNAME In the JUnit XML, tag the results with the given
19
22
CLASSNAME
23
+ --timeout=TIMEOUT cwltest timeout in seconds.
20
24
--verbose Print the cwltest invocation and pass --verbose to
21
25
cwltest
26
+ --self Test CWL and test .cwl files themselves. If this flag
27
+ is given, any other flags will be ignored.
28
+ --badgedir=DIRNAME Specifies the directory to store JSON files for badges.
29
+ --tags TAGS Tags to be tested
22
30
23
31
Note:
24
32
EXTRA is useful for passing --enable-dev to the CWL reference runner:
25
33
Example: RUNNER=cwltool EXTRA=--enable-dev
26
34
EOF
27
35
36
+ CWL_VER=v1.2
28
37
TEST_N=" "
29
38
JUNIT_XML=" "
30
39
RUNNER=cwl-runner
31
40
PLATFORM=$( uname -s)
32
- COVERAGE=" python"
33
41
EXTRA=" "
34
42
CLASS=" "
35
43
VERBOSE=" "
44
+ SELF=" "
45
+ BADGE=" "
46
+ TIMEOUT=" "
47
+ TAGS=" "
36
48
37
- while [[ -n " $1 " ] ]
49
+ while [ -n " $1 " ]
38
50
do
39
51
arg=" $1 " ; shift
40
52
case " $arg " in
64
76
--verbose)
65
77
VERBOSE=$arg
66
78
;;
79
+ --self)
80
+ SELF=1
81
+ ;;
82
+ --badgedir=* )
83
+ BADGE=$arg
84
+ ;;
85
+ --timeout=* )
86
+ TIMEOUT=$arg
87
+ ;;
88
+ --tags=* )
89
+ TAGS=$arg
90
+ ;;
67
91
* =* )
68
- eval $( echo $arg | cut -d= -f1) =\" $( echo $arg | cut -d= -f2-) \"
92
+ eval " $( echo " $arg " | cut -d= -f1) " =\" " $( echo " $arg " | cut -d= -f2-) " \"
69
93
;;
70
94
esac
71
95
done
72
96
73
- if ! runner=" $( which $RUNNER ) " ; then
97
+ if [ -n " ${SELF} " ]; then
98
+ # Ensure schema-salad-tool command
99
+ if [ ! -x " $( command -v schema-salad-tool) " ]; then
100
+ pip install --quiet schema_salad
101
+ fi
102
+ # This is how CWL should be written.
103
+ DEFINITION=./CommonWorkflowLanguage.yml
104
+ # Let's test each files
105
+ find tests -type f -name " *.cwl" | \
106
+ while read -r target;
107
+ do
108
+ schema-salad-tool ${DEFINITION} " ${target} " --quiet || {
109
+ echo " [INVALID] ${target} "
110
+ exit 1
111
+ }
112
+ done
113
+ exit 0
114
+ fi
115
+
116
+ if ! runner=" $( command -v $RUNNER ) " ; then
74
117
echo >&2 " $helpmessage "
75
118
echo >&2
76
119
echo >&2 " runner '$RUNNER ' not found"
80
123
runs=0
81
124
failures=0
82
125
83
- checkexit () {
84
- if [[ " $? " != " 0" ]]; then
85
- failures=$(( failures+ 1 ))
86
- fi
87
- }
88
-
89
126
runtest () {
90
- echo " --- Running CWL Conformance Tests on $1 ---"
127
+ echo " --- Running CWL Conformance Tests $CWL_VER on $1 ---"
91
128
92
129
" $1 " --version
93
130
94
131
runs=$(( runs+ 1 ))
95
132
(COMMAND=" cwltest --tool $1 \
96
- --test=conformance_tests.yaml ${CLASS} ${TEST_N} \
97
- ${VERBOSE} ${TEST_L} ${TEST_J} ${ONLY_TOOLS} ${JUNIT_XML} \
98
- -- ${EXTRA} "
99
- if [[ $VERBOSE == " --verbose" ]] ; then echo ${COMMAND} ; fi
133
+ --test=conformance_tests.yaml ${CLASS} ${TEST_N} \
134
+ ${VERBOSE} ${TEST_L} ${TEST_J} ${ONLY_TOOLS} ${JUNIT_XML} \
135
+ ${TIMEOUT} ${BADGE} ${TAGS} -- ${EXTRA} "
136
+ if [ " $VERBOSE " = " --verbose" ]; then echo " ${COMMAND} " ; fi
100
137
${COMMAND}
101
- )
102
- checkexit
138
+ ) || failures=$(( failures+ 1 ))
103
139
}
104
140
105
- if [[ $PLATFORM == " Linux" ] ]; then
106
- runtest " $( readlink -f $runner ) "
141
+ if [ " $PLATFORM " = " Linux" ]; then
142
+ runtest " $( readlink -f " $runner " ) "
107
143
else
108
- runtest " $( greadlink -f $runner ) "
144
+ runtest " $( greadlink -f " $runner " ) "
109
145
fi
110
146
111
- if [[ -n " $TEST_L " ] ] ; then
147
+ if [ -n " $TEST_L " ] ; then
112
148
exit 0
113
149
fi
114
150
115
151
# Final reporting
116
152
117
153
echo
118
154
155
+ if [ $failures != 0 ]; then
156
+ echo " $failures tool tests failed"
157
+ else
158
+ if [ $runs = 0 ]; then
159
+ echo >&2 " $helpmessage "
160
+ echo >&2
161
+ exit 1
162
+ else
163
+ echo " All tool tests succeeded"
164
+ fi
165
+ fi
166
+
119
167
exit $failures
0 commit comments