t7002: set test prerequisite "external-grep" if supported
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Mon, 4 Jan 2010 12:34:14 +0000 (19:34 +0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Jan 2010 02:28:11 +0000 (18:28 -0800)
Add another test to set prerequisite EXTGREP if the current build supports
external grep. This can be used to skip external grep only tests on builds
that do not support this optimization.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7002-grep.sh

index b4709e28b5107cfad95290a78ac0260df0485213..23eeb767f97d9640c44e48d396d1b76afb0fa5b9 100755 (executable)
@@ -8,6 +8,18 @@ test_description='git grep various.
 
 . ./test-lib.sh
 
+test_expect_success 'Check for external grep support' '
+       case "$(git grep -h 2>&1|grep ext-grep)" in
+       *"(default)"*)
+               test_set_prereq EXTGREP
+               true;;
+       *"(ignored by this build)"*)
+               true;;
+       *)
+               false;;
+       esac
+'
+
 cat >hello.c <<EOF
 #include <stdio.h>
 int main(int argc, const char **argv)