From e305e60cf507808fa31c456ef98295f8f7d00c9d Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Thu, 11 May 2023 12:11:37 -0800 Subject: Unbreak some tests with latest GNU grep, which now warns about stray '\'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- testsuite/tests/hsc2hs/Makefile | 4 ++-- testsuite/tests/numeric/should_run/Makefile | 2 +- testsuite/tests/numeric/should_run/T7014.primops | 2 +- testsuite/tests/simplCore/should_compile/Makefile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/hsc2hs/Makefile b/testsuite/tests/hsc2hs/Makefile index d0b2d249c3..95b011c85d 100644 --- a/testsuite/tests/hsc2hs/Makefile +++ b/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 diff --git a/testsuite/tests/numeric/should_run/Makefile b/testsuite/tests/numeric/should_run/Makefile index 26ec990fee..23f4456dca 100644 --- a/testsuite/tests/numeric/should_run/Makefile +++ b/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 diff --git a/testsuite/tests/numeric/should_run/T7014.primops b/testsuite/tests/numeric/should_run/T7014.primops index 3243666dbc..8277db5c32 100644 --- a/testsuite/tests/numeric/should_run/T7014.primops +++ b/testsuite/tests/numeric/should_run/T7014.primops @@ -2,7 +2,7 @@ and# or# uncheckedShift.*# \+# -\-# +-# \*# quotInt# remInt# diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index ffc56f8ee4..0583cb496e 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/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. -- cgit v1.2.1