[Git][ghc/ghc][master] Unbreak some tests with latest GNU grep, which now warns about stray '\'.

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon May 15 15:27:55 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
e305e60c by M Farkas-Dyck at 2023-05-15T11:27:41-04:00
Unbreak some tests with latest GNU grep, which now warns about stray '\'.

Confusingly, the testsuite mangled the error to say "stray /".

We also migrate some tests from grep to grep -E, as it seems the author actually wanted an "POSIX extended" (a.k.a. sane) regex.

Background: POSIX specifies 2 "regex" syntaxen: "basic" and "extended". Of these, only "extended" syntax is actually a regular expression. Furthermore, "basic" syntax is inconsistent in its use of the '\' character — sometimes it escapes a regex metacharacter, but sometimes it unescapes it, i.e. it makes an otherwise normal character become a metacharacter. This baffles me and it seems also the authors of these tests. Also, the regex(7) man page (at least on Linux) says "basic" syntax is obsolete. Nearly all modern tools and libraries are consistent in this use of the '\' character (of which many use "extended" syntax by default).

- - - - -


4 changed files:

- testsuite/tests/hsc2hs/Makefile
- testsuite/tests/numeric/should_run/Makefile
- testsuite/tests/numeric/should_run/T7014.primops
- testsuite/tests/simplCore/should_compile/Makefile


Changes:

=====================================
testsuite/tests/hsc2hs/Makefile
=====================================
@@ -52,9 +52,9 @@ T11004:
 T12504:
 	'$(HSC2HS)' $(HSC2HS_OPTS) T12504/path/to/$@.hsc
 ifeq "$(WINDOWS)" "YES"
-	grep '{-# LINE 1 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs
+	grep '{-# LINE 1 "T12504\\\\path\\\\to\\\\$@\.hsc" #-}' T12504/path/to/$@.hs
 else
-	grep '{-# LINE 1 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs
+	grep '{-# LINE 1 "T12504/path/to/$@\.hsc" #-}' T12504/path/to/$@.hs
 endif
 
 .PHONY: T15758


=====================================
testsuite/tests/numeric/should_run/Makefile
=====================================
@@ -6,5 +6,5 @@ include $(TOP)/mk/test.mk
 T7014:
 	rm -f T7014.simpl T7014.o T7014.hi
 	'$(TEST_HC)' -Wall -v0 -O --make T7014.hs -fforce-recomp -ddump-simpl > T7014.simpl
-	! grep -q -f T7014.primops T7014.simpl
+	! grep -Eq -f T7014.primops T7014.simpl
 	./T7014


=====================================
testsuite/tests/numeric/should_run/T7014.primops
=====================================
@@ -2,7 +2,7 @@ and#
 or#
 uncheckedShift.*#
 \+#
-\-#
+-#
 \*#
 quotInt#
 remInt#


=====================================
testsuite/tests/simplCore/should_compile/Makefile
=====================================
@@ -254,7 +254,7 @@ str-rules:
 # g should have been collapsed into one defininition by CSE.
 .PHONY: T13340
 T13340:
-	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep -c '\+#'
+	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep -Ec '\+#'
 
 
 # We expect to see all dictionaries specialized away.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e305e60cf507808fa31c456ef98295f8f7d00c9d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e305e60cf507808fa31c456ef98295f8f7d00c9d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230515/49f0785b/attachment-0001.html>


More information about the ghc-commits mailing list