Skip to content

Commit

Permalink
Set pipefail for test-zombies to not mask errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskuehl committed Jan 7, 2016
1 parent ffaa420 commit 4b37e64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS=-std=gnu99 -static -Wall -Werror -O3

TEST_PACKAGE_DEPS := python python-pip
TEST_PACKAGE_DEPS := python python-pip procps

DOCKER_RUN_TEST := docker run -v $(PWD):/mnt:ro

Expand Down
3 changes: 2 additions & 1 deletion tests/test-zombies
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
# We run it as the last step of the integration tests inside our Docker
# containers. Since dumb-init must run as PID 1, we don't use pytest and
# instead write it in bash (which gets executed by PID1 dumb-init).
set -o pipefail

bash -euxc "bash -euxc 'echo i am a zombie' &" &

sleep 1
num_zombies=$(ps -A -o state | grep 'Z' | wc -l)
num_zombies=$(ps -A -o state | (grep 'Z' || true) | wc -l)

if [ "$num_zombies" -ne 0 ]; then
echo "Expected no zombies, but instead there were ${num_zombies}."
Expand Down

0 comments on commit 4b37e64

Please sign in to comment.