Skip to content

Commit

Permalink
Fix incorrect suppression of compiler errors in cirque tests. (#3317)
Browse files Browse the repository at this point in the history
ninja sends all output, including compiler errors, to stdout, not
stderr.  So redirecting to /dev/null was hiding compiler errors and
making it very difficult to debug test failures.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 27, 2020
1 parent 602cc76 commit 9cd693d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/test_driver/linux-cirque/OnOffClusterTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function build_chip_tool() {
set -x
cd "$chip_tool_dir"
gn gen out/debug >/dev/null
ninja -C out/debug >/dev/null
run_ninja -C out/debug
docker build -t chip_tool -f Dockerfile . >/dev/null 2>&1
}

Expand All @@ -40,7 +40,7 @@ function build_chip_lighting() {
set -x
cd "$chip_light_dir"
gn gen out/debug --args='bypass_rendezvous=true' >/dev/null
ninja -C out/debug >/dev/null
run_ninja -C out/debug
docker build -t chip_server -f Dockerfile . >/dev/null 2>&1
set +x
}
Expand All @@ -53,4 +53,5 @@ function main() {
python3 "$SOURCE_DIR/test-on-off-cluster.py"
}

source "$SOURCE_DIR"/shell-helpers.sh
main
11 changes: 11 additions & 0 deletions src/test_driver/linux-cirque/shell-helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# This function is a workaround for the fact that ninja sends all
# output, including compiler errors, to stdout, not stderr. We want
# to suppress the various output from ninja itself, but not compiler
# errors. Do that by prefixing the ninja output with a string that is
# unlikely to appear in compiler errors, then filtering it out.
function run_ninja() {
prefix="|ninja_filter_prefix|"
NINJA_STATUS="$prefix[%f/%t] " ninja "$@" | grep -v "^$prefix"
}

0 comments on commit 9cd693d

Please sign in to comment.