test.sh revision 41a5ef639b248aa3d10609d9af5d0043b909d93c
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
TEST_DESCRIPTION="Job-related tests"
. $TEST_BASE_DIR/test-functions
# Uncomment this to debug failures
#DEBUGFAIL="systemd.unit=multi-user.target"
DEBUGTOOLS="df free ls stty cat ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort"
# TODO: qemu wrapper script: http://www.spinics.net/lists/kvm/msg72389.html
-m 512M -nographic \
-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
ret=1
return $ret
}
ret=1
[[ -e $TESTDIR/nspawn-root/testok ]] && ret=0
return $ret
}
if check_qemu ; then
run_qemu || return 1
else
dwarn "can't run qemu-kvm, skipping"
fi
if check_nspawn; then
run_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
fi
return 0
}
# Create the blank file to use as a root filesystem
LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img)
[ -b $LOOPDEV ] || return 1
,3200
,
EOF
# Create what will eventually be our root filesystem onto an overlay
(
# create the basic filesystem layout
# install compiled files
# remove unneeded documentation
# install possible missing libraries
inst_libs $i
done
# make a journal directory
# install some basic config files
# we want an empty environment
# set the hostname
LABEL=systemd / ext3 rw 0 1
EOF
# setup the testsuite target and the test ending service
# setup the testsuite service
[Unit]
Description=Testsuite service
After=multi-user.target
[Service]
ExecStart=/test-jobs.sh
Type=oneshot
EOF
# copy the units used by this test
# make the testsuite the default target
#!/bin/bash
exit 0
EOF
# install basic tools needed
# install libnss_files for login
inst_libdir_file "libnss_files*"
# install dbus and pam
find \
| while read file; do
done
# install dbus socket and service file
# install basic keyboard maps and fonts
for i in \
[[ -f $i ]] || continue
inst $i
done
# some basic terminfo files
[ -f ${_terminfodir}/l/linux ] && break
done
dracut_install -o ${_terminfodir}/l/linux
# softlink mtab
# install any Exec's from the service files
| while read i; do
i=${i##Exec*=}; i=${i##-}
inst $i
done
# install plymouth, if found... else remove plymouth service files
# if [ -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
# PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$TEST_BASE_DIR/test-functions" \
# /usr/libexec/plymouth/plymouth-populate-initrd -t $initdir
# dracut_install plymouth plymouthd
# else
rm -f $initdir/{usr/lib,etc}/systemd/system/plymouth* $initdir/{usr/lib,etc}/systemd/system/*/plymouth*
# fi
# some helper tools for debugging
[[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS
# install ld.so.conf* and run ldconfig
cp -a /etc/ld.so.conf* $initdir/etc
ddebug "Strip binaeries"
# copy depmod files
# generate module dependencies
if [[ -d $initdir/lib/modules/$KERNEL_VER ]] && \
dfatal "\"depmod -a $KERNEL_VER\" failed."
exit 1
fi
)
# we don't mount in the nspawn root
}
return 0
}
do_test "$@"