Merge pull request #2783 from cgwalters/test-sudo
tests: Require OSTREE_TEST_SUDO to be set to use `sudo`
This commit is contained in:
commit
f79c7a0a0a
|
|
@ -614,6 +614,12 @@ skip_without_user_xattrs () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skip_without_sudo () {
|
||||||
|
if test -z "${OSTREE_TEST_SUDO:-}"; then
|
||||||
|
skip "this test needs sudo, skipping without OSTREE_TEST_SUDO being set"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Usage: if ! skip_one_without_whiteouts_devices; then ... more tests ...; fi
|
# Usage: if ! skip_one_without_whiteouts_devices; then ... more tests ...; fi
|
||||||
skip_one_without_whiteouts_devices() {
|
skip_one_without_whiteouts_devices() {
|
||||||
if ! can_create_whiteout_devices; then
|
if ! can_create_whiteout_devices; then
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ set -euo pipefail
|
||||||
mode="bare-split-xattrs"
|
mode="bare-split-xattrs"
|
||||||
OSTREE="${CMD_PREFIX} ostree --repo=${test_tmpdir}/repo"
|
OSTREE="${CMD_PREFIX} ostree --repo=${test_tmpdir}/repo"
|
||||||
|
|
||||||
|
skip_without_sudo
|
||||||
SUDO="sudo --non-interactive"
|
SUDO="sudo --non-interactive"
|
||||||
|
|
||||||
PRIVILEGED="false"
|
PRIVILEGED="false"
|
||||||
if [ $(id -u) -eq 0 ]; then
|
if [ $(id -u) -eq 0 ]; then
|
||||||
PRIVILEGED="true"
|
PRIVILEGED="true"
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
skip_without_sudo
|
||||||
SUDO="sudo --non-interactive"
|
SUDO="sudo --non-interactive"
|
||||||
|
|
||||||
# Skip the test if a well-known USB stick is not available.
|
# Skip the test if a well-known USB stick is not available.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue