summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2016-11-28 14:16:18 -0800
committerJim Meyering <meyering@fb.com>2016-11-28 14:17:07 -0800
commitb7c4caec669d18ac7c5a692c10da7ddcc0e1f2a5 (patch)
tree3506983bc6387c4dea00cb30e4ef752f36ece493
parent03b491dd84986bf52df10d6dd0395240f1f18ed4 (diff)
downloadgrep-b7c4caec669d18ac7c5a692c10da7ddcc0e1f2a5.tar.gz
tests: use "returns_ N env VAR=val ..."
rather than "VAR=val returns_ N ..." Some shells do not propagate envvar settings through our use of the "returns_" function, so set any envvar via use of "env". This was an issue at least on Ubuntu and Debian-based systems, presumably due to their common use of "dash" as /bin/sh. Reported by Assaf Gordon. * tests/char-class-multibyte: As above. * tests/euc-mb: Likewise. * tests/false-match-mb-non-utf8: Likewise. * tests/pcre-infloop: Likewise. * tests/pcre-jitstack: Likewise. * tests/sjis-mb: Likewise. * tests/warn-char-classes: Likewise.
-rwxr-xr-xtests/char-class-multibyte2
-rwxr-xr-xtests/euc-mb2
-rwxr-xr-xtests/false-match-mb-non-utf88
-rwxr-xr-xtests/pcre-infloop2
-rwxr-xr-xtests/pcre-jitstack2
-rwxr-xr-xtests/sjis-mb4
-rwxr-xr-xtests/warn-char-classes2
7 files changed, 11 insertions, 11 deletions
diff --git a/tests/char-class-multibyte b/tests/char-class-multibyte
index 6bff4b30..b9575188 100755
--- a/tests/char-class-multibyte
+++ b/tests/char-class-multibyte
@@ -24,7 +24,7 @@ done
for LOC in en_US.UTF-8 $LOCALE_FR_UTF8; do
out=out3-$LOC
- printf '\303\n' | LC_ALL=$LOC returns_ 1 grep '[é]' > $out || fail=1
+ printf '\303\n' | returns_ 1 env LC_ALL=$LOC grep '[é]' > $out || fail=1
done
Exit $fail
diff --git a/tests/euc-mb b/tests/euc-mb
index 06e72cd7..c6393745 100755
--- a/tests/euc-mb
+++ b/tests/euc-mb
@@ -42,6 +42,6 @@ make_input BABABA |returns_ 1 euc_grep AB || fail=1
make_input BABABA |returns_ 1 euc_grep '^x\|AB' || fail=1
# -P supports only unibyte and UTF-8 locales.
-LC_ALL=$locale returns_ 2 grep -P x /dev/null || fail=1
+returns_ 2 env LC_ALL=$locale grep -P x /dev/null || fail=1
Exit $fail
diff --git a/tests/false-match-mb-non-utf8 b/tests/false-match-mb-non-utf8
index 6dfd10a5..c7727939 100755
--- a/tests/false-match-mb-non-utf8
+++ b/tests/false-match-mb-non-utf8
@@ -22,17 +22,17 @@ test "$(get-mb-cur-max $loc)" = 4 || skip_ "no support for the $loc locale"
# of four bytes, the last of which is the digit, 7, and grep's DFA
# matcher would mistakenly report that ".*7" matches that input line.
printf '\2010\2077\n' > in || framework_failure_
-LC_ALL=$loc returns_ 1 grep -E '.*7' in || fail=1
+returns_ 1 env LC_ALL=$loc grep -E '.*7' in || fail=1
-LC_ALL=$loc returns_ 1 grep -E '.{0,1}7' in || fail=1
+returns_ 1 env LC_ALL=$loc grep -E '.{0,1}7' in || fail=1
-LC_ALL=$loc returns_ 1 grep -E '.?7' in || fail=1
+returns_ 1 env LC_ALL=$loc grep -E '.?7' in || fail=1
# Similar for the \ue9 code point, which ends in an "m" byte.
loc=zh_HK.big5hkscs
test "$(get-mb-cur-max $loc)" = 2 || skip_ "no support for the $loc locale"
printf '\210m\n' > in || framework_failure_
-LC_ALL=$loc returns_ 1 grep '.*m' in || fail=1
+returns_ 1 env LC_ALL=$loc grep '.*m' in || fail=1
Exit $fail
diff --git a/tests/pcre-infloop b/tests/pcre-infloop
index ce6cd7a2..fe973531 100755
--- a/tests/pcre-infloop
+++ b/tests/pcre-infloop
@@ -27,7 +27,7 @@ printf 'a\201b\r' > in || framework_failure_
fail=0
-LC_ALL=en_US.UTF-8 returns_ 1 timeout 10 grep -P 'a.?..b' in \
+returns_ 1 env LC_ALL=en_US.UTF-8 timeout 10 grep -P 'a.?..b' in \
|| fail_ "libpcre's match function appears to infloop"
Exit $fail
diff --git a/tests/pcre-jitstack b/tests/pcre-jitstack
index a7bca79b..5bdb5a8b 100755
--- a/tests/pcre-jitstack
+++ b/tests/pcre-jitstack
@@ -52,7 +52,7 @@ if test $? != 1; then
# Rerun that same test, but now with no limit on stack size:
(ulimit -s unlimited;
- LC_ALL=C returns_ 1 grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt) \
+ returns_ 1 env LC_ALL=C grep -P -n '^([/](?!/)|[^/])*~/.*' pcrejit.txt) \
|| fail=1
fi
diff --git a/tests/sjis-mb b/tests/sjis-mb
index fb6dcf71..abe2c0ca 100755
--- a/tests/sjis-mb
+++ b/tests/sjis-mb
@@ -30,8 +30,8 @@ k=0
test_grep_reject() {
k=$(expr $k + 1)
encode "$2" > in || return 1
- LC_ALL=$locale \
- returns_ 1 timeout 10s grep $1 $(encode "$3") in >out$k 2>&1 \
+ returns_ 1 env LC_ALL=$locale timeout 10s \
+ grep $1 $(encode "$3") in >out$k 2>&1 \
&& compare /dev/null out$k
}
diff --git a/tests/warn-char-classes b/tests/warn-char-classes
index 1a640737..b1db240d 100755
--- a/tests/warn-char-classes
+++ b/tests/warn-char-classes
@@ -18,7 +18,7 @@ returns_ 1 grep '[[:space:]]' x 2> err || fail=1
test -s err && fail=1
# disabled by POSIXLY_CORRECT
-POSIXLY_CORRECT=yes returns_ 1 grep '[:space:]' x 2> err || fail=1
+returns_ 1 env POSIXLY_CORRECT=yes grep '[:space:]' x 2> err || fail=1
test -s err && fail=1
# patterns that are considered valid