tests: new requirement 'grep-nonprint'
[platform/upstream/automake.git] / t / color.sh
index 18c6e23..5726ac1 100755 (executable)
 # Test Automake TESTS color output, by forcing it.
 # Keep this in sync with the sister test 'color2.test'.
 
+required='grep-nonprint'
 # For gen-testsuite-part: ==> try-with-serial-tests <==
 . ./defs || Exit 1
 
-esc='\e'
 # Escape '[' for grep, below.
 red="$esc\[0;31m"
 grn="$esc\[0;32m"
@@ -29,14 +29,6 @@ blu="$esc\[1;34m"
 mgn="$esc\[0;35m"
 std="$esc\[m"
 
-# Check that grep can parse nonprinting characters.
-# BSD 'grep' works from a pipe, but not a seekable file.
-# GNU or BSD 'grep -a' works on files, but is not portable.
-case $(echo "$std" | grep .) in
-  "$std") ;;
-  *) skip_ "grep can't parse nonprinting characters";;
-esac
-
 cat >>configure.ac <<END
 AC_OUTPUT
 END
@@ -78,7 +70,8 @@ $AUTOMAKE --add-missing
 
 test_color ()
 {
-  # Not a useless use of cat; see above comments about grep.
+  # Not a useless use of cat; see above comments "grep-nonprinting"
+  # requirement in 'test-init.sh'.
   cat stdout | grep "^${grn}PASS${std}: .*pass"
   cat stdout | grep "^${red}FAIL${std}: .*fail"
   cat stdout | grep "^${blu}SKIP${std}: .*skip"
@@ -106,7 +99,8 @@ test_no_color ()
     # not unduly colorized.
     (
       set +e # In case some grepped regex below isn't matched.
-      # Not a useless use of cat; see above comments about grep.
+      # Not a useless use of cat; see above comments "grep-nonprinting"
+      # requirement in 'test-init.sh'.
       cat stdout | grep "TOTAL.*:"
       cat stdout | grep "PASS.*:"
       cat stdout | grep "FAIL.*:"