summaryrefslogtreecommitdiff
path: root/tests/scripts/features/parallelism
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-09-14 02:03:19 +0000
committerPaul Smith <psmith@gnu.org>1999-09-14 02:03:19 +0000
commit0d366b668244112846554c42045ff1d9956276ed (patch)
tree3802242fe18a5e90d889f5d1ac66fb487361888b /tests/scripts/features/parallelism
parent4121dea6a59367b4431cbe7a3c43d74fec9fd832 (diff)
downloadgunmake-0d366b668244112846554c42045ff1d9956276ed.tar.gz
* Added the test suite to the main distribution.
Diffstat (limited to 'tests/scripts/features/parallelism')
-rw-r--r--tests/scripts/features/parallelism76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/scripts/features/parallelism b/tests/scripts/features/parallelism
new file mode 100644
index 0000000..17e800c
--- /dev/null
+++ b/tests/scripts/features/parallelism
@@ -0,0 +1,76 @@
+# -*-perl-*-
+
+$description = "Test parallelism (-j) option.";
+
+
+$details = "This test creates a makefile with three double-colon default
+rules. The first rule has a series of sleep and echo commands
+intended to run in series. The second and third have just an
+echo statement. When make is called in this test, it is given
+the -j option with a value of 4. This tells make that it may
+start up to four jobs simultaneously. In this case, since the
+first command is a sleep command, the output of the second
+and third commands will appear before the first if indeed
+make is running all of these commands in parallel.";
+
+if (!$parallel_jobs) {
+ return -1;
+}
+
+if ($vos) {
+ $delete_command = "delete_file -no_ask";
+ $sleep_command = "sleep -seconds";
+}
+else {
+ $delete_command = "rm -f";
+ $sleep_command = "sleep";
+}
+
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<"EOF";
+all : def_1 def_5 def_6
+def_1 :
+\t\@$sleep_command 3 ; echo ONE
+\t\@echo TWO
+\t\@$sleep_command 1 ; echo THREE
+\t\@echo FOUR
+def_5 :
+\t\@echo FIVE
+def_6 :
+\t\@$sleep_command 1 ; echo SIX
+
+EOF
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile, "-j 4", &get_logfile);
+$answer = "FIVE\nSIX\nONE\nTWO\nTHREE\nFOUR\n";
+&compare_output($answer, &get_logfile(1));
+
+
+# Test parallelism with included files
+
+$makefile2 = &get_tmpfile;
+
+open(MAKEFILE,"> $makefile2");
+
+print MAKEFILE <<'EOF';
+all: 1 2 3; @echo success
+
+-include 1.inc 2.inc 3.inc
+
+ 1.inc: ; @sleep 1; echo 1; echo "1: ; @echo $@ has been included" > $@
+2.inc: ; @sleep 2; echo 2; echo "2: ; @echo $@ has been included" > $@
+3.inc: ; @echo 3; echo "3: ; @echo $@ has been included" > $@
+EOF
+
+close(MAKEFILE);
+
+&run_make_with_options("$makefile2", "-j 4", &get_logfile);
+$answer = "3\n1\n2\n1.inc has been included\n2.inc has been included\n3.inc has been included\nsuccess\n";
+&compare_output($answer, &get_logfile(1));
+
+unlink('1.inc', '2.inc', '3.inc');
+
+1;