Skip to contentSkip to conversation

master - tests: drop wc -l when grep -c works

PATCH Zdenek Kabelac 1 participant 1 message Jul 10, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=efcbad25ee85c2f672ba8f4e30be9fe07d6c34a7
Commit:        efcbad25ee85c2f672ba8f4e30be9fe07d6c34a7
Parent:        e55bae2b2caa67d6b6ee1346fd5cebfe67698677
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sun Jul 2 21:56:10 2017 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200

tests: drop wc -l when grep -c works

---
 test/shell/pv-duplicate-uuid.sh   |    2 +-
 test/shell/thin-dmeventd-warns.sh |    2 +-
 test/shell/vgcfgbackup-usage.sh   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
test/shell/pv-duplicate-uuid.sh +1 -1
index d1664a4..43eb830 100644
@@ -35,7 +35,7 @@ pvs -o+uuid 2>&1 | tee out
 grep    WARNING out > warn || true
 grep -v WARNING out > main || true
 
-test $(grep $UUID1 main | wc -l) -eq 1
+test "$(grep -c $UUID1 main)" -eq 1
 
 COUNT=$(grep --count "was already found" warn)
 [ "$COUNT" -eq 2 ]
test/shell/thin-dmeventd-warns.sh +1 -1
index 29d3c4f..d874102 100644
@@ -29,7 +29,7 @@ wait_warn_() {
 
 	for i in $(seq 1 7)
 	do
-		test $(egrep "WARNING: Thin pool.*is now" debug.log_DMEVENTD_out | wc -l) -eq $1 && return 0
+		test "$(grep -E -c "WARNING: Thin pool.*is now" debug.log_DMEVENTD_out)" -eq "$1" && return 0
 		sleep 2
 	done
 
test/shell/vgcfgbackup-usage.sh +1 -1
index 6183490..6bf6cea 100644
@@ -47,7 +47,7 @@ invalid vgcfgrestore -f "bak-$vg1" $vg1-inv at lid
 invalid vgcfgrestore -f "bak-$vg1" $vg1 $vg2
 
 vgcfgrestore -l $vg1 | tee out
-test $(grep Description out | wc -l) -eq 2
+test "$(grep -c Description out)" -eq 2
 
 vgcfgrestore -l -f "bak-$vg1" $vg1