mirror of
https://github.com/opencontainers/runc.git
synced 2025-09-26 19:41:35 +08:00
[1.2] 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 <cyphar@cyphar.com> (Cherry-pick of commit d1f6acfab06e6f5eb15b7edfaa704f50907907b1.) Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
@@ -60,10 +60,17 @@ function runc() {
|
||||
CMDNAME="$(basename "$RUNC")" sane_run __runc "$@"
|
||||
}
|
||||
|
||||
function setup_runc_cmdline() {
|
||||
RUNC_CMDLINE=("$RUNC")
|
||||
[[ -v RUNC_USE_SYSTEMD ]] && RUNC_CMDLINE+=("--systemd-cgroup")
|
||||
[[ -n "${ROOT:-}" ]] && RUNC_CMDLINE+=("--root" "$ROOT/state")
|
||||
export RUNC_CMDLINE
|
||||
}
|
||||
|
||||
# Raw wrapper for runc.
|
||||
function __runc() {
|
||||
"$RUNC" ${RUNC_USE_SYSTEMD+--systemd-cgroup} \
|
||||
${ROOT:+--root "$ROOT/state"} "$@"
|
||||
setup_runc_cmdline
|
||||
"${RUNC_CMDLINE[@]}" "$@"
|
||||
}
|
||||
|
||||
# Wrapper for runc spec.
|
||||
|
Reference in New Issue
Block a user