test: move TEST-24-UNIT-TESTS setup to static files

I picked the list of zone files to install by grepping through the code. This
is is a bit brittle, but installing all of them takes a while, and more
importantly, writes a lot of lines to the log.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-10 15:31:09 +01:00
parent 30b84c78ea
commit f4c40fd754
4 changed files with 43 additions and 40 deletions

View File

@ -65,37 +65,10 @@ test_setup() {
LOG_LEVEL=5
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
for i in getfacl dirname basename capsh cut rev stat mktemp rmdir ionice unshare uname tr awk getent diff xzcat lz4cat; do
inst_binary $i
done
inst /etc/hosts
setup_basic_environment
install_keymaps yes
install_zoneinfo
# Install nproc to determine # of CPUs for correct parallelization
inst_binary nproc
# setup the testsuite service
cat >$initdir/etc/systemd/system/testsuite.service <<EOF
[Unit]
Description=Testsuite service
[Service]
ExecStart=/testsuite.sh
Type=oneshot
EOF
cp testsuite.sh $initdir/
setup_testsuite
mask_supporting_services
)
setup_nspawn_root
# mask some services that we do not want to run in these tests
ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.service
ln -fs /dev/null $initdir/etc/systemd/system/systemd-networkd.socket
ln -fs /dev/null $initdir/etc/systemd/system/systemd-resolved.service
}
do_test "$@"
do_test "$@" 24

View File

@ -40,37 +40,51 @@ PATH_TO_INIT=$ROOTLIBDIR/systemd
[ "$JOURNALCTL" ] || JOURNALCTL=$(which -a $BUILD_DIR/journalctl journalctl 2>/dev/null | grep '^/' -m1)
BASICTOOLS=(
awk
basename
bash
busybox
capsh
cat
chmod
chown
cmp
cryptsetup
cut
date
dd
diff
dirname
dmsetup
echo
env
false
getent
getfacl
gunzip
gzip
head
ionice
ip
ln
loadkeys
login
lz4cat
mkfifo
mktemp
modprobe
mount
mv
nc
nproc
readlink
rev
rm
rmdir
sed
seq
setfont
setsid
seq
sh
sleep
socat
@ -81,10 +95,13 @@ BASICTOOLS=(
tee
test
touch
tr
true
umount
uname
unshare
xargs
xzcat
)
DEBUGTOOLS=(
@ -385,6 +402,7 @@ setup_basic_environment() {
install_systemd
install_missing_libraries
install_config_files
install_zoneinfo
create_rc_local
install_basic_tools
install_libnss
@ -964,10 +982,16 @@ install_keymaps() {
}
install_zoneinfo() {
for i in /usr/share/zoneinfo/{,*/,*/*/}*; do
[[ -f $i ]] || continue
inst $i
done
inst_any /usr/share/zoneinfo/Asia/Seoul
inst_any /usr/share/zoneinfo/Asia/Vladivostok
inst_any /usr/share/zoneinfo/Australia/Sydney
inst_any /usr/share/zoneinfo/Europe/Berlin
inst_any /usr/share/zoneinfo/Europe/Kiev
inst_any /usr/share/zoneinfo/Pacific/Auckland
inst_any /usr/share/zoneinfo/Pacific/Honolulu
inst_any /usr/share/zoneinfo/CET
inst_any /usr/share/zoneinfo/EET
inst_any /usr/share/zoneinfo/UTC
}
install_fonts() {

View File

@ -0,0 +1,6 @@
[Unit]
Description=TEST-24-UNIT-TESTS
[Service]
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot

View File

@ -21,23 +21,23 @@ function report_result() {
if [[ $ret -ne 0 && $ret != 77 ]]; then
echo "$name failed with $ret"
echo "$name" >> /failed-tests
echo "$name" >>/failed-tests
{
echo "--- $name begin ---"
cat "/$name.log"
echo "--- $name end ---"
} >> /failed
} >>/failed
elif [[ $ret == 77 ]]; then
echo "$name skipped"
echo "$name" >> /skipped-tests
echo "$name" >>/skipped-tests
{
echo "--- $name begin ---"
cat "/$name.log"
echo "--- $name end ---"
} >> /skipped
} >>/skipped
else
echo "$name OK"
echo "$name" >> /testok
echo "$name" >>/testok
fi
systemd-cat echo "--- $name ---"
@ -69,7 +69,7 @@ for task in "${TEST_LIST[@]}"; do
if [[ -x $task ]]; then
log_file="/${task##*/}.log"
$task &> "$log_file" &
$task &>"$log_file" &
running[$task]=$!
fi
done