Merge pull request #3222 from keszybz/tests-work

Some small fixes to make it easier to run tests and fix failure in TEST-{02,08}
This commit is contained in:
Lennart Poettering 2016-05-09 12:39:56 +02:00
commit 7be8fb7bfc
6 changed files with 26 additions and 7 deletions

View file

@ -96,7 +96,7 @@ _systemctl () {
local i verb comps mode
local -A OPTS=(
[STANDALONE]='--all -a --reverse --after --before --defaults --failed --force -f --full -l --global
[STANDALONE]='--all -a --reverse --after --before --defaults --force -f --full -l --global
--help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall
--quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup
--show-types -i --ignore-inhibitors --plain'

View file

@ -156,7 +156,7 @@ _systemctl_restartable_units(){
{ while read -r a b; do echo -E - " $a"; done; } )) )
}
_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --failed)"}%% *} ) }
_systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed)"}%% *} ) }
_systemctl_unit_state() { typeset -gA _sys_unit_state; _sys_unit_state=( $(__systemctl list-unit-files) ) }
local fun
@ -364,7 +364,6 @@ _arguments -s \
'--reverse[Show reverse dependencies]' \
'--after[Show units ordered after]' \
'--before[Show units ordered before]' \
'--failed[Show only failed units]' \
{-l,--full}"[Don't ellipsize unit names on output]" \
'--show-types[When showing sockets, show socket type]' \
{-i,--ignore-inhibitors}'[When executing a job, ignore jobs dependencies]' \

View file

@ -53,7 +53,7 @@ Description=Testsuite service
After=multi-user.target
[Service]
ExecStart=/bin/sh -x -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; echo OK > /testok'
Type=oneshot
EOF

View file

@ -59,7 +59,7 @@ Description=Testsuite service
After=multi-user.target
[Service]
ExecStart=/bin/sh -x -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
ExecStart=/bin/sh -x -c 'systemctl --state=failed --no-legend --no-pager > /failed ; echo OK > /testok'
Type=oneshot
EOF

View file

@ -65,6 +65,20 @@ Options=errors=remount-ro,noatime
[Install]
WantedBy=local-fs.target
Alias=root.mount
EOF
cat >$initdir/etc/systemd/system/systemd-remount-fs.service <<EOF
[Unit]
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-fsck-root.service
Before=local-fs-pre.target local-fs.target shutdown.target
Wants=local-fs-pre.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/systemctl reload /
EOF
setup_testsuite

View file

@ -64,7 +64,6 @@ run_qemu() {
find_qemu_bin || return 1
KERNEL_APPEND="root=/dev/sda1 \
systemd.log_level=debug \
raid=noautodetect \
loglevel=2 \
init=$ROOTLIBDIR/systemd \
@ -79,6 +78,7 @@ $KERNEL_APPEND \
-m 512M \
-nographic \
-kernel $KERNEL_BIN \
-drive format=raw,cache=unsafe,file=${TESTDIR}/rootdisk.img \
"
if [[ "$INITRD" && "$SKIP_INITRD" != "yes" ]]; then
@ -93,7 +93,7 @@ $KERNEL_APPEND \
QEMU_BIN="timeout --foreground $QEMU_TIMEOUT $QEMU_BIN"
fi
( set -x
$QEMU_BIN $QEMU_OPTIONS -append "$KERNEL_APPEND" $TESTDIR/rootdisk.img ) || return 1
$QEMU_BIN $QEMU_OPTIONS -append "$KERNEL_APPEND" ) || return 1
}
run_nspawn() {
@ -244,6 +244,9 @@ install_systemd() {
# we strip binaries since debug symbols increase binaries size a lot
# and it could fill the available space
strip_binaries
# enable debug logging in PID1
echo LogLevel=debug >> $initdir/etc/systemd/system.conf
}
install_missing_libraries() {
@ -415,6 +418,9 @@ install_pam() {
[[ "$LOOKS_LIKE_DEBIAN" ]] &&
cp /etc/pam.d/systemd-user $initdir/etc/pam.d/
# set empty root password for easy debugging
sed -i 's/^root:x:/root::/' $initdir/etc/passwd
}
install_keymaps() {