/[make]/make/tests/scripts/features/parallelism
ViewVC logotype

Diff of /make/tests/scripts/features/parallelism

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by psmith, Fri Apr 8 12:51:21 2005 UTC revision 1.5 by psmith, Tue May 3 13:57:21 2005 UTC
# Line 26  else { Line 26  else {
26    $sleep_command = "sleep";    $sleep_command = "sleep";
27  }  }
28    
 open(MAKEFILE,"> $makefile");  
29    
30  print MAKEFILE <<"EOF";  run_make_test("
31  all : def_1 def_2 def_3  all : def_1 def_2 def_3
32  def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO  def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO
33  def_2 : ; \@$sleep_command 2 ; echo THREE  def_2 : ; \@$sleep_command 2 ; echo THREE
34  def_3 : ; \@$sleep_command 1 ; echo FOUR  def_3 : ; \@$sleep_command 1 ; echo FOUR",
35  EOF                '-j4', "ONE\nFOUR\nTHREE\nTWO");
   
 close(MAKEFILE);  
   
 &run_make_with_options($makefile, "-j 4", &get_logfile);  
 $answer = "ONE\nFOUR\nTHREE\nTWO\n";  
 &compare_output($answer, &get_logfile(1));  
   
36    
37  # Test parallelism with included files.  Here we sleep/echo while  # Test parallelism with included files.  Here we sleep/echo while
38  # building the included files, to test that they are being built in  # building the included files, to test that they are being built in
39  # parallel.  # parallel.
40    run_make_test("
 $makefile2 = &get_tmpfile;  
   
 open(MAKEFILE,"> $makefile2");  
   
 print MAKEFILE <<"EOF";  
41  all: 1 2; \@echo success  all: 1 2; \@echo success
   
42  -include 1.inc 2.inc  -include 1.inc 2.inc
43    1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
44  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' > \$\@",
45  2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@                "-j4",
46  EOF                "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
   
 close(MAKEFILE);  
   
 &run_make_with_options("$makefile2", "-j 4", &get_logfile);  
 $answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n";  
 &compare_output($answer, &get_logfile(1));  
47    
48  unlink('1.inc', '2.inc');  unlink('1.inc', '2.inc');
49    
50    
51  # Test parallelism with included files--this time recurse first and make  # Test parallelism with included files--this time recurse first and make
52  # sure the jobserver works.  # sure the jobserver works.
53    run_make_test("
54  $makefile3 = &get_tmpfile;  recurse: ; \@\$(MAKE) --no-print-directory -f #MAKEFILE# INC=yes all
   
 open(MAKEFILE,"> $makefile3");  
   
 print MAKEFILE <<"EOF";  
 recurse: ; \@\$(MAKE) --no-print-directory -f $makefile3 INC=yes all  
   
55  all: 1 2; \@echo success  all: 1 2; \@echo success
56    
57  INC = no  INC = no
# Line 85  ifeq (\$(INC),yes) Line 59  ifeq (\$(INC),yes)
59  -include 1.inc 2.inc  -include 1.inc 2.inc
60  endif  endif
61    
62  1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@  1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
63  2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@  2.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
64  EOF                "-j4",
65                  "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
 close(MAKEFILE);  
   
 &run_make_with_options("$makefile3", "-j 4", &get_logfile);  
 $answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n";  
 &compare_output($answer, &get_logfile(1));  
66    
67  unlink('1.inc', '2.inc');  unlink('1.inc', '2.inc');
68    
69  # Test shell functions within commands: make sure they're not reducing our  # Grant Taylor reports a problem where tokens can be lost (not written back
70  # parallelism.  # to the pipe when they should be): this happened when there is a $(shell ...)
71    # function in an exported recursive variable.  I added some code to check
72    # for this situation and print a message if it occurred.  This test used
73    # to trigger this code when I added it but no longer does after the fix.
74    
75    run_make_test("
76    export HI = \$(shell \$(\$\@.CMD))
77    first.CMD = echo hi
78    second.CMD = $sleep_command 4; echo hi
79    
80    .PHONY: all first second
81    all: first second
82    
83  run_make_test('.PHONY: all  first second: ; \@echo \$\@; $sleep_command 1; echo \$\@",
84  all: ; @echo $(shell echo hi)                '-j2', "first\nfirst\nsecond\nsecond");
 ','','hi');  
85    
86  1;  1;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26