teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 910711b21c5fe4f26ad20a4d86e1acfb2a0afbdb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 4 May 2022 08:24:06 +0200
Subject: [PATCH] tree-wide: drop manually-crafted message for missing
 variables

Bash will generate a very nice message for us:
/tmp/ff.sh: line 1: SOMEVAR: parameter null or not set

Let's save some keystrokes by not replacing this with our own inferior
messages.

(cherry picked from commit d7ff52403902900b61f644f87b5222822fd4a69b)

Related: #2087652
---
 test/TEST-36-NUMAPOLICY/test.sh |  2 +-
 test/hwdb-test.sh               |  2 +-
 test/test-rpm-macros.sh         |  2 +-
 test/units/testsuite-15.sh      |  4 ++--
 test/units/testsuite-36.sh      | 14 +++++++-------
 test/units/testsuite-46.sh      |  2 +-
 tools/check-directives.sh       |  4 ++--
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/test/TEST-36-NUMAPOLICY/test.sh b/test/TEST-36-NUMAPOLICY/test.sh
index 0eaaee9608..5f38bf1009 100755
--- a/test/TEST-36-NUMAPOLICY/test.sh
+++ b/test/TEST-36-NUMAPOLICY/test.sh
@@ -9,7 +9,7 @@ TEST_NO_NSPAWN=1
 . "${TEST_BASE_DIR:?}/test-functions"
 
 if qemu_min_version "5.2.0"; then
-    QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=${QEMU_MEM:?QEMU_MEM is unset} -numa node,memdev=mem0,nodeid=0"
+    QEMU_OPTIONS="-object memory-backend-ram,id=mem0,size=${QEMU_MEM:?} -numa node,memdev=mem0,nodeid=0"
 else
     QEMU_OPTIONS="-numa node,nodeid=0"
 fi
diff --git a/test/hwdb-test.sh b/test/hwdb-test.sh
index 0551f26a2d..29183e6829 100755
--- a/test/hwdb-test.sh
+++ b/test/hwdb-test.sh
@@ -11,7 +11,7 @@ set -e
 
 export SYSTEMD_LOG_LEVEL=info
 ROOTDIR="$(dirname "$(dirname "$(readlink -f "$0")")")"
-SYSTEMD_HWDB="${1:?missing argument}"
+SYSTEMD_HWDB="${1:?}"
 
 if [ ! -x "$SYSTEMD_HWDB" ]; then
     echo "$SYSTEMD_HWDB is not executable" >&2
diff --git a/test/test-rpm-macros.sh b/test/test-rpm-macros.sh
index 5843b72346..c7107dec3e 100755
--- a/test/test-rpm-macros.sh
+++ b/test/test-rpm-macros.sh
@@ -6,7 +6,7 @@
 # rpmspec utility is required (so this test will work with RPM 4 but won't work with RPM 5).
 set -eu
 
-BUILD_DIR="${1:?Missing argument: build directory}"
+BUILD_DIR="${1:?}"
 RPM_MACROS_FILE="${BUILD_DIR:?}/src/rpm/macros.systemd"
 
 if ! command -v rpm >/dev/null || ! command -v rpmspec >/dev/null; then
diff --git a/test/units/testsuite-15.sh b/test/units/testsuite-15.sh
index 0446e71c38..f847adac74 100755
--- a/test/units/testsuite-15.sh
+++ b/test/units/testsuite-15.sh
@@ -4,7 +4,7 @@ set -eux
 set -o pipefail
 
 _clear_service () {
-    local SERVICE_NAME="${1:?_clear_service: missing argument}"
+    local SERVICE_NAME="${1:?}"
     systemctl stop "$SERVICE_NAME.service" 2>/dev/null || :
     rm -f  /{etc,run,usr/lib}/systemd/system/"$SERVICE_NAME".service
     rm -fr /{etc,run,usr/lib}/systemd/system/"$SERVICE_NAME".service.d
@@ -25,7 +25,7 @@ clear_services () {
 }
 
 create_service () {
-    local SERVICE_NAME="${1:?create_service: missing argument}"
+    local SERVICE_NAME="${1:?}"
     clear_services "$SERVICE_NAME"
 
     cat >/etc/systemd/system/"$SERVICE_NAME".service <<EOF
diff --git a/test/units/testsuite-36.sh b/test/units/testsuite-36.sh
index b6c00c4845..cc4deffdbd 100755
--- a/test/units/testsuite-36.sh
+++ b/test/units/testsuite-36.sh
@@ -72,7 +72,7 @@ checkNUMA() {
 writePID1NUMAPolicy() {
     cat >"$confDir/numa.conf" <<EOF
 [Manager]
-NUMAPolicy=${1:?missing argument: NUMAPolicy}
+NUMAPolicy=${1:?}
 NUMAMask=${2:-""}
 EOF
 }
@@ -85,7 +85,7 @@ writeTestUnit() {
 writeTestUnitNUMAPolicy() {
     cat >"$testUnitNUMAConf" <<EOF
 [Service]
-NUMAPolicy=${1:?missing argument: NUMAPolicy}
+NUMAPolicy=${1:?}
 NUMAMask=${2:-""}
 EOF
     systemctl daemon-reload
@@ -106,25 +106,25 @@ pid1ReloadWithJournal() {
 
 pid1StartUnitWithStrace() {
     startStrace '-f'
-    systemctl start "${1:?missing unit name}"
+    systemctl start "${1:?}"
     sleep $sleepAfterStart
     stopStrace
 }
 
 pid1StartUnitWithJournal() {
     startJournalctl
-    systemctl start "${1:?missing unit name}"
+    systemctl start "${1:?}"
     sleep $sleepAfterStart
     stopJournalctl
 }
 
 pid1StopUnit() {
-    systemctl stop "${1:?missing unit name}"
+    systemctl stop "${1:?}"
 }
 
 systemctlCheckNUMAProperties() {
-    local UNIT_NAME="${1:?missing unit name}"
-    local NUMA_POLICY="${2:?missing NUMAPolicy}"
+    local UNIT_NAME="${1:?}"
+    local NUMA_POLICY="${2:?}"
     local NUMA_MASK="${3:-""}"
     local LOGFILE
 
diff --git a/test/units/testsuite-46.sh b/test/units/testsuite-46.sh
index c3e57cec95..61ee921151 100755
--- a/test/units/testsuite-46.sh
+++ b/test/units/testsuite-46.sh
@@ -15,7 +15,7 @@ inspect() {
     # avoid unexpected fails. To see the full outputs of both homectl &
     # userdbctl (for debugging purposes) drop the fields just before the
     # comparison.
-    local USERNAME="${1:?missing argument}"
+    local USERNAME="${1:?}"
     homectl inspect "$USERNAME" | tee /tmp/a
     userdbctl user "$USERNAME" | tee /tmp/b
 
diff --git a/tools/check-directives.sh b/tools/check-directives.sh
index 0661da4d3b..af846c4d73 100755
--- a/tools/check-directives.sh
+++ b/tools/check-directives.sh
@@ -3,8 +3,8 @@
 set -eu
 set -o pipefail
 
-SOURCE_ROOT="${1:?Missing argument: project source root}"
-BUILD_ROOT="${2:?Missing argument: project build root}"
+SOURCE_ROOT="${1:?}"
+BUILD_ROOT="${2:?}"
 
 command -v gawk &>/dev/null || exit 77