teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
Blob Blame History Raw
From fa44b8d1e6b0d5e0ef4dfcb01e26e7907068bfa3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 7 Dec 2022 09:52:35 +0100
Subject: [PATCH] TEST-65: use [[ -v ]] more

It's a bashism, but we use other bash features anyway, and it's cleaner
and much less verbose.

(cherry picked from commit 1f9caf28cafbec89b93b8e6b641d387ac5acdd24)

Related: #2138081
---
 test/units/testsuite-64.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh
index 7673036335..fd1ad7c041 100755
--- a/test/units/testsuite-64.sh
+++ b/test/units/testsuite-64.sh
@@ -192,7 +192,7 @@ testcase_nvme_subsystem() {
 testcase_virtio_scsi_identically_named_partitions() {
     local num
 
-    if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then
+    if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then
         num=$((4 * 4))
     else
         num=$((16 * 8))
@@ -305,7 +305,7 @@ testcase_simultaneous_events() {
     local -a devices symlinks
     local -A running
 
-    if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then
+    if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then
         num_part=2
         iterations=10
         timeout=240
@@ -400,7 +400,7 @@ testcase_lvm_basic() {
         /dev/disk/by-id/ata-foobar_deadbeeflvm{0..3}
     )
 
-    if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then
+    if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then
         timeout=180
     else
         timeout=30
@@ -453,7 +453,7 @@ testcase_lvm_basic() {
     helper_check_device_units
 
     # Same as above, but now with more "stress"
-    if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then
+    if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then
         iterations=10
     else
         iterations=50
@@ -478,7 +478,7 @@ testcase_lvm_basic() {
     helper_check_device_units
 
     # Create & remove LVs in a loop, i.e. with more "stress"
-    if [[ -n "${ASAN_OPTIONS:-}" ]]; then
+    if [[ -v ASAN_OPTIONS ]]; then
         iterations=8
         partitions=16
     elif [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then