chiark / gitweb /
man: add sd_event_{run,wait,prepare,dispatch,loop}
[elogind.git] / test / test-functions
index a0f1bf4eb2a3ca27bedc591cd68c58b4e9aeb68a..901ff4860541db194a73ff703e10f9840b55f7d0 100644 (file)
@@ -13,7 +13,7 @@ if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
 fi
 
 BASICTOOLS="sh bash setsid loadkeys setfont login sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe"
-DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
+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"
 
 function find_qemu_bin() {
     # SUSE and Red Hat call the binary qemu-kvm
@@ -42,6 +42,14 @@ function find_qemu_bin() {
 }
 
 run_qemu() {
+    if [ -f /etc/machine-id ]; then
+        read MACHINE_ID < /etc/machine-id
+        [ -z "$INITRD" ] && [ -e "/boot/$MACHINE_ID/$KERNEL_VER/initrd" ] \
+            && INITRD="/boot/$MACHINE_ID/$KERNEL_VER/initrd"
+        [ -z "$KERNEL_BIN" ] && [ -e "/boot/$MACHINE_ID/$KERNEL_VER/linux" ] \
+            && KERNEL_BIN="/boot/$MACHINE_ID/$KERNEL_VER/linux"
+    fi
+
     [ "$KERNEL_BIN" ] || KERNEL_BIN=/boot/vmlinuz-$KERNEL_VER
     [ "$INITRD" ]     || INITRD=/boot/initramfs-${KERNEL_VER}.img
     [ "$QEMU_SMP" ]   || QEMU_SMP=1
@@ -137,8 +145,8 @@ create_empty_image() {
     LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
     [ -b "$LOOPDEV" ] || return 1
     echo "LOOPDEV=$LOOPDEV" >> $STATEFILE
-    sfdisk -C 9600 -H 2 -S 32 -L "$LOOPDEV" <<EOF
-,4800
+    sfdisk "$LOOPDEV" <<EOF
+,290M
 ,
 EOF
 
@@ -233,6 +241,8 @@ EOF
 install_basic_tools() {
     [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS
     dracut_install -o sushell
+    # in Debian ldconfig is just a shell script wrapper around ldconfig.real
+    dracut_install -o ldconfig.real
 }
 
 install_debug_tools() {
@@ -241,7 +251,8 @@ install_debug_tools() {
 
 install_libnss() {
     # install libnss_files for login
-    inst_libdir_file "libnss_files*"
+    NSS_LIBS=$(LD_DEBUG=files getent passwd 2>&1 >/dev/null |sed -n '/calling init: .*libnss_/ {s!^.* /!/!; p}')
+    dracut_install $NSS_LIBS
 }
 
 install_dbus() {
@@ -293,7 +304,8 @@ install_terminfo() {
 }
 
 setup_testsuite() {
-    cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+    cp $TEST_BASE_DIR/testsuite.target $initdir/etc/systemd/system/
+    sed "s#@SYSTEMCTL@#$(type -P systemctl)#g" $TEST_BASE_DIR/end.service.in > $initdir/etc/systemd/system/end.service
 
     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