Skip to content

Commit

Permalink
Merge pull request #50 from chriskuehl/pipefail-zombies
Browse files Browse the repository at this point in the history
Fix stretch itest missing "ps" command, use pipefail to catch it earlier in the future
  • Loading branch information
Buck Evan committed Jan 7, 2016
2 parents fec8e68 + 4b37e64 commit 87545be
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 -s -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 87545be

Please sign in to comment.