From ffaf67f1f8dd163551a3f720787ccdc523c8004c Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Thu, 12 Feb 2026 11:51:48 +0100 Subject: [PATCH] Suppress stderr from expected-failure commands Cleanup commands in prepare-testmachine-chroot (fuser, umount) may fail when there is nothing to kill or unmount, producing confusing error output in Jenkins logs. Redirect their output to /dev/null, matching the pattern already used in test-on-testmachine lines 94 and 96. Also suppress stdout/stderr from ps|grep process checks in test-on-testmachine that look for known benign processes (minilogd, gpg-agent). We only care about the exit code, not the output, so use grep -q and redirect ps stderr. Ticket: ENT-12619 Signed-off-by: Lars Erik Wik Co-Authored-By: Claude Opus 4.6 --- build-scripts/prepare-testmachine-chroot | 4 ++-- build-scripts/test-on-testmachine | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build-scripts/prepare-testmachine-chroot b/build-scripts/prepare-testmachine-chroot index 4b1ebbe85..dbdbb3d71 100755 --- a/build-scripts/prepare-testmachine-chroot +++ b/build-scripts/prepare-testmachine-chroot @@ -21,9 +21,9 @@ CHROOT_ROOT=$HOME/testmachine-chroot/ sudo mkdir -p "$CHROOT_ROOT" # Clean up previous chroot state by killing any processes that are using the CHROOT_ROOT directory. -sudo "$FUSER" -k "$CHROOT_ROOT" || true +sudo "$FUSER" -k "$CHROOT_ROOT" >/dev/null 2>&1 || true # Unmount the /proc filesystem if it was previously mounted inside the chroot. -sudo umount "${CHROOT_ROOT}proc" || true +sudo umount "${CHROOT_ROOT}proc" >/dev/null 2>&1 || true # Tell rsync not to touch the BASEDIR and PREFIX directories echo "P $BASEDIR" >"$TRANSFER_SCRIPT" diff --git a/build-scripts/test-on-testmachine b/build-scripts/test-on-testmachine index d1e37643a..31ebb0ea5 100755 --- a/build-scripts/test-on-testmachine +++ b/build-scripts/test-on-testmachine @@ -51,7 +51,7 @@ chroot) # Minilogd may sometimes launch on RedHat without any user # intervention. Ignore that. # shellcheck disable=SC2009 - if ps -ef | grep -E "^ *[^ ]+ +$pid" | grep minilogd; then + if ps -ef 2>/dev/null | grep -E "^ *[^ ]+ +$pid" | grep -q minilogd; then continue fi ;; @@ -59,7 +59,7 @@ chroot) # gpg-agent sometimes is spawned on suse during our tests. # This happens only in chroot. Ignore that. - if ps -o command --pid "$pid" | grep "gpg-agent --homedir /var/tmp/zypp.*zypp-trusted.*--daemon"; then + if ps -o command --pid "$pid" 2>/dev/null | grep -q "gpg-agent --homedir /var/tmp/zypp.*zypp-trusted.*--daemon"; then continue fi ;; @@ -67,7 +67,7 @@ chroot) # gpg-agent sometimes is spawned on Ubuntu 24 during our tests. # This happens only in chroot. Ignore that. if [ "$OS_VERSION_MAJOR" = "24" ]; then - if ps -o command --pid "$pid" | grep "gpg-agent --homedir /etc/apt/sources.list.d/.gnupg-temp --use-standard-socket --daemon"; then + if ps -o command --pid "$pid" 2>/dev/null | grep -q "gpg-agent --homedir /etc/apt/sources.list.d/.gnupg-temp --use-standard-socket --daemon"; then continue fi fi