chiark / gitweb /
test/TEST-01-BASIC: add a defined rc.local
[elogind.git] / test / TEST-01-BASIC / test.sh
index 13b731d94d8b3947090a6baa491c7dd2e55b6120..ace159f59ae268b8f9d321df5f02ffd762146896 100755 (executable)
@@ -10,17 +10,20 @@ KVERSION=${KVERSION-$(uname -r)}
 
 test_run() {
     qemu-kvm \
-       -hda $TESTDIR/rootdisk.img \
-       -m 256M -nographic \
-       -net none -kernel /boot/vmlinuz-$KVERSION \
-       -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd rw console=ttyS0,115200n81 selinux=0 $DEBUGFAIL"
+        -hda $TESTDIR/rootdisk.img \
+        -m 256M -nographic \
+        -net none -kernel /boot/vmlinuz-$KVERSION \
+        -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd rw console=ttyS0,115200n81 selinux=0 $DEBUGFAIL"
     ret=1
     mkdir -p $TESTDIR/root
     mount ${LOOPDEV}p1 $TESTDIR/root
     [[ -e $TESTDIR/root/testok ]] && ret=0
     cp -a $TESTDIR/root/var/log/journal $TESTDIR
+    cp -a $TESTDIR/root/failed $TESTDIR
     umount $TESTDIR/root
+    cat $TESTDIR/failed
     ls -l $TESTDIR/journal/*/*.journal
+    test -s $TESTDIR/failed && ret=$(($ret+1))
     return $ret
 }
 
@@ -44,7 +47,7 @@ EOF
     # Create what will eventually be our root filesystem onto an overlay
     (
         LOG_LEVEL=5
-       initdir=$TESTDIR/root
+        initdir=$TESTDIR/root
 
         # create the basic filesystem layout
         setup_basic_dirs
@@ -73,7 +76,7 @@ EOF
        inst /etc/pam.conf
        inst /etc/securetty
        inst /etc/os-release
-
+        inst /etc/localtime
         # we want an empty environment
        > $initdir/etc/environment
 
@@ -97,7 +100,7 @@ Description=Testsuite service
 After=multi-user.target
 
 [Service]
-ExecStart=/bin/sh -c 'echo OK > /testok; /bin/sleep 5'
+ExecStart=/bin/sh -c 'systemctl --failed --no-legend --no-pager > /failed ; echo OK > /testok'
 ExecStartPost=/usr/sbin/poweroff
 Type=oneshot
 
@@ -107,7 +110,12 @@ EOF
 
         # make the testsuite the default target
        ln -fs testsuite.target $initdir/etc/systemd/system/default.target
-
+        mkdir -p $initdir/etc/rc.d
+        cat >$initdir/etc/rc.d/rc.local <<EOF
+#!/bin/bash
+exit 0
+EOF
+        chmod 0755 $initdir/etc/rc.d/rc.local
         # install basic tools needed
         dracut_install sh bash setsid loadkeys setfont \
             login sushell sulogin gzip sleep echo
@@ -169,7 +177,7 @@ EOF
        dracut_install sh df free ls shutdown poweroff \
             stty cat ps ln ip route \
            mount dmesg dhclient mkdir cp ping dhclient \
-           umount strace less grep
+           umount strace less grep id tty touch
 
         # install ld.so.conf* and run ldconfig
        cp -a /etc/ld.so.conf* $initdir/etc