[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] use $(...) consistently in tests
From: |
Paolo Bonzini |
Subject: |
[PATCH] use $(...) consistently in tests |
Date: |
Mon, 29 Mar 2010 11:27:48 +0200 |
I'm pushing this to satisfy Jim's request (and more). I'm done for 2.6.2.
* tests/backref.sh: Use `...' instead of ``...'' in comments.
* tests/bre.awk: Use $(...) instead of `...`.
* tests/ere.awk: Use $(...) instead of `...`.
* tests/euc-mb: Use $(...) instead of `...`.
* tests/fmbtest: Use $(...) instead of `...`.
* tests/foad1: Use $(...) instead of `...`.
* tests/pcre-z: Use $(...) instead of `...`. Quote output of grep.
* tests/spencer1-locale.awk: Use $(...) instead of `...`.
* tests/spencer1.awk: Use $(...) instead of `...`.
* tests/yesno.sh: Use $(...) instead of `...`.
---
tests/backref.sh | 2 +-
tests/bre.awk | 4 ++--
tests/ere.awk | 4 ++--
tests/euc-mb | 2 +-
tests/fmbtest | 28 ++++++++++++++--------------
tests/foad1 | 2 +-
tests/pcre-z | 2 +-
tests/spencer1-locale.awk | 2 +-
tests/spencer1.awk | 4 ++--
tests/yesno.sh | 6 +++---
10 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/tests/backref.sh b/tests/backref.sh
index 11e2c7c..d76206f 100755
--- a/tests/backref.sh
+++ b/tests/backref.sh
@@ -19,7 +19,7 @@ if test $? -ne 0 ; then
fi
# hit hard with the `Bond' tests
-# For now, remove the ``?'' in the last parentheses, so that new glibc can do
it. --Stepan
+# For now, remove the `?' in the last parentheses, so that new glibc can do
it. --Stepan
echo "civic" | ${GREP} -E -e
'^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1
if test $? -ne 0 ; then
echo "Options: Bond, test #2 failed"
diff --git a/tests/bre.awk b/tests/bre.awk
index 9be5244..d8aad74 100644
--- a/tests/bre.awk
+++ b/tests/bre.awk
@@ -14,8 +14,8 @@ BEGIN {
$0 ~ /^#/ { next; }
NF == 3 {
-# printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo
$?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo
$? ; }`\n",$3, $2);
+# printf ("status=$(echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo
$?; cat >/dev/null; })\n",$3, $2);
+ printf ("status=$(echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo
$? ; })\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer bre test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/tests/ere.awk b/tests/ere.awk
index 737e3ef..9a886bf 100644
--- a/tests/ere.awk
+++ b/tests/ere.awk
@@ -14,8 +14,8 @@ BEGIN {
$0 ~ /^#/ { next; }
NF == 3 {
-# printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1;
echo $?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1;
echo $?; }`\n",$3, $2);
+# printf ("status=$(echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1;
echo $?; cat >/dev/null; })\n",$3, $2);
+ printf ("status=$(echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1;
echo $?; })\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer ere test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/tests/euc-mb b/tests/euc-mb
index 590bd91..d233dab 100644
--- a/tests/euc-mb
+++ b/tests/euc-mb
@@ -17,7 +17,7 @@ euc_grep () {
}
-case `get-mb-cur-max $locale` in
+case $(get-mb-cur-max $locale) in
2|3) ;;
*) skip_ 'EUC-JP locale not found' ;;
esac
diff --git a/tests/fmbtest b/tests/fmbtest
index 8a00b2a..6fd6d0a 100755
--- a/tests/fmbtest
+++ b/tests/fmbtest
@@ -51,30 +51,30 @@ EOF
for mode in F G E; do
-test1="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode} -f cspatfile csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test1="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode} -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test1" != "11 12 13 14 15 16 17 18"; then
echo "Test #1 ${mode} failed: $test1"
failures=1
fi
-test2="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -f cspatfile csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test2="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}i -f cspatfile csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test2" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #2 ${mode} failed: $test2"
failures=1
fi
-test3="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'ÄÃÅ¡E' -e 'Äas'
csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test3="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'ÄÃÅ¡E' -e 'Äas'
csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test3" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #3 ${mode} failed: $test3"
failures=1
fi
# Skip the next test - known to fail. TAA.
-#test4="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}iw -f cspatfile csinput \
-# | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+#test4="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}iw -f cspatfile csinput \
+# | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
#if test "$test4" != "01 02 08 13 17 19"; then
# echo "Test #4 ${mode} failed: $test4"
# failures=1
@@ -82,8 +82,8 @@ fi
# Test that --color=always does not depend on individual pattern order within
the pattern
# list, and that a longer match is preferred to a shorter one starting at the
same point.
-test6="`echo 'Cosi tu ÄiÅ¡Ã...' \
- | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'ÄiÅ¡' -e
'ÄiÅ¡Ã'`"
+test6="$(echo 'Cosi tu ÄiÅ¡Ã...' \
+ | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'ÄiÅ¡' -e
'ÄiÅ¡Ã')"
if echo "$test6" | LC_ALL=C grep -q 'Cosi tu
.*\[.*m\(.\[K\)\?ÄiÅ¡Ã.*\[.*m\(.\[K\)\?\.\.\.'; then
:
else
@@ -93,8 +93,8 @@ fi
# Test that --color=always does not depend on individual pattern order within
the pattern
# list, and that a longer match is preferred to a shorter one starting at the
same point.
-test7="`echo 'Cosi tu ÄiÅ¡Ã...' \
- | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'ÄiÅ¡Ã' -e
'ÄiÅ¡'`"
+test7="$(echo 'Cosi tu ÄiÅ¡Ã...' \
+ | LC_ALL=cs_CZ.UTF-8 grep --color=always -${mode}i -e 'ÄiÅ¡Ã' -e
'ÄiÅ¡')"
if echo "$test7" | LC_ALL=C grep -q 'Cosi tu
.*\[.*m\(.\[K\)\?ÄiÅ¡Ã.*\[.*m\(.\[K\)\?\.\.\.'; then
:
else
@@ -106,8 +106,8 @@ done
for mode in G E; do
-test8="$(echo `LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'Ä.Å¡E' -e 'Ä[a-f]s'
csinput \
- | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'`)"
+test8="$(echo $(LC_ALL=cs_CZ.UTF-8 grep -${mode}i -e 'Ä.Å¡E' -e 'Ä[a-f]s'
csinput \
+ | LC_ALL=C sed 's/^.*\([0-9][0-9]\).*$/\1/'))"
if test "$test8" != "01 02 07 08 10 11 12 13 14 15 16 17 18 19 20"; then
echo "Test #8 ${mode} failed: $test8"
failures=1
diff --git a/tests/foad1 b/tests/foad1
index 150c2b0..9492fad 100755
--- a/tests/foad1
+++ b/tests/foad1
@@ -23,7 +23,7 @@ grep_test ()
INPUT="$1"
EXPECT="$2"
shift 2
- OUTPUT=`printf %s "$INPUT" | tr "/" "\n" | grep "$@" | tr "\n" "/"`
+ OUTPUT=$(printf %s "$INPUT" | tr "/" "\n" | grep "$@" | tr "\n" "/")
if test "$OUTPUT" != "$EXPECT" || test "$VERBOSE" = "yes"; then
echo "Testing: grep $@"
test "$LC_ALL" != C && test "$LC_ALL" != "" && echo " LC_ALL: \"$LC_ALL\""
diff --git a/tests/pcre-z b/tests/pcre-z
index 17d9f95..f59c1fa 100755
--- a/tests/pcre-z
+++ b/tests/pcre-z
@@ -14,7 +14,7 @@ grep -z "$REGEX" in > exp 2>err || fail_ 'Cannot do BRE (grep
-z) match.'
compare err /dev/null || fail_ 'stderr not empty on grep -z.'
# Sanity check the output
-test `grep -cz "$REGEX" in` 2>err = 3 || fail_ 'Incorrect BRE (grep -cz)
match.'
+test "$(grep -cz "$REGEX" in)" 2>err = 3 || fail_ 'Incorrect BRE (grep -cz)
match.'
compare err /dev/null || fail_ 'stderr not empty on grep -cz.'
fail=0
diff --git a/tests/spencer1-locale.awk b/tests/spencer1-locale.awk
index ff89342..759cafc 100644
--- a/tests/spencer1-locale.awk
+++ b/tests/spencer1-locale.awk
@@ -22,7 +22,7 @@ $0 !~ /^#/ && NF == 3 {
function test(locale)
{
- printf ("status=`echo '%s'| { LC_ALL=%s grep -E -e '%s' >/dev/null 2>&1
; echo $?; }`\n",$3, locale, $2);
+ printf ("status=$(echo '%s'| { LC_ALL=%s grep -E -e '%s' >/dev/null
2>&1 ; echo $?; })\n",$3, locale, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer test \\#%d failed \\(%s\\)\n", ++n, locale);
printf ("\tfailures=1\n");
diff --git a/tests/spencer1.awk b/tests/spencer1.awk
index ffd4fb4..06f90b7 100644
--- a/tests/spencer1.awk
+++ b/tests/spencer1.awk
@@ -11,8 +11,8 @@ BEGIN {
}
$0 !~ /^#/ && NF == 3 {
-# printf ("status=`echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo
$?; cat >/dev/null; }`\n",$3, $2);
- printf ("status=`echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ; echo
$?; }`\n",$3, $2);
+# printf ("status=$(echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1;
echo $?; cat >/dev/null; })\n",$3, $2);
+ printf ("status=$(echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ;
echo $?; })\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/tests/yesno.sh b/tests/yesno.sh
index 88415d3..49f3fec 100755
--- a/tests/yesno.sh
+++ b/tests/yesno.sh
@@ -110,11 +110,11 @@ shift
# Test execution and reporting.
t=1
while test xx != "x$1"; do
- opts=`echo "$1" | sed 's/,/ /g'`
+ opts=$(echo "$1" | sed 's/,/ /g')
expect="$2"
shift 2
- output=`{ $GREP -F -n -b $opts yes 2>/dev/null; echo "?$?"; sed 's!^!X!'; }
< "$yn" | tr '\n' '/'`
+ output=$({ $GREP -F -n -b $opts yes 2>/dev/null; echo "?$?"; sed 's!^!X!'; }
< "$yn" | tr '\n' '/')
if test "$output" != "$expect" || test "$VERBOSE" = "1"; then
echo " Test #$t: { $GREP -F -n -b $opts yes; echo \"?\$?\"; sed 's!^!X!';
}"
@@ -128,7 +128,7 @@ while test xx != "x$1"; do
echo ' PASS'
fi
- t=`expr $t + 1`
+ t=$(expr $t + 1)
done
exit $failures
--
1.6.6.1
- [PATCH] use $(...) consistently in tests,
Paolo Bonzini <=