PATH_TO_INIT=$ROOTLIBDIR/systemd
-BASICTOOLS="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs"
-DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find"
+BASICTOOLS="test sh bash setsid loadkeys setfont login sulogin gzip sleep echo head tail cat mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs"
+DEBUGTOOLS="df free ls stty ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find vi mv"
STATEDIR="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))"
STATEFILE="$STATEDIR/.testdir"
# SUSE and Red Hat call the binary qemu-kvm. Debian and Gentoo call it kvm.
# Either way, only use this version if we aren't running in KVM, because
# nested KVM is flaky still.
- if [ `systemd-detect-virt -v` != kvm ] ; then
+ if [[ $(systemd-detect-virt -v) != kvm && -z $TEST_NO_KVM ]] ; then
[ "$QEMU_BIN" ] || QEMU_BIN=$(which -a kvm qemu-kvm 2>/dev/null | grep '^/' -m1)
fi
fi
fi
- [ "$QEMU_SMP" ] || QEMU_SMP=1
+ # If QEMU_SMP was not explicitly set, try to determine the value 'dynamically'
+ # i.e. use the number of online CPUs on the host machine. If the nproc utility
+ # is not installed or there's some other error when calling it, fall back
+ # to the original value (QEMU_SMP=1).
+ if ! [ "$QEMU_SMP" ]; then
+ if ! QEMU_SMP=$(nproc); then
+ dwarn "nproc utility is not installed, falling back to QEMU_SMP=1"
+ QEMU_SMP=1
+ fi
+ fi
find_qemu_bin || return 1
if [[ "$LOOKS_LIKE_SUSE" ]]; then
PARAMS+="rd.hostonly=0"
+elif [[ "$LOOKS_LIKE_ARCH" ]]; then
+ PARAMS+="rw"
else
PARAMS+="ro"
fi
fi
# Let's use KVM if it is available, but let's avoid using nested KVM as that is still flaky
- if [ -c /dev/kvm -a `systemd-detect-virt -v` != kvm ]; then
+ if [[ -c /dev/kvm && $(systemd-detect-virt -v) != kvm && -z $TEST_NO_KVM ]] ; then
QEMU_OPTIONS="$QEMU_OPTIONS -machine accel=kvm -enable-kvm -cpu host"
fi
[ -b "$LOOPDEV" ] || return 1
echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
sfdisk "$LOOPDEV" <<EOF
-,$((_size-10))M
+,$((_size-50))M
,
EOF
"dbus-daemon" => undef,
);
}
- print $2 if /\s(\S*)\[(\d+)\]:\s*SUMMARY:\s+\w+Sanitizer/ && !exists $services_to_ignore{$1}'
+ print $2 if /\s(\S*)\[(\d+)\]:\s*SUMMARY:\s+\w+Sanitizer/ && !exists $services_to_ignore{$1}'
)
if [[ ! -z "$pids" ]]; then
ret=$(($ret+1))
install_debug_tools() {
[[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
+
+ if [[ $INTERACTIVE_DEBUG ]]; then
+ # Set default TERM from vt220 to linux, so at least basic key shortcuts work
+ local _getty_override="$initdir/etc/systemd/system/serial-getty@.service.d"
+ mkdir -p "$_getty_override"
+ echo -e "[Service]\nEnvironment=TERM=linux" > "$_getty_override/default-TERM.conf"
+
+ cat > "$initdir/etc/motd" << EOF
+To adjust the terminal size use:
+ export COLUMNS=xx
+ export LINES=yy
+or
+ stty cols xx rows yy
+EOF
+ fi
}
install_libnss() {
else
inst $ROOTLIBDIR/system/dbus.service
fi
+ # Newer Fedora versions use dbus-broker by default. Let's install it is available.
+ [ -f /usr/bin/dbus-broker ] && inst /usr/bin/dbus-broker
+ [ -f /usr/bin/dbus-broker-launch ] && inst /usr/bin/dbus-broker-launch
find \
/etc/dbus-1 /usr/share/dbus-1 -xtype f \
mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
- ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
+ # Don't shutdown the machine after running the test when INTERACTIVE_DEBUG is set
+ [[ -z $INTERACTIVE_DEBUG ]] && ln -fs $TEST_BASE_DIR/end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
# make the testsuite the default target
ln -fs testsuite.target $initdir/etc/systemd/system/default.target
import_testdir() {
[[ -e $STATEFILE ]] && . $STATEFILE
- if [[ -z "$TESTDIR" ]] || [[ ! -d "$TESTDIR" ]]; then
- TESTDIR=$(mktemp --tmpdir=/var/tmp -d -t systemd-test.XXXXXX)
+ if [[ ! -d "$TESTDIR" ]]; then
+ if [[ -z "$TESTDIR" ]]; then
+ TESTDIR=$(mktemp --tmpdir=/var/tmp -d -t systemd-test.XXXXXX)
+ else
+ mkdir -p "$TESTDIR"
+ fi
+
echo "TESTDIR=\"$TESTDIR\"" > $STATEFILE
export TESTDIR
fi