From 4b37e64a1a10b5e02c4154b398bfc921d7e7fff1 Mon Sep 17 00:00:00 2001 From: Chris Kuehl Date: Thu, 7 Jan 2016 14:30:09 -0800 Subject: [PATCH] Set pipefail for test-zombies to not mask errors --- Makefile | 2 +- tests/test-zombies | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f09c756..bc1f030 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tests/test-zombies b/tests/test-zombies index 8471d33..653f9e7 100755 --- a/tests/test-zombies +++ b/tests/test-zombies @@ -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}."