From 65931ce7a9a84ddb9adb118b7558bfd1b8c3ee46 Mon Sep 17 00:00:00 2001
From: Paul Smith <psmith@gnu.org>
Date: Sun, 22 Sep 2013 11:28:46 -0400
Subject: Regression test portability to Solaris.

---
 tests/scripts/features/archives    | 26 +++++++++++++++++++++-----
 tests/scripts/features/escape      | 10 ++++++----
 tests/scripts/features/jobserver   |  6 ++++--
 tests/scripts/features/output-sync |  2 +-
 tests/scripts/features/parallelism |  4 ++--
 5 files changed, 34 insertions(+), 14 deletions(-)

(limited to 'tests/scripts/features')

diff --git a/tests/scripts/features/archives b/tests/scripts/features/archives
index 15f433b..a7ec881 100644
--- a/tests/scripts/features/archives
+++ b/tests/scripts/features/archives
@@ -13,6 +13,15 @@ utouch(-60, qw(a1.o a2.o a3.o));
 
 # Some versions of ar print different things on creation.  Find out.
 my $created = `ar rv libxx.a a1.o 2>&1`;
+
+# Some versions of ar print different things on add.  Find out.
+my $add = `ar rv libxx.a a2.o 2>&1`;
+$add =~ s/a2\.o/#OBJECT#/g;
+
+# Some versions of ar print different things on replacement.  Find out.
+my $repl = `ar rv libxx.a a2.o 2>&1`;
+$repl =~ s/a2\.o/#OBJECT#/g;
+
 unlink('libxx.a');
 
 # Very simple
@@ -20,12 +29,14 @@ run_make_test('all: libxx.a(a1.o)',
               '', "ar rv libxx.a a1.o\n$created");
 
 # Multiple .o's.  Add a new one to the existing library
+($_ = $add) =~ s/#OBJECT#/a2.o/g;
 run_make_test('all: libxx.a(a1.o a2.o)',
-              '', "ar rv libxx.a a2.o\na - a2.o\n");
+              '', "ar rv libxx.a a2.o\n$_");
 
 # Touch one of the .o's so it's rebuilt
 utouch(-40, 'a1.o');
-run_make_test(undef, '', "ar rv libxx.a a1.o\nr - a1.o\n");
+($_ = $repl) =~ s/#OBJECT#/a1.o/g;
+run_make_test(undef, '', "ar rv libxx.a a1.o\n$_");
 
 # Use wildcards
 run_make_test('all: libxx.a(*.o)',
@@ -33,17 +44,22 @@ run_make_test('all: libxx.a(*.o)',
 
 # Touch one of the .o's so it's rebuilt
 utouch(-30, 'a1.o');
-run_make_test(undef, '', "ar rv libxx.a a1.o\nr - a1.o\n");
+($_ = $repl) =~ s/#OBJECT#/a1.o/g;
+run_make_test(undef, '', "ar rv libxx.a a1.o\n$_");
 
 # Use both wildcards and simple names
 utouch(-50, 'a2.o');
+($_ = $add) =~ s/#OBJECT#/a3.o/g;
+$_ .= "ar rv libxx.a a2.o\n";
+($_ .= $repl) =~ s/#OBJECT#/a2.o/g;
 run_make_test('all: libxx.a(a3.o *.o)', '',
-              "ar rv libxx.a a3.o\na - a3.o\nar rv libxx.a a2.o\nr - a2.o\n");
+              "ar rv libxx.a a3.o\n$_");
 
 # Check whitespace handling
 utouch(-40, 'a2.o');
+($_ = $repl) =~ s/#OBJECT#/a2.o/g;
 run_make_test('all: libxx.a(  a3.o    *.o     )', '',
-              "ar rv libxx.a a2.o\nr - a2.o\n");
+              "ar rv libxx.a a2.o\n$_");
 
 rmfiles(qw(a1.o a2.o a3.o libxx.a));
 
diff --git a/tests/scripts/features/escape b/tests/scripts/features/escape
index 8c2b8ce..bf069df 100644
--- a/tests/scripts/features/escape
+++ b/tests/scripts/features/escape
@@ -54,19 +54,21 @@ run_make_test(undef,
 
 # Test escaped colons in prerequisites
 # Quoting of backslashes in q!! is kind of messy.
+# Solaris sh does not properly handle backslashes even in '' so just
+# check the output make prints, not what the shell interprets.
 run_make_test(q!
 foo: foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar
-foo foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar: ; @echo '$@'
+foo foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar: ; : '$@'
 !,
-              '', "foo:bar\nfoo\\:bar\nfoo\\\\:bar\nfoo\n");
+              '', ": 'foo:bar'\n: 'foo\\:bar'\n: 'foo\\\\:bar'\n: 'foo'\n");
 
 # Test backslash before non-special chars: should be kept as-is
 
 run_make_test(q!
 all: ..\foo
-.DEFAULT: ; @echo '$@'
+.DEFAULT: ; : '$@'
 !,
-              '', '..\foo');
+              '', ": '..\\foo'\n");
 
 # This tells the test driver that the perl test script executed properly.
 1;
diff --git a/tests/scripts/features/jobserver b/tests/scripts/features/jobserver
index 6a9565e..f2c6787 100644
--- a/tests/scripts/features/jobserver
+++ b/tests/scripts/features/jobserver
@@ -19,6 +19,8 @@ if (!$parallel_jobs) {
 # get one from the original invocation and none from the re-exec.
 # See Savannah bug #18124
 
+unlink('inc.mk');
+
 run_make_test(q!
 -include inc.mk
 recur:
@@ -34,7 +36,7 @@ inc.mk:
 !,
               '--no-print-directory -j2', "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n");
 
-rmfiles('inc.mk');
+unlink('inc.mk');
 
 # Test recursion when make doesn't think it exists.
 # See Savannah bug #39934
@@ -54,6 +56,6 @@ default: ; @ #MAKEPATH# -f Makefile2
 "#MAKE#[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
 #MAKE#[1]: Nothing to be done for 'foo'.");
 
-unlink('Makefile2');
+rmfiles('Makefile2');
 
 1;
diff --git a/tests/scripts/features/output-sync b/tests/scripts/features/output-sync
index e2e88a7..75d7e81 100644
--- a/tests/scripts/features/output-sync
+++ b/tests/scripts/features/output-sync
@@ -91,7 +91,7 @@ foo-fail:
 \t\@echo foo-fail: start
 \t\@$wait_bar
 \t\@echo foo-fail: end
-\t\@false
+\t\@exit 1
 EOF
 close(MAKEFILE);
 
diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
index 1f56748..c702c26 100644
--- a/tests/scripts/features/parallelism
+++ b/tests/scripts/features/parallelism
@@ -41,7 +41,7 @@ all: 1 2; \@echo success
 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
               "-j4",
-              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
+              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7);
 
 rmfiles(qw(1.inc 2.inc));
 
@@ -60,7 +60,7 @@ endif
 1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
 2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
               "-j4",
-              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
+              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7);
 
 rmfiles(qw(1.inc 2.inc));
 
-- 
cgit v1.2.3