[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: include-exclude: avoid false positive failure on FreeBSD
From: |
Jim Meyering |
Subject: |
[PATCH] tests: include-exclude: avoid false positive failure on FreeBSD |
Date: |
Tue, 21 Jun 2011 11:17:25 +0200 |
Thanks to the nixos/hydra autobuilder, I noticed
that a test was failing on FreeBSD:
http://hydra.nixos.org/build/1127262
Here's the relevant excerpt:
+ grep --include=a a x/a x/b x/dir
+ compare out exp-a
+ diff -u out exp-a
--- out 2011-06-20 23:38:34.000000000 +0000
+++ exp-a 2011-06-20 23:38:34.000000000 +0000
@@ -1,2 +1 @@
x/a:a
-Binary file x/dir matches
+ fail=1
+ Exit 1
+ set +e
And here's the fix:
>From 252dfb2b16b13502c2ea7341a743288fe522e59b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 21 Jun 2011 11:14:07 +0200
Subject: [PATCH] tests: include-exclude: avoid false positive failure on
FreeBSD
* tests/include-exclude: Avoid false-positive failure due to
matching "a" in a directory on FreeBSD, when searching a directory
without "-r". Search for '^aaa$' rather than just 'a'.
Adjust test inputs and expected output files accordingly.
---
tests/include-exclude | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/include-exclude b/tests/include-exclude
index 8a8e86c..4be5c78 100644
--- a/tests/include-exclude
+++ b/tests/include-exclude
@@ -3,15 +3,15 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
mkdir -p x/dir || framework_failure_
-echo a > x/a || framework_failure_
-echo b > x/b || framework_failure_
-echo d > x/dir/d || framework_failure_
+echo aaa > x/a || framework_failure_
+echo bbb > x/b || framework_failure_
+echo ddd > x/dir/d || framework_failure_
-printf '%s\n' x/b:b x/dir/d:d > exp-not-a || framework_failure_
-printf '%s\n' x/dir/d:d > exp-not-ab || framework_failure_
-printf '%s\n' x/a:a x/b:b > exp-not-d || framework_failure_
-printf '%s\n' x/a:a x/b:b > exp-not-dir || framework_failure_
-printf '%s\n' x/a:a > exp-a || framework_failure_
+printf '%s\n' x/b:bbb x/dir/d:ddd > exp-not-a || framework_failure_
+printf '%s\n' x/dir/d:ddd > exp-not-ab || framework_failure_
+printf '%s\n' x/a:aaa x/b:bbb > exp-not-d || framework_failure_
+printf '%s\n' x/a:aaa x/b:bbb > exp-not-dir || framework_failure_
+printf '%s\n' x/a:aaa > exp-a || framework_failure_
grep -r --exclude='a*' . x > out || fail=1
sort out > k && mv k out
@@ -40,7 +40,7 @@ grep -r --include='a*' . x > out || fail=1
compare out exp-a || fail=1
# --include (without --recursive) uses different code
-grep --include=a a x/* > out || fail=1
+grep --include=a '^aaa$' x/* > out || fail=1
compare out exp-a || fail=1
Exit $fail
--
1.7.6.rc2.295.gb63f3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: include-exclude: avoid false positive failure on FreeBSD,
Jim Meyering <=