test: move TEST-43-* setup to static files
Setup of lingering is dropped. I don't think it's necessary for anything, because the unit is still pulled in from the testsuite service.
This commit is contained in:
parent
bdfd515ad1
commit
d0ac89a1e8
|
@ -11,39 +11,11 @@ test_setup() {
|
|||
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
|
||||
|
||||
setup_basic_environment
|
||||
inst_binary stat
|
||||
|
||||
mask_supporting_services
|
||||
|
||||
# Allocate user for running test case under
|
||||
mkdir -p $initdir/etc/sysusers.d
|
||||
cat >$initdir/etc/sysusers.d/testuser.conf <<EOF
|
||||
u testuser 4711 "Test User" /home/testuser
|
||||
EOF
|
||||
|
||||
mkdir -p $initdir/home/testuser -m 0700
|
||||
chown 4711:4711 $initdir/home/testuser
|
||||
|
||||
enable_user_manager testuser
|
||||
|
||||
# setup the testsuite service
|
||||
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
|
||||
[Unit]
|
||||
Description=Testsuite service
|
||||
After=systemd-logind.service user@4711.service
|
||||
Wants=user@4711.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/testsuite.sh
|
||||
Type=oneshot
|
||||
EOF
|
||||
cp testsuite.sh $initdir/
|
||||
|
||||
setup_testsuite
|
||||
)
|
||||
setup_nspawn_root
|
||||
}
|
||||
|
||||
has_user_dbus_socket || exit 0
|
||||
|
||||
do_test "$@"
|
||||
do_test "$@" 43
|
||||
|
|
|
@ -89,6 +89,7 @@ BASICTOOLS=(
|
|||
sleep
|
||||
socat
|
||||
stat
|
||||
su
|
||||
sulogin
|
||||
sysctl
|
||||
tail
|
||||
|
@ -417,6 +418,8 @@ setup_basic_environment() {
|
|||
install_plymouth
|
||||
install_debug_tools
|
||||
install_ld_so_conf
|
||||
install_testuser
|
||||
has_user_dbus_socket && install_user_dbus
|
||||
setup_selinux
|
||||
strip_binaries
|
||||
install_depmod_files
|
||||
|
@ -825,6 +828,17 @@ install_ld_so_conf() {
|
|||
ldconfig -r "$initdir"
|
||||
}
|
||||
|
||||
install_testuser() {
|
||||
# create unprivileged user for user manager tests
|
||||
mkdir -p $initdir/etc/sysusers.d
|
||||
cat >$initdir/etc/sysusers.d/testuser.conf <<EOF
|
||||
u testuser 4711 "Test User" /home/testuser
|
||||
EOF
|
||||
|
||||
mkdir -p $initdir/home/testuser -m 0700
|
||||
chown 4711:4711 $initdir/home/testuser
|
||||
}
|
||||
|
||||
install_config_files() {
|
||||
inst /etc/sysconfig/init || :
|
||||
inst /etc/passwd
|
||||
|
@ -1034,19 +1048,6 @@ has_user_dbus_socket() {
|
|||
fi
|
||||
}
|
||||
|
||||
enable_user_manager() {
|
||||
has_user_dbus_socket || return 0
|
||||
|
||||
local _userid
|
||||
[[ $# -gt 0 ]] || set -- nobody
|
||||
mkdir -p "$initdir/var/lib/systemd/linger"
|
||||
for _userid; do
|
||||
touch "$initdir/var/lib/systemd/linger/$_userid"
|
||||
done
|
||||
dracut_install su
|
||||
install_user_dbus
|
||||
}
|
||||
|
||||
setup_nspawn_root() {
|
||||
rm -fr $TESTDIR/nspawn-root
|
||||
ddebug "cp -ar $initdir $TESTDIR/nspawn-root"
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=TEST-43-PRIVATEUSER-UNPRIV
|
||||
After=systemd-logind.service user@4711.service
|
||||
Wants=user@4711.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||
Type=oneshot
|
Loading…
Reference in New Issue