Blame SOURCES/tests-fix-covscan-SHELLCHECK_WARNING-complaints.patch

a6de77
From 815072b9163cae73671baae448f974cc8f8a84be Mon Sep 17 00:00:00 2001
a6de77
From: Rafael Aquini <aquini@redhat.com>
a6de77
Date: Sun, 12 Apr 2020 21:08:01 -0400
a6de77
Subject: [PATCH] tests: fix covscan SHELLCHECK_WARNING complaints
a6de77
a6de77
Signed-off-by: Rafael Aquini <aquini@redhat.com>
a6de77
---
a6de77
 tests/counters.sh                      |  2 +-
a6de77
 tests/fadvise_reserve.sh               |  2 +-
a6de77
 tests/fallocate_align.sh               |  2 +-
a6de77
 tests/fallocate_basic.sh               |  2 +-
a6de77
 tests/fallocate_stress.sh              |  2 +-
a6de77
 tests/madvise_reserve.sh               |  2 +-
a6de77
 tests/mremap-expand-slice-collision.sh |  2 +-
a6de77
 tests/mremap-fixed-huge-near-normal.sh |  2 +-
a6de77
 tests/mremap-fixed-normal-near-huge.sh |  2 +-
a6de77
 tests/quota.sh                         |  2 +-
a6de77
 tests/readahead_reserve.sh             |  2 +-
a6de77
 tests/wrapper-utils.sh                 | 18 +++++++++---------
a6de77
 12 files changed, 20 insertions(+), 20 deletions(-)
a6de77
a6de77
diff --git a/tests/counters.sh b/tests/counters.sh
a6de77
index e3ffabe..27bfca3 100755
a6de77
--- a/tests/counters.sh
a6de77
+++ b/tests/counters.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # Huge page overcommit was not available until 2.6.24
a6de77
-compare_kvers `uname -r` "2.6.24"
a6de77
+compare_kvers "$(uname -r)" "2.6.24"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	EXP_RC=$RC_FAIL
a6de77
 else
a6de77
diff --git a/tests/fadvise_reserve.sh b/tests/fadvise_reserve.sh
a6de77
index 74496ec..ff96003 100755
a6de77
--- a/tests/fadvise_reserve.sh
a6de77
+++ b/tests/fadvise_reserve.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # fadvise is known broken before 2.6.30
a6de77
-compare_kvers `uname -r` "2.6.30"
a6de77
+compare_kvers "$(uname -r)" "2.6.30"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL (assumed) kernel bug"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/fallocate_align.sh b/tests/fallocate_align.sh
a6de77
index 5105151..4397cd3 100755
a6de77
--- a/tests/fallocate_align.sh
a6de77
+++ b/tests/fallocate_align.sh
a6de77
@@ -5,7 +5,7 @@
a6de77
 #
a6de77
 # hugetlbfs fallocate support was not available until 4.3
a6de77
 #
a6de77
-compare_kvers `uname -r` "4.3.0"
a6de77
+compare_kvers "$(uname -r)" "4.3.0"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL no fallocate support in kernels before 4.3.0"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/fallocate_basic.sh b/tests/fallocate_basic.sh
a6de77
index 904dfd6..1af6196 100755
a6de77
--- a/tests/fallocate_basic.sh
a6de77
+++ b/tests/fallocate_basic.sh
a6de77
@@ -5,7 +5,7 @@
a6de77
 #
a6de77
 # hugetlbfs fallocate support was not available until 4.3
a6de77
 #
a6de77
-compare_kvers `uname -r` "4.3.0"
a6de77
+compare_kvers "$(uname -r)" "4.3.0"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL no fallocate support in kernels before 4.3.0"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/fallocate_stress.sh b/tests/fallocate_stress.sh
a6de77
index 622084f..3b5b70a 100755
a6de77
--- a/tests/fallocate_stress.sh
a6de77
+++ b/tests/fallocate_stress.sh
a6de77
@@ -5,7 +5,7 @@
a6de77
 #
a6de77
 # hugetlbfs fallocate support was not available until 4.3
a6de77
 #
a6de77
-compare_kvers `uname -r` "4.3.0"
a6de77
+compare_kvers "$(uname -r)" "4.3.0"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL no fallocate support in kernels before 4.3.0"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/madvise_reserve.sh b/tests/madvise_reserve.sh
a6de77
index cfe582d..eb289d6 100755
a6de77
--- a/tests/madvise_reserve.sh
a6de77
+++ b/tests/madvise_reserve.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # madvise is known broken before 2.6.30
a6de77
-compare_kvers `uname -r` "2.6.30"
a6de77
+compare_kvers "$(uname -r)" "2.6.30"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL (assumed) kernel bug"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/mremap-expand-slice-collision.sh b/tests/mremap-expand-slice-collision.sh
a6de77
index 8c9d98a..dd4eba3 100755
a6de77
--- a/tests/mremap-expand-slice-collision.sh
a6de77
+++ b/tests/mremap-expand-slice-collision.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # mremap-expand-slice-collision is known broken before 2.6.33
a6de77
-compare_kvers `uname -r` "2.6.33"
a6de77
+compare_kvers "$(uname -r)" "2.6.33"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL (assumed) kernel bug"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/mremap-fixed-huge-near-normal.sh b/tests/mremap-fixed-huge-near-normal.sh
a6de77
index 4b89c35..22fde79 100755
a6de77
--- a/tests/mremap-fixed-huge-near-normal.sh
a6de77
+++ b/tests/mremap-fixed-huge-near-normal.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # mremap-fixed-huge-near-normal is known broken before 2.6.33
a6de77
-compare_kvers `uname -r` "2.6.33"
a6de77
+compare_kvers "$(uname -r)" "2.6.33"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL (assumed) kernel bug"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/mremap-fixed-normal-near-huge.sh b/tests/mremap-fixed-normal-near-huge.sh
a6de77
index 9ed058f..45b8f26 100755
a6de77
--- a/tests/mremap-fixed-normal-near-huge.sh
a6de77
+++ b/tests/mremap-fixed-normal-near-huge.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # mremap-fixed-normal-near-huge is known broken before 2.6.33
a6de77
-compare_kvers `uname -r` "2.6.33"
a6de77
+compare_kvers "$(uname -r)" "2.6.33"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL (assumed) kernel bug"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/quota.sh b/tests/quota.sh
a6de77
index 398d442..55c764a 100755
a6de77
--- a/tests/quota.sh
a6de77
+++ b/tests/quota.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # There are known bugs in quota accounting prior to 2.6.24
a6de77
-compare_kvers `uname -r` "2.6.24"
a6de77
+compare_kvers "$(uname -r)" "2.6.24"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	EXP_RC=$RC_FAIL
a6de77
 else
a6de77
diff --git a/tests/readahead_reserve.sh b/tests/readahead_reserve.sh
a6de77
index 5ab7400..861ef5a 100755
a6de77
--- a/tests/readahead_reserve.sh
a6de77
+++ b/tests/readahead_reserve.sh
a6de77
@@ -3,7 +3,7 @@
a6de77
 . wrapper-utils.sh
a6de77
 
a6de77
 # readahead is known broken before 2.6.30
a6de77
-compare_kvers `uname -r` "2.6.30"
a6de77
+compare_kvers "$(uname -r)" "2.6.30"
a6de77
 if [ $? -eq 1 ]; then
a6de77
 	echo "FAIL (assumed) kernel bug"
a6de77
 	exit $RC_FAIL
a6de77
diff --git a/tests/wrapper-utils.sh b/tests/wrapper-utils.sh
a6de77
index 2f6451d..79e7ed1 100644
a6de77
--- a/tests/wrapper-utils.sh
a6de77
+++ b/tests/wrapper-utils.sh
a6de77
@@ -1,12 +1,12 @@
a6de77
 #!/bin/bash
a6de77
 
a6de77
 # Standard return codes
a6de77
-RC_PASS=0
a6de77
-RC_CONFIG=1
a6de77
-RC_FAIL=2
a6de77
-RC_XFAIL=3
a6de77
-RC_XPASS=4
a6de77
-RC_BUG=99
a6de77
+export RC_PASS=0
a6de77
+export RC_CONFIG=1
a6de77
+export RC_FAIL=2
a6de77
+export RC_XFAIL=3
a6de77
+export RC_XPASS=4
a6de77
+export RC_BUG=99
a6de77
 
a6de77
 function unexpected_pass()
a6de77
 {
a6de77
@@ -28,10 +28,10 @@ function check_rc()
a6de77
 	EXP_RC=$1
a6de77
 	ACT_RC=$2
a6de77
 
a6de77
-	if [ $ACT_RC -eq $RC_PASS -a $EXP_RC -ne $RC_PASS ]; then
a6de77
+	if [[ ($ACT_RC -eq $RC_PASS) && ($EXP_RC -ne $RC_PASS) ]]; then
a6de77
 		unexpected_pass
a6de77
 		return $RC_XPASS
a6de77
-	elif [ $EXP_RC -ne $RC_PASS -a $EXP_RC -eq $ACT_RC ]; then
a6de77
+	elif [[ ($EXP_RC -ne $RC_PASS) && ($EXP_RC -eq $ACT_RC) ]]; then
a6de77
 		expected_fail
a6de77
 		return $RC_XFAIL
a6de77
 	else
a6de77
@@ -47,7 +47,7 @@ function exec_and_check()
a6de77
 	EXP_RC=$1
a6de77
 	shift
a6de77
 
a6de77
-	OUTPUT=`$@`
a6de77
+	OUTPUT=$("$@")
a6de77
 	check_rc $EXP_RC $?
a6de77
 	RC=$?
a6de77
 	echo $OUTPUT
a6de77
-- 
a6de77
2.25.2
a6de77