]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* tests/test_driver.pl: Convert z/OS answers for regex output
authorPaul Smith <psmith@gnu.org>
Sun, 15 Jan 2023 15:53:38 +0000 (10:53 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 15 Jan 2023 21:35:57 +0000 (16:35 -0500)
Allow z/OS customizations to apply to regex output matching.
* tests/scripts/features/output-sync: Use a regex for Terminated.
* tests/scripts/features/temp_stdin: Ditto.

tests/scripts/features/output-sync
tests/scripts/features/temp_stdin
tests/test_driver.pl

index 20004e787f2f673e359a42b85417c685cf6eccb5..a87df637dee1233d4e4fbb4b6a263ff57c286736 100644 (file)
@@ -353,15 +353,15 @@ s/\r?\n//g;
 if (/^[0-9]+$/) {
 use POSIX ();
 # SV 63157.
-# Test that make removes temporary files, even when a signal is received.
-# The general test_driver postprocessing will ensure the temporary file used
-# to synchronize output and the jobserver fifo are both removed.
-# sleep is needed to let make write its "... Terminated" message to the log
-# file.
+# Test that make removes temporary files, even when a signal is received.  The
+# general test_driver postprocessing will ensure the temporary file used to
+# synchronize output and the jobserver fifo are both removed.  sleep is needed
+# to let make write its "... Terminated" message to the log file.  Must use
+# REGEX because some systems (MacOS) add extra text after Terminated.
 run_make_test(q!
 pid:=$(shell echo $$PPID)
 all:; @#HELPER# -q term $(pid) sleep 10
-!, '-O -j2', '#MAKE#: *** [#MAKEFILE#:3: all] Terminated', POSIX::SIGTERM);
+!, '-O -j2', '/#MAKE#: \*\*\* \[#MAKEFILE#:3: all] Terminated/', POSIX::SIGTERM);
 }
 unlink($fout);
 
index d7dde709fc7eccf99b1f0079492ab81952a4c953..fee32a9064937bcec391f75d124618d5d0dc8cb7 100644 (file)
@@ -58,12 +58,11 @@ use POSIX ();
 
 # sv 63157.
 # Test that make removes the temporary file which holds make code from stdin,
-# even when a signal is received.
-# include bye.mk and bye.mk: rule is needed to cause make to keep the temporary
-# file for re-exec. Without re-exec make will remove the file before the signal
-# arrives.
-# sleep is needed to let make write its "... Terminated" message to the log
-# file.
+# even when a signal is received.  include bye.mk and bye.mk: rule is needed
+# to cause make to keep the temporary file for re-exec. Without re-exec make
+# will remove the file before the signal arrives.  sleep is needed to let make
+# write its "... Terminated" message to the log file.  Must use REGEX because
+# some systems (MacOS) add extra text after Terminated.
 &utouch(-600, 'bye.mk');
 close(STDIN);
 open(STDIN, "<", 'input.mk') || die "$0: cannot open input.mk for reading: $!";
@@ -75,7 +74,7 @@ all:;
 bye.mk: force; @#HELPER# -q term $(pid) sleep 10
 force:
 !,
-              '-f-', '#MAKE#: *** [#MAKEFILE#:5: bye.mk] Terminated', POSIX::SIGTERM);
+              '-f-', '/#MAKE#: \*\*\* \[#MAKEFILE#:5: bye.mk] Terminated/', POSIX::SIGTERM);
 }
 unlink($fout);
 
index 38ec45875c7e45281f8893bae127ce5d252c0dc8..38b848f2bf258da9eea005ddc49863792f903f7b 100644 (file)
@@ -908,9 +908,9 @@ sub compare_answer_vms
   return 0;
 }
 
-sub compare_answer_zos
+sub convert_answer_zos
 {
-  my ($kgo, $log) = @_;
+  my ($log) = @_;
 
   # z/OS emits "Error 143" or "SIGTERM" instead of terminated
   $log =~ s/Error 143/Terminated/gm;
@@ -920,7 +920,7 @@ sub compare_answer_zos
   $log =~ s/EDC5129I No such file or directory\./No such file or directory/gm;
   $log =~ s/FSUM7351 not found/not found/gm;
 
-  return $log eq $kgo;
+  return $log;
 }
 
 sub compare_answer
@@ -939,10 +939,16 @@ sub compare_answer
   $log =~ s,\r\n,\n,gs;
   return 1 if ($log eq $kgo);
 
-  # Keep these in case it's a regex
+  # Keep the originals in case it's a regex
   $mkgo = $kgo;
   $mlog = $log;
 
+  # z/OS has quirky outputs
+  if ($osname eq 'os390') {
+    $mlog = convert_answer_zos($mlog);
+    return 1 if ($mlog eq $kgo);
+  }
+
   # Some versions of Perl on Windows use /c instead of C:
   $mkgo =~ s,\b([A-Z]):,/\L$1,g;
   $mlog =~ s,\b([A-Z]):,/\L$1,g;
@@ -956,9 +962,6 @@ sub compare_answer
   # VMS is a whole thing...
   return 1 if ($osname eq 'VMS' && compare_answer_vms($kgo, $log));
 
-  # z/OS has its own quirks
-  return 1 if ($osname eq 'os390' && compare_answer_zos($kgo, $log));
-
   # See if the answer might be a regex.
   if ($kgo =~ m,^/(.+)/$,) {
     # Check the regex against both the original and modified strings