Skip to content

Commit ae7eefd

Browse files
committed
[1.3] tests: add RUNC_CMDLINE for tests incompatible with functions
Sometimes we need to run runc through some wrapper (like nohup), but because "__runc" and "runc" are bash functions in our test suite this doesn't work trivially -- and you cannot just pass "$RUNC" because you you need to set --root for rootless tests. So create a setup_runc_cmdline helper which sets $RUNC_CMDLINE to the beginning cmdline used by __runc (and switch __runc to use that). Signed-off-by: Aleksa Sarai <[email protected]> (Cherry-pick of commit d1f6acf.) Signed-off-by: Aleksa Sarai <[email protected]>
1 parent c0ba3d6 commit ae7eefd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/integration/helpers.bash

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,17 @@ function runc() {
5757
CMDNAME="$(basename "$RUNC")" sane_run __runc "$@"
5858
}
5959

60+
function setup_runc_cmdline() {
61+
RUNC_CMDLINE=("$RUNC")
62+
[[ -v RUNC_USE_SYSTEMD ]] && RUNC_CMDLINE+=("--systemd-cgroup")
63+
[[ -n "${ROOT:-}" ]] && RUNC_CMDLINE+=("--root" "$ROOT/state")
64+
export RUNC_CMDLINE
65+
}
66+
6067
# Raw wrapper for runc.
6168
function __runc() {
62-
"$RUNC" ${RUNC_USE_SYSTEMD+--systemd-cgroup} \
63-
${ROOT:+--root "$ROOT/state"} "$@"
69+
setup_runc_cmdline
70+
"${RUNC_CMDLINE[@]}" "$@"
6471
}
6572

6673
# Wrapper for runc spec.

0 commit comments

Comments
 (0)