mirror of
https://github.com/systemd/systemd.git
synced 2024-10-26 08:55:40 +03:00
ci: add some basic testing of the new --pty and --pipe switches
This commit is contained in:
parent
edd10ab29c
commit
6fb0c52295
@ -261,4 +261,14 @@ if [[ -e /usr/lib/pam.d/systemd-run0 ]] || [[ -e /etc/pam.d/systemd-run0 ]]; the
|
|||||||
assert_eq "$(run0 -D / pwd)" "/"
|
assert_eq "$(run0 -D / pwd)" "/"
|
||||||
assert_eq "$(run0 --user=testuser pwd)" "/home/testuser"
|
assert_eq "$(run0 --user=testuser pwd)" "/home/testuser"
|
||||||
assert_eq "$(run0 -D / --user=testuser pwd)" "/"
|
assert_eq "$(run0 -D / --user=testuser pwd)" "/"
|
||||||
|
|
||||||
|
# Verify that all combinations of --pty/--pipe come to the sam results
|
||||||
|
assert_eq "$(run0 echo -n foo)" "foo"
|
||||||
|
assert_eq "$(run0 --pty echo -n foo)" "foo"
|
||||||
|
assert_eq "$(run0 --pipe echo -n foo)" "foo"
|
||||||
|
assert_eq "$(run0 --pipe --pty echo -n foo)" "foo"
|
||||||
|
|
||||||
|
# Validate when we invoke run0 without a tty, that depending on --pty it either allocates a tty or not
|
||||||
|
assert_neq "$(run0 --pty tty < /dev/null)" "not a tty"
|
||||||
|
assert_eq "$(run0 --pipe tty < /dev/null)" "not a tty"
|
||||||
fi
|
fi
|
||||||
|
@ -39,6 +39,15 @@ assert_eq() {(
|
|||||||
fi
|
fi
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
assert_neq() {(
|
||||||
|
set +ex
|
||||||
|
|
||||||
|
if [[ "${1?}" = "${2?}" ]]; then
|
||||||
|
echo "FAIL: not expected: '$2' actual: '$1'" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
)}
|
||||||
|
|
||||||
assert_le() {(
|
assert_le() {(
|
||||||
set +ex
|
set +ex
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user