[systemd-commits] 9 commits - Makefile.am test/end.service test/end.service.in test/test-functions

Harald Hoyer harald at kemper.freedesktop.org
Tue Feb 3 01:55:04 PST 2015


 Makefile.am         |    2 +-
 test/end.service    |    6 ------
 test/end.service.in |    6 ++++++
 test/test-functions |   38 ++++++++++++++++++++++++++++----------
 4 files changed, 35 insertions(+), 17 deletions(-)

New commits:
commit b6f0c419e38a960873fe68bf8f89bbb0268eed02
Author: Harald Hoyer <harald at redhat.com>
Date:   Tue Feb 3 10:43:24 2015 +0100

    test-functions: search for the initrd and kernel according to the BLS
    
    Also search for the initrd and kernel according to the boot loader
    specification.

diff --git a/test/test-functions b/test/test-functions
index 50daedc2..901ff48 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -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

commit edbced8a151c1b7ded685e2ec644950d2adec5f5
Author: Harald Hoyer <harald at redhat.com>
Date:   Tue Feb 3 10:44:27 2015 +0100

    test-functions: use sfdisk without cyl,head,sectors
    
    newer sfdisk implementations do not work with these anymore

diff --git a/test/test-functions b/test/test-functions
index 368e7a1..50daedc2 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -137,8 +137,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
 

commit 99877b7e3782a51b31bf191825f0335500f52fe5
Author: Harald Hoyer <harald at redhat.com>
Date:   Tue Feb 3 10:45:25 2015 +0100

    test-functions:install_libnss() call dracut_install with all $NSS_LIBS
    
    dracut_install() can cope with more than one file

diff --git a/test/test-functions b/test/test-functions
index b9468a4..368e7a1 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -244,9 +244,7 @@ install_debug_tools() {
 install_libnss() {
     # install libnss_files for login
     NSS_LIBS=$(LD_DEBUG=files getent passwd 2>&1 >/dev/null |sed -n '/calling init: .*libnss_/ {s!^.* /!/!; p}')
-    for l in $NSS_LIBS; do
-        dracut_install $l
-    done
+    dracut_install $NSS_LIBS
 }
 
 install_dbus() {

commit 7d023341c765c205068e33d23d63a4000ec211df
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Feb 2 00:19:33 2015 +0100

    tests: install ldconfig.real for Debian based distros
    
    In Debian based distributions ldconfig is just a shell wrapper around
    ldconfig.real, for deferring it during package installation.

diff --git a/test/test-functions b/test/test-functions
index 80e0f65..b9468a4 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -233,6 +233,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() {

commit c50a4525aa8151b180d5a325e88c5f3812e66c36
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Feb 2 00:19:32 2015 +0100

    tests: install hostname debug tool
    
    This is mostly a vehicle to pull in libnsl.so which gets dlopen()ed by NSS
    under certain NSS configurations.

diff --git a/test/test-functions b/test/test-functions
index 34af32a..80e0f65 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -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

commit cffae62bcb6912fbaf1b7b282d9d170c9d308897
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Feb 2 00:19:31 2015 +0100

    tests: install all required libnss modules
    
    Don't assume "files" for everything in nsswitch. Instead, ask "getent passwd"
    about which libnss modules it dlopen()s, and install these.

diff --git a/test/test-functions b/test/test-functions
index 42c954d..34af32a 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -241,7 +241,10 @@ 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}')
+    for l in $NSS_LIBS; do
+        dracut_install $l
+    done
 }
 
 install_dbus() {

commit 53d90f9582f96208b3674da823ad1a3d2c3b1aa4
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Feb 2 00:19:30 2015 +0100

    tests: don't hardcode systemctl path
    
    Get it from type -P instead, to support --enable-split-usr.

diff --git a/Makefile.am b/Makefile.am
index 2b980b4..14f6827 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1433,7 +1433,7 @@ EXTRA_DIST += \
 	test/c.service \
 	test/daughter.service \
 	test/d.service \
-	test/end.service \
+	test/end.service.in \
 	test/e.service \
 	test/f.service \
 	test/grandchild.service \
diff --git a/test/end.service b/test/end.service
deleted file mode 100644
index 0f04dfe..0000000
--- a/test/end.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=End the test
-After=testsuite.service
-
-[Service]
-ExecStart=/usr/bin/systemctl poweroff --no-block
diff --git a/test/end.service.in b/test/end.service.in
new file mode 100644
index 0000000..4857ffe
--- /dev/null
+++ b/test/end.service.in
@@ -0,0 +1,6 @@
+[Unit]
+Description=End the test
+After=testsuite.service
+
+[Service]
+ExecStart=@SYSTEMCTL@ poweroff --no-block
diff --git a/test/test-functions b/test/test-functions
index a0f1bf4..42c954d 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -293,7 +293,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

commit 3486cb6cfa3d32a95c0daf02c7510fdf372507bf
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Feb 2 00:19:29 2015 +0100

    tests: determine rootlibdir from pkg-config
    
    Prefer asking pkg-config for the rootlibdir, to also support systems with
    --enable-split-usr. Fall back to the hardcoded /usr/lib/systemd if that fails.

diff --git a/test/test-functions b/test/test-functions
index 91f3ecd..a0f1bf4 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -7,6 +7,11 @@ export PATH
 KERNEL_VER=${KERNEL_VER-$(uname -r)}
 KERNEL_MODS="/lib/modules/$KERNEL_VER/"
 
+if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
+    echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2
+    ROOTLIBDIR=/usr/lib/systemd
+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"
 
@@ -47,7 +52,7 @@ run_qemu() {
 systemd.log_level=debug \
 raid=noautodetect \
 loglevel=2 \
-init=/usr/lib/systemd/systemd \
+init=$ROOTLIBDIR/systemd \
 ro \
 console=ttyS0 \
 selinux=0 \
@@ -72,7 +77,7 @@ $KERNEL_APPEND \
 
 run_nspawn() {
     set -x
-    ../../systemd-nspawn --boot --directory=$TESTDIR/nspawn-root /usr/lib/systemd/systemd $KERNEL_APPEND
+    ../../systemd-nspawn --boot --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND
 }
 
 setup_basic_environment() {
@@ -240,8 +245,8 @@ install_libnss() {
 }
 
 install_dbus() {
-    inst /usr/lib/systemd/system/dbus.socket
-    inst /usr/lib/systemd/system/dbus.service
+    inst $ROOTLIBDIR/system/dbus.socket
+    inst $ROOTLIBDIR/system/dbus.service
 
     find \
         /etc/dbus-1 -xtype f \

commit 4be4833ece2856e0cacc09f8f8b2c02b320751fa
Author: Martin Pitt <martin.pitt at ubuntu.com>
Date:   Mon Feb 2 00:19:28 2015 +0100

    tests: Make sushell optional in image creation
    
    sushell does not exist in all distributions, and it can be changed with
    configure --with-debug-shell, so make installation of it optional.

diff --git a/test/test-functions b/test/test-functions
index 4fa0c59..91f3ecd 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -7,7 +7,7 @@ export PATH
 KERNEL_VER=${KERNEL_VER-$(uname -r)}
 KERNEL_MODS="/lib/modules/$KERNEL_VER/"
 
-BASICTOOLS="sh bash setsid loadkeys setfont login sushell sulogin gzip sleep echo mount umount cryptsetup date dmsetup modprobe"
+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"
 
 function find_qemu_bin() {
@@ -227,6 +227,7 @@ EOF
 
 install_basic_tools() {
     [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS
+    dracut_install -o sushell
 }
 
 install_debug_tools() {



More information about the systemd-commits mailing list