-
Notifications
You must be signed in to change notification settings - Fork 29
/
run-tests
executable file
·38 lines (33 loc) · 1.69 KB
/
run-tests
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
#!/bin/bash
# HOW TO USE: This is a wrapper around busted. Pass "gc" as the first argument for testing the
# garbage collector. Except for "gc", the command-line arguments are the same of busted
#
# EXAMPLES:
# ./run-tests
# ./run-tests -k
# ./run-tests spec/coder_spec.lua
echo "--- Test Suite ---"
# We encourage using -no-keep-going by default. Sometimes the test suite is failing because of
# something silly such as forgetting to run make and in those cases there is a desire to interrupt
# the test suite with Ctrl-C. With --keep-going (the default busted behavior) you need to press
# Ctrl-C multiple times and one of those Ctrl-C's will likely kill the busted process itself,
# meaning that the "teardown" routines are not run. On the other hand, with --no-keep-going we only
# need to press Ctrl-C once and busted usually gets to exit gracefully.
FLAGS=(--verbose --no-keep-going)
# To speed things up, we tell the C compiler to skip optimizations. (It's OK, the CI still uses -O2)
# Also, add some compiler flags to verify standard compliance.
export CFLAGS="-O0 -std=c99 -Wall -Werror -Wundef -Wno-unused $EXTRACFLAGS"
if [ "$#" -eq 0 ]; then
if command -v parallel >/dev/null; then
parallel busted -o utfTerminal "${FLAGS[@]}" ::: spec/*_spec.lua
else
echo "GNU Parallel is not installed. Running the test suite in single threaded mode..."
busted "${FLAGS[@]}"
fi
# By default, also run the linter because the CI cares about that.
./run-lint --quiet
else
# If we are running tests for a single spec file, then we do not use GNU Parallel. This way the
# progress updates after each test, instead of all at once at end.
busted "${FLAGS[@]}" "$@"
fi