test.sh revision 7bcd865d386d96caac83cb1c589fdb8f9ce3b081
beaad6ac31022179c44d88536811e9ccd9425696nd# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
beaad6ac31022179c44d88536811e9ccd9425696nd# ex: ts=8 sw=4 sts=4 et filetype=sh
db878466c5e95073429dda0bdd001f45e9486e16fielding# Uncomment this to debug failures
beaad6ac31022179c44d88536811e9ccd9425696ndDEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
beaad6ac31022179c44d88536811e9ccd9425696nd # TODO: qemu wrapper script: http://www.spinics.net/lists/kvm/msg72389.html
beaad6ac31022179c44d88536811e9ccd9425696nd -append "root=/dev/sda1 systemd.log_level=debug raid=noautodetect loglevel=2 init=/usr/lib/systemd/systemd ro console=ttyS0,115200n81 selinux=0 $DEBUGFAIL" || return 1
7e68fce3cbd2246164e045a51ecd77f9f26680ednd ../../systemd-nspawn -b -D $TESTDIR/nspawn-root /usr/lib/systemd/systemd
7e68fce3cbd2246164e045a51ecd77f9f26680ednd [[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
66e48875fca2df6669dab4f2690ee36c6913c0ffnd run_qemu || return 1
7e68fce3cbd2246164e045a51ecd77f9f26680ednd run_nspawn || return 1
7e68fce3cbd2246164e045a51ecd77f9f26680ednd [ -b $LOOPDEV ] || return 1
8cfbcde8e416fd60132dd4324c42a5098da156cfnd sfdisk -C 6400 -H 2 -S 32 -L $LOOPDEV <<EOF
7e68fce3cbd2246164e045a51ecd77f9f26680ednd echo -n test >$TESTDIR/keyfile
7e68fce3cbd2246164e045a51ecd77f9f26680ednd # Create what will eventually be our root filesystem onto an overlay
4930be147adf9e3f6d3ca9313a6524f9bf654b2dnd for i in $initdir/{sbin,bin}/* $initdir/lib/systemd/*; do
7e68fce3cbd2246164e045a51ecd77f9f26680ednd eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
7e68fce3cbd2246164e045a51ecd77f9f26680edndLABEL=systemd / ext3 rw 0 1
7e68fce3cbd2246164e045a51ecd77f9f26680ednd cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
7e68fce3cbd2246164e045a51ecd77f9f26680edndDescription=Testsuite service
7e68fce3cbd2246164e045a51ecd77f9f26680edndAfter=multi-user.target
7e68fce3cbd2246164e045a51ecd77f9f26680edndExecStart=/test-jobs.sh
7e68fce3cbd2246164e045a51ecd77f9f26680edndType=oneshot
7e68fce3cbd2246164e045a51ecd77f9f26680ednd cp $TEST_BASE_DIR/{hello.service,sleep.service,hello-after-sleep.target} $initdir/etc/systemd/system
66e48875fca2df6669dab4f2690ee36c6913c0ffnd mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
66e48875fca2df6669dab4f2690ee36c6913c0ffnd ln -fs ../testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
7e68fce3cbd2246164e045a51ecd77f9f26680ednd ln -fs ../end.service $initdir/etc/systemd/system/testsuite.target.wants/end.service
7e68fce3cbd2246164e045a51ecd77f9f26680ednd ln -fs testsuite.target $initdir/etc/systemd/system/default.target
7e68fce3cbd2246164e045a51ecd77f9f26680ednd#!/bin/bash
7e68fce3cbd2246164e045a51ecd77f9f26680ednd login sushell sulogin gzip sleep echo mount umount cryptsetup date
9299f6420de1bc9f8cc870dd2ae5ee92f115089cdruggeri | while read file; do
66e48875fca2df6669dab4f2690ee36c6913c0ffnd [[ -f $i ]] || continue
a32843995c13450ba9433b733242977cb4970265nd for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
7e68fce3cbd2246164e045a51ecd77f9f26680ednd [ -f ${_terminfodir}/l/linux ] && break
7e68fce3cbd2246164e045a51ecd77f9f26680ednd egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
7e68fce3cbd2246164e045a51ecd77f9f26680ednd | while read i; do
7e68fce3cbd2246164e045a51ecd77f9f26680ednd # install plymouth, if found... else remove plymouth service files
7e68fce3cbd2246164e045a51ecd77f9f26680ednd # if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
7e68fce3cbd2246164e045a51ecd77f9f26680ednd # PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
7e68fce3cbd2246164e045a51ecd77f9f26680ednd # /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
7e68fce3cbd2246164e045a51ecd77f9f26680ednd rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
7e68fce3cbd2246164e045a51ecd77f9f26680ednd find "$initdir" -perm +111 -type f | xargs strip --strip-unneeded | ddebug
7e68fce3cbd2246164e045a51ecd77f9f26680ednd if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \