Skip to content

Commit 5b76705

Browse files
committed
run_test: fix & speed up self-test, add verbose mode
The `exit 1` inside the while loop only exited the loop, it didn't exit the bash script with the error condition
1 parent 566f296 commit 5b76705

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

run_test.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Options:
2525
CLASSNAME
2626
--timeout=TIMEOUT cwltest timeout in seconds.
2727
--verbose Print the cwltest invocation and pass --verbose to
28-
cwltest
28+
cwltest (or if running the "--self" check, print the
29+
schema-salad-tool invocation)
2930
--self Test CWL and test .cwl files themselves. If this flag
3031
is given, any other flags will be ignored.
3132
--badgedir=DIRNAME Specifies the directory to store JSON files for badges.
@@ -116,15 +117,13 @@ if [ -n "${SELF}" ]; then
116117
fi
117118
# This is how CWL should be written.
118119
DEFINITION=./CommonWorkflowLanguage.yml
119-
# Let's test each files
120-
find tests -type f -name "*.cwl" | \
121-
while read -r target;
122-
do
123-
schema-salad-tool ${DEFINITION} "${target}" --quiet || {
124-
echo "[INVALID] ${target}"
125-
exit 1
126-
}
127-
done
120+
QUIET=--quiet
121+
if [ "$VERBOSE" = "--verbose" ]; then
122+
QUIET=
123+
fi
124+
# Let's test all the files at once as that is faster
125+
schema-salad-tool ${QUIET} ${DEFINITION} \
126+
$(find tests -type f -name "*.cwl") || exit 1
128127
exit 0
129128
fi
130129

@@ -162,7 +161,7 @@ runtest() {
162161
if [ "$PLATFORM" = "Linux" ]; then
163162
runtest "$(readlink -f "$runner")"
164163
elif [ "$PLATFORM" = "Darwin" ]; then
165-
runtest $runner
164+
runtest "$runner"
166165
else
167166
runtest "$(greadlink -f "$runner")"
168167
fi

0 commit comments

Comments
 (0)