Skip to content

Commit

Permalink
testing: Add IGNORE_UNPRIV_USERNS_TESTS to skip tests that use userns
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Gladkov <[email protected]>
  • Loading branch information
legionus committed Jul 10, 2024
1 parent 124a819 commit beeded7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions features/overlayfs/tests/ts0001-guess-overlayfs/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash -eu

[ -z "${IGNORE_UNPRIV_USERNS_TESTS-}" ] ||
exit 127

cwd="${0%/*}"

export GUESS_SUFFIX=add:guess-root
Expand Down
3 changes: 3 additions & 0 deletions features/rootfs/tests/ts0001-guess-rootfs/run
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash -eu

[ -z "${IGNORE_UNPRIV_USERNS_TESTS-}" ] ||
exit 127

cwd="${0%/*}"

export GUESS_SUFFIX=add:guess-root
Expand Down
11 changes: 10 additions & 1 deletion testing/tests/run
Original file line number Diff line number Diff line change
Expand Up @@ -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

{
Expand All @@ -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" \
Expand Down

0 comments on commit beeded7

Please sign in to comment.