Skip to content

Commit

Permalink
Improve non-Bazel integration test output (#318)
Browse files Browse the repository at this point in the history
run_non_bazel_tests.bash now prints how many tests passed and
failed. It also prints a prefix before each message to make the
failing tests easier to find.
  • Loading branch information
jayconrod authored Mar 20, 2017
1 parent 29ee31e commit ab4855f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions tests/gc_opts_unsafe/gc_opts_unsafe.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ result=0
function check_build_fails {
local target=$1
local message=$2
bazel build "$target" 2>&1 | tee output.txt
local outfile=$(mktemp)
bazel build "$target" 2>&1 | tee "$outfile"
local target_result=${PIPESTATUS[0]}
if [ $target_result -eq 0 ]; then
echo "build of $target succeeded but should have failed" >&2
echo "wrote output to $outfile" >&2
return 1
fi
if ! grep -q "$message" output.txt; then
if ! grep -q "$message" "$outfile"; then
echo "build of $target failed for a different reason" >&2
return 1
fi
Expand Down
20 changes: 14 additions & 6 deletions tests/run_non_bazel_tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@

cd $(dirname "$0")

prefix=">>>>>>"

tests=(
gc_opts_unsafe/gc_opts_unsafe.bash
test_filter_test/test_filter_test.bash
)

result=0
passing_tests=()
failing_tests=()

for test in "${tests[@]}"; do
echo "Running $test" >&2
echo "$prefix Running $test" >&2
$test
if [ $? -ne 0 ]; then
echo "Finished $test: FAIL" >&2
result=1
echo "$prefix Finished $test: FAIL" >&2
failing_tests+=("$test")
else
echo "Finished $test: PASS" >&2
echo "$prefix Finished $test: PASS" >&2
passing_tests+=("$test")
fi
done

exit $result
echo
echo "$prefix Executed ${#tests[@]} tests: ${#passing_tests[@]} passed, ${#failing_tests[@]} failed"

[ ${#failing_tests[@]} -eq 0 ]

0 comments on commit ab4855f

Please sign in to comment.