From beeded770220adfb6721d0ec5de80d9edd1a82c3 Mon Sep 17 00:00:00 2001 From: Alexey Gladkov Date: Wed, 10 Jul 2024 13:00:23 +0200 Subject: [PATCH] testing: Add IGNORE_UNPRIV_USERNS_TESTS to skip tests that use userns Signed-off-by: Alexey Gladkov --- features/overlayfs/tests/ts0001-guess-overlayfs/run | 3 +++ features/rootfs/tests/ts0001-guess-rootfs/run | 3 +++ testing/tests/run | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/features/overlayfs/tests/ts0001-guess-overlayfs/run b/features/overlayfs/tests/ts0001-guess-overlayfs/run index 8c8fb4d6..4e227b69 100755 --- a/features/overlayfs/tests/ts0001-guess-overlayfs/run +++ b/features/overlayfs/tests/ts0001-guess-overlayfs/run @@ -1,5 +1,8 @@ #!/bin/bash -eu +[ -z "${IGNORE_UNPRIV_USERNS_TESTS-}" ] || + exit 127 + cwd="${0%/*}" export GUESS_SUFFIX=add:guess-root diff --git a/features/rootfs/tests/ts0001-guess-rootfs/run b/features/rootfs/tests/ts0001-guess-rootfs/run index 94554b3c..7d2bb821 100755 --- a/features/rootfs/tests/ts0001-guess-rootfs/run +++ b/features/rootfs/tests/ts0001-guess-rootfs/run @@ -1,5 +1,8 @@ #!/bin/bash -eu +[ -z "${IGNORE_UNPRIV_USERNS_TESTS-}" ] || + exit 127 + cwd="${0%/*}" export GUESS_SUFFIX=add:guess-root diff --git a/testing/tests/run b/testing/tests/run index 2b706b9f..b407113c 100755 --- a/testing/tests/run +++ b/testing/tests/run @@ -29,7 +29,7 @@ for testsuite in "$@"; do num="$(printf '%4s' "$i")" i=$(( $i + 1 )) - echo "[$num/$max] ${ts##*/}" + echo -n "[$num/$max] ${ts##*/} " fi { @@ -38,6 +38,15 @@ for testsuite in "$@"; do echo "rc=$rc"; } > "$ts"/output 2>&1 + if [ "$rc" = 127 ]; then + [ -z "${VERBOSE:-${V:-}}" ] || + echo "[skipped]" + rm -f -- "$ts"/output + continue + fi + [ -z "${VERBOSE:-${V:-}}" ] || + echo + [ ! -f "$ts"/expect.in ] || sed \ -e "s#@ts@#${ts##*/}#g" \