From 4110a6deb94c1086cb6ee2113862da276b25dff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 9 Dec 2019 20:35:51 +0100 Subject: [PATCH] test: use shell arrays and remove duplicates The tool lists are obviously not empty, so let's remove the test if they are. --- test/test-functions | 67 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/test/test-functions b/test/test-functions index 35c2d164040..410d79d0bb6 100644 --- a/test/test-functions +++ b/test/test-functions @@ -39,8 +39,67 @@ PATH_TO_INIT=$ROOTLIBDIR/systemd [ "$SYSTEMD_NSPAWN" ] || SYSTEMD_NSPAWN=$(which -a $BUILD_DIR/systemd-nspawn systemd-nspawn 2>/dev/null | grep '^/' -m1) [ "$JOURNALCTL" ] || JOURNALCTL=$(which -a $BUILD_DIR/journalctl journalctl 2>/dev/null | grep '^/' -m1) -BASICTOOLS="test env sh bash setsid loadkeys setfont login sulogin gzip sleep echo head tail cat mount umount cryptsetup date dmsetup modprobe sed cmp tee rm true false chmod chown ln xargs" -DEBUGTOOLS="df free ls stty ps ln ip route dmesg dhclient mkdir cp ping dhclient strace less grep id tty touch du sort hostname find vi mv" +BASICTOOLS=( + bash + cat + chmod + chown + cmp + cryptsetup + date + dmsetup + echo + env + false + gzip + head + ln + loadkeys + login + modprobe + mount + rm + sed + setfont + setsid + sh + sleep + sulogin + tail + tee + test + true + umount + xargs +) + +DEBUGTOOLS=( + cp + df + dhclient + dmesg + du + find + free + grep + hostname + id + ip + less + ln + ls + mkdir + mv + ping + ps + route + sort + strace + stty + touch + tty + vi +) STATEDIR="${BUILD_DIR:-.}/test/$(basename $(dirname $(realpath $0)))" STATEFILE="$STATEDIR/.testdir" @@ -765,14 +824,14 @@ EOF } install_basic_tools() { - [[ $BASICTOOLS ]] && dracut_install $BASICTOOLS + dracut_install "${BASICTOOLS[@]}" dracut_install -o sushell # in Debian ldconfig is just a shell script wrapper around ldconfig.real dracut_install -o ldconfig.real } install_debug_tools() { - [[ $DEBUGTOOLS ]] && dracut_install $DEBUGTOOLS + dracut_install "${DEBUGTOOLS[@]}" if [[ $INTERACTIVE_DEBUG ]]; then # Set default TERM from vt220 to linux, so at least basic key shortcuts work