diff options
author | Paul Smith <psmith@gnu.org> | 2023-01-07 21:50:59 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2023-01-08 10:45:38 -0500 |
commit | 11444fb001cf57f32fb5022cd934c3cf489e66b2 (patch) | |
tree | 137a265d39ea813a74cb187f6a84771fc3ac68e5 /tests/scripts | |
parent | 0de7a0d3bf29a240c5e0fef79b5b3eae8a6a01f5 (diff) | |
download | make-git-11444fb001cf57f32fb5022cd934c3cf489e66b2.tar.gz |
[SV 62654] Support GNU Make on z/OS
Original patches provided by Igor Todorovski <itodorov@ca.ibm.com>
Reworked by Paul Smith <psmith@gnu.org>.
Thanks to IBM for providing a test system.
* NEWS: Announce support.
* AUTHORS: Ditto.
* README.zOS: Provide details on building GNU Make on z/OS.
* build.sh (get_mk_var): z/OS sh has a strange bug which causes it to
generate extra lines of output: rework the function to print output
as we compute it instead of collecting it into a variable, which
works around this bug.
* src/makeint.h: Declare MK_OS_ZOS if we're building for z/OS.
* src/arscan.c: Don't include <ar.h> on z/OS.
* src/job.c: We can't change environ in ASCII mode on z/OS.
* src/main.c: Ditto. Also we can't use pselect() on z/OS.
* src/posixos.c: pselect() seems to hang on z/OS: don't use it.
* tests/run_make_tests.pl: Handle different exit codes on z/OS.
* tests/test_driver.pl: Preserve some special z/OS env.vars.
Add special checks to output comparisons when on z/OS.
* tests/scripts/features/archives: Don't validate names. Don't
try to compile empty files as IBM compilers complain.
* tests/scripts/features/shell_assignment: Fix octal value of #.
* tests/scripts/features/temp_stdin: Don't print "term".
* tests/scripts/functions/shell: Handle shell exit codes.
* tests/scripts/targets/ONESHELL: Ditto.
* tests/scripts/targets/POSIX: sh -x prints differently.
* tests/scripts/variables/SHELL: Ditto.
Diffstat (limited to 'tests/scripts')
-rw-r--r-- | tests/scripts/features/archives | 9 | ||||
-rw-r--r-- | tests/scripts/features/output-sync | 4 | ||||
-rw-r--r-- | tests/scripts/features/shell_assignment | 6 | ||||
-rw-r--r-- | tests/scripts/features/temp_stdin | 8 | ||||
-rw-r--r-- | tests/scripts/functions/shell | 4 | ||||
-rw-r--r-- | tests/scripts/targets/ONESHELL | 4 | ||||
-rw-r--r-- | tests/scripts/targets/POSIX | 12 | ||||
-rw-r--r-- | tests/scripts/variables/SHELL | 14 |
8 files changed, 43 insertions, 18 deletions
diff --git a/tests/scripts/features/archives b/tests/scripts/features/archives index 2ad34d92..4e3434b5 100644 --- a/tests/scripts/features/archives +++ b/tests/scripts/features/archives @@ -212,7 +212,7 @@ if ($osname eq 'VMS') { # Check long names for archive members. # See Savannah bug #54395 -if ($osname ne 'VMS') { +if ($osname ne 'VMS' && $osname ne 'os390') { my $pre = '1234567890123456'; my $lib = 'libxx.a'; my $cr = $created; @@ -238,6 +238,9 @@ $pre%: ; touch \$\@ # SV 61436 : Allow redefining archive rules to propagate timestamps +# These don't work right on z/OS for some reason: archives not fully supported? + +if ($osname ne 'os390') { # Find the output when creating an archive from multiple files utouch(-10, 'a.o', 'b.o'); @@ -246,6 +249,9 @@ touch('b.o'); my $add2 = `$ar $arflags mylib.a b.o $redir`; unlink('a.o', 'b.o', 'mylib.a'); +# Some systems complain when compiling empty files +create_file('a.c', 'int i;'); +create_file('b.c', 'int j;'); utouch(-20, 'a.c', 'b.c'); run_make_test(q! @@ -267,6 +273,7 @@ run_make_test(undef, $arvar, "Compile b.c\n$ar $arflags mylib.a b.o\n${add2}rm b run_make_test(undef, $arvar, "#MAKE#: 'mylib.a' is up to date."); unlink('a.c', 'b.c', 'a.o', 'b.o', 'mylib.a'); +} # This tells the test driver that the perl test script executed properly. 1; diff --git a/tests/scripts/features/output-sync b/tests/scripts/features/output-sync index c6790d3b..20004e78 100644 --- a/tests/scripts/features/output-sync +++ b/tests/scripts/features/output-sync @@ -360,8 +360,8 @@ use POSIX (); # file. run_make_test(q! pid:=$(shell echo $$PPID) -all:; @#HELPER# term $(pid) sleep 10 -!, '-O -j2', '/#MAKE#: \*\*\* \[#MAKEFILE#:3: all] Terminated/', POSIX::SIGTERM); +all:; @#HELPER# -q term $(pid) sleep 10 +!, '-O -j2', '#MAKE#: *** [#MAKEFILE#:3: all] Terminated', POSIX::SIGTERM); } unlink($fout); diff --git a/tests/scripts/features/shell_assignment b/tests/scripts/features/shell_assignment index 686e4bd2..e3c369f7 100644 --- a/tests/scripts/features/shell_assignment +++ b/tests/scripts/features/shell_assignment @@ -19,10 +19,14 @@ all: ; @echo "<$(demo1)> <$(demo2)> <$(demo3)> <$(demo4)> <${demo5}>" '', "< 1 2 3 4 5 6 > <7 8 > <7 8 > < 2 3 > < 2 3 >\n"); # TEST 1: Handle '#' the same way as BSD make +$hashOctal = "\\043"; +if ($osname eq 'os390') { + $hashOctal = "\\173"; +} run_make_test(' foo1!=echo bar#baz -hash != printf \'\043\' +hash != printf \'' . $hashOctal . '\' foo2!= echo "bar$(hash)baz" all: ; @echo "<$(foo1)> <$(hash)> <$(foo2)>" diff --git a/tests/scripts/features/temp_stdin b/tests/scripts/features/temp_stdin index 92cb6980..5230f367 100644 --- a/tests/scripts/features/temp_stdin +++ b/tests/scripts/features/temp_stdin @@ -67,13 +67,15 @@ use POSIX (); &utouch(-600, 'bye.mk'); close(STDIN); open(STDIN, "<", 'input.mk') || die "$0: cannot open input.mk for reading: $!"; + run_make_test(q! include bye.mk -pid:=$(shell echo $$PPID) +pid := $(shell echo $$PPID) all:; -bye.mk: force; @#HELPER# term $(pid) sleep 10 +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); diff --git a/tests/scripts/functions/shell b/tests/scripts/functions/shell index d89a0c83..55fec05b 100644 --- a/tests/scripts/functions/shell +++ b/tests/scripts/functions/shell @@ -148,7 +148,9 @@ all: ; @echo $(.SHELLSTATUS) # Solaris 10 perl 5.8.4 puts signal number + 128 into the high 8 bits. $ret >>= 8; } - $ret |= 128; + if ($osname ne 'os390') { + $ret |= 128; + } run_make_test('.PHONY: all $(shell kill -2 $$$$) diff --git a/tests/scripts/targets/ONESHELL b/tests/scripts/targets/ONESHELL index f9da14b3..0ae9b5b7 100644 --- a/tests/scripts/targets/ONESHELL +++ b/tests/scripts/targets/ONESHELL @@ -115,7 +115,7 @@ all:; @print "it works\n" SHELL = #PERL# .SHELLFLAGS = all:; @print "it works" -!, '', "Can't open perl script \"print \"it works\"\": $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:5: all] Error 2", 512); +!, '', "Can't open perl script \"print \"it works\"\": $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:5: all] Error $ERR_no_such_file_code", 512); # No .SHELLFLAGS. # sv 61805. @@ -123,7 +123,7 @@ all:; @print "it works" .ONESHELL: SHELL = #PERL# all:; @print "it works" -!, '', "Can't open perl script \"print \"it works\"\": $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:4: all] Error 2", 512); +!, '', "Can't open perl script \"print \"it works\"\": $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:4: all] Error $ERR_no_such_file_code", 512); # Pass a quoted string with spaces to oneshell. # sv 61805. diff --git a/tests/scripts/targets/POSIX b/tests/scripts/targets/POSIX index bd716861..ade0b1ee 100644 --- a/tests/scripts/targets/POSIX +++ b/tests/scripts/targets/POSIX @@ -16,12 +16,18 @@ all: ; \@#HELPER# -q fail 1; true # User settings must override .POSIX # In the standard .POSIX must be the first thing in the makefile # but we relax that rule in GNU Make. + +# Different versions of sh generate different output for -x so check it +my $script = subst_make_string('#HELPER# -q fail 1; true'); +my $flags = '-xc'; +my $out = `$sh_name $flags '$script' 2>&1`; + run_make_test(qq! -.SHELLFLAGS = -xc +.SHELLFLAGS = $flags .POSIX: -all: ; \@#HELPER# -q fail 1; true +all: ; \@$script !, - '', "+ #HELPER# -q fail 1\n+ true\n"); + '', $out); # Test the default value of various POSIX-specific variables my %POSIX = (AR => 'ar', ARFLAGS => '-rv', diff --git a/tests/scripts/variables/SHELL b/tests/scripts/variables/SHELL index fa3b5fc8..b18754fa 100644 --- a/tests/scripts/variables/SHELL +++ b/tests/scripts/variables/SHELL @@ -66,8 +66,8 @@ one two:;@echo "$@: $(SHELL) $$SHELL" # Test .SHELLFLAGS -# We don't know the output here: on Solaris for example, every line printed -# by the shell in -x mode has a trailing space (!!) +# We don't know the output here: on some systems, for example, every line +# printed by the shell in -x mode has a trailing space! my $script = 'true; true'; my $flags = '-xc'; my $out = `$sh_name $flags '$script' 2>&1`; @@ -94,10 +94,14 @@ all: ; \@$script '', $out); } +$script = subst_make_string('true; #HELPER# -q fail 1; true'); +$flags = '-xec'; +$out = `$sh_name $flags '$script' 2>&1`; + run_make_test(qq! -.SHELLFLAGS = -xec -all: ; \@true; #HELPER# -q fail 1; true +.SHELLFLAGS = $flags +all: ; \@$script !, - '', "+ true\n+ #HELPER# -q fail 1\n#MAKE#: *** [#MAKEFILE#:3: all] Error 1\n", 512); + '', "${out}#MAKE#: *** [#MAKEFILE#:3: all] Error 1", 512); 1; |