diff --git a/test/buildah-bud/buildah-tests.diff b/test/buildah-bud/buildah-tests.diff index 5db2ca4cf7..dca77b2727 100644 --- a/test/buildah-bud/buildah-tests.diff +++ b/test/buildah-bud/buildah-tests.diff @@ -1,4 +1,4 @@ -From 53c97f858285ff043b4121988433f2312482eba9 Mon Sep 17 00:00:00 2001 +From 13c82f9d6c18eafd3ff86140125ffeaab3ce75fb Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 6 Oct 2022 17:32:59 -0600 Subject: [PATCH] tweaks for running buildah tests under podman @@ -12,10 +12,10 @@ Signed-off-by: Lokesh Mandvekar 1 file changed, 162 insertions(+), 4 deletions(-) diff --git a/tests/helpers.bash b/tests/helpers.bash -index 5ba4f5a..6a41f10 100644 +index 7a64d8345..4cd544324 100644 --- a/tests/helpers.bash +++ b/tests/helpers.bash -@@ -86,6 +86,42 @@ EOF +@@ -89,6 +89,42 @@ EOF BUILDAH_REGISTRY_OPTS="${regconfopt} ${regconfdir} --short-name-alias-conf ${TEST_SCRATCH_DIR}/cache/shortnames.conf" COPY_REGISTRY_OPTS="${BUILDAH_REGISTRY_OPTS}" PODMAN_REGISTRY_OPTS="${regconfopt}" @@ -56,12 +56,12 @@ index 5ba4f5a..6a41f10 100644 + die "podman server never came up: $PODMAN_SOCK_FILE" + fi } - + function starthttpd() { # directoryspecs [working-directory-or-"" [certfile, keyfile]] -@@ -155,6 +191,22 @@ function teardown_tests() { +@@ -154,6 +190,22 @@ function teardown_tests() { stop_git_daemon stop_registry - + + if [[ -n "$PODMAN_SERVER_PID" ]]; then + echo "teardown: stopping podman server $PODMAN_SERVER_PID" + kill $PODMAN_SERVER_PID @@ -81,9 +81,9 @@ index 5ba4f5a..6a41f10 100644 # Workaround for #1991 - buildah + overlayfs leaks mount points. # Many tests leave behind /var/tmp/.../root/overlay and sub-mounts; # let's find those and clean them up, otherwise 'rm -rf' fails. -@@ -276,7 +328,12 @@ function copy() { +@@ -275,7 +327,12 @@ function copy() { } - + function podman() { - command ${PODMAN_BINARY:-podman} ${PODMAN_REGISTRY_OPTS} ${ROOTDIR_OPTS} "$@" + local cmd=${PODMAN_BINARY:-podman} @@ -93,12 +93,12 @@ index 5ba4f5a..6a41f10 100644 + fi + command $cmd $opts "$@" } - + # There are various scenarios where we would like to execute `tests` as rootless user, however certain commands like `buildah mount` -@@ -383,8 +440,86 @@ function run_buildah() { +@@ -382,15 +439,93 @@ function run_buildah() { --retry) retry=3; shift;; # retry network flakes esac - + + local podman_or_buildah=${BUILDAH_BINARY} + local _opts="${ROOTDIR_OPTS} ${BUILDAH_REGISTRY_OPTS}" + local copydown=: @@ -180,12 +180,10 @@ index 5ba4f5a..6a41f10 100644 # Remember command args, for possible use in later diagnostic messages - MOST_RECENT_BUILDAH_COMMAND="buildah $*" + MOST_RECENT_BUILDAH_COMMAND="$cmd_basename $*" - - # If session is rootless and `buildah mount` is invoked, perform unshare, - # since normal user cannot mount a filesystem unless they're in a user namespace along with its own mount namespace. -@@ -398,8 +533,8 @@ function run_buildah() { + + while [ $retry -gt 0 ]; do retry=$(( retry - 1 )) - + # stdout is only emitted upon error; this echo is to help a debugger - echo "${_LOG_PROMPT} ${BUILDAH_BINARY} $*" - run env CONTAINERS_CONF=${CONTAINERS_CONF:-$(dirname ${BASH_SOURCE})/containers.conf} timeout --foreground --kill=10 $BUILDAH_TIMEOUT ${BUILDAH_BINARY} ${BUILDAH_REGISTRY_OPTS} ${ROOTDIR_OPTS} "$@" @@ -194,20 +192,20 @@ index 5ba4f5a..6a41f10 100644 # without "quotes", multiple lines are glommed together into one if [ -n "$output" ]; then echo "$output" -@@ -426,6 +561,9 @@ function run_buildah() { +@@ -417,6 +552,9 @@ function run_buildah() { false fi - + + if [[ "$status" -eq 0 ]] ; then + eval ${copydown} + fi if [ -n "$expected_rc" ]; then if [ "$status" -eq "$expected_rc" ]; then return -@@ -772,6 +910,26 @@ function skip_unless_arch() { +@@ -794,6 +932,26 @@ function skip_unless_arch() { skip "test requires one of these architectures: $* (current: $goarch)" } - + +#################### +# skip_if_remote # (only applicable for podman) +#################### @@ -232,5 +230,5 @@ index 5ba4f5a..6a41f10 100644 # start_git_daemon # ###################### -- -2.53.0 +2.55.0