1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

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 LOG_LEVEL=5
eval $(udevadm info --export --query=env --name=${LOOPDEV}p2) 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 setup_basic_environment
install_keymaps yes mask_supporting_services
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
) )
setup_nspawn_root 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) [ "$JOURNALCTL" ] || JOURNALCTL=$(which -a $BUILD_DIR/journalctl journalctl 2>/dev/null | grep '^/' -m1)
BASICTOOLS=( BASICTOOLS=(
awk
basename
bash bash
busybox busybox
capsh
cat cat
chmod chmod
chown chown
cmp cmp
cryptsetup cryptsetup
cut
date date
dd
diff
dirname
dmsetup dmsetup
echo echo
env env
false false
getent
getfacl
gunzip
gzip gzip
head head
ionice
ip ip
ln ln
loadkeys loadkeys
login login
lz4cat
mkfifo mkfifo
mktemp mktemp
modprobe modprobe
mount mount
mv mv
nc nc
nproc
readlink readlink
rev
rm rm
rmdir rmdir
sed sed
seq
setfont setfont
setsid setsid
seq
sh sh
sleep sleep
socat socat
@ -81,10 +95,13 @@ BASICTOOLS=(
tee tee
test test
touch touch
tr
true true
umount umount
uname
unshare unshare
xargs xargs
xzcat
) )
DEBUGTOOLS=( DEBUGTOOLS=(
@ -385,6 +402,7 @@ setup_basic_environment() {
install_systemd install_systemd
install_missing_libraries install_missing_libraries
install_config_files install_config_files
install_zoneinfo
create_rc_local create_rc_local
install_basic_tools install_basic_tools
install_libnss install_libnss
@ -964,10 +982,16 @@ install_keymaps() {
} }
install_zoneinfo() { install_zoneinfo() {
for i in /usr/share/zoneinfo/{,*/,*/*/}*; do inst_any /usr/share/zoneinfo/Asia/Seoul
[[ -f $i ]] || continue inst_any /usr/share/zoneinfo/Asia/Vladivostok
inst $i inst_any /usr/share/zoneinfo/Australia/Sydney
done 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() { 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 if [[ $ret -ne 0 && $ret != 77 ]]; then
echo "$name failed with $ret" echo "$name failed with $ret"
echo "$name" >> /failed-tests echo "$name" >>/failed-tests
{ {
echo "--- $name begin ---" echo "--- $name begin ---"
cat "/$name.log" cat "/$name.log"
echo "--- $name end ---" echo "--- $name end ---"
} >> /failed } >>/failed
elif [[ $ret == 77 ]]; then elif [[ $ret == 77 ]]; then
echo "$name skipped" echo "$name skipped"
echo "$name" >> /skipped-tests echo "$name" >>/skipped-tests
{ {
echo "--- $name begin ---" echo "--- $name begin ---"
cat "/$name.log" cat "/$name.log"
echo "--- $name end ---" echo "--- $name end ---"
} >> /skipped } >>/skipped
else else
echo "$name OK" echo "$name OK"
echo "$name" >> /testok echo "$name" >>/testok
fi fi
systemd-cat echo "--- $name ---" systemd-cat echo "--- $name ---"
@ -69,7 +69,7 @@ for task in "${TEST_LIST[@]}"; do
if [[ -x $task ]]; then if [[ -x $task ]]; then
log_file="/${task##*/}.log" log_file="/${task##*/}.log"
$task &> "$log_file" & $task &>"$log_file" &
running[$task]=$! running[$task]=$!
fi fi
done done