Merge pull request #50 from chriskuehl/pipefail-zombies

Fix stretch itest missing "ps" command, use pipefail to catch it earlier in the future
This commit is contained in:
Buck Evan 2016-01-07 14:58:02 -08:00
commit 87545be699
2 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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}."