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

Diff of /make/tests/scripts/features/order_only

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

revision 1.4 by psmith, Sun May 16 19:16:55 2004 UTC revision 1.5 by psmith, Mon Oct 24 13:01:41 2005 UTC
# Line 5  $details = "\ Line 5  $details = "\
5  Create makefiles with various combinations of normal and order-only  Create makefiles with various combinations of normal and order-only
6  prerequisites and ensure they behave properly.  Test the \$| variable.";  prerequisites and ensure they behave properly.  Test the \$| variable.";
7    
8  open(MAKEFILE,"> $makefile");  # TEST #0 -- Basics
9    
10  print MAKEFILE <<'EOF';  run_make_test('
11    %r: | baz ; @echo $< $^ $|
12    bar: foo
13    foo:;@:
14    baz:;@:',
15                  '', "foo foo baz\n");
16    
17    # TEST #1 -- First try: the order-only prereqs need to be built.
18    
19    run_make_test(q!
20  foo: bar | baz  foo: bar | baz
21          @echo '$$^ = $^'          @echo '$$^ = $^'
22          @echo '$$| = $|'          @echo '$$| = $|'
# Line 16  foo: bar | baz Line 25  foo: bar | baz
25  .PHONY: baz  .PHONY: baz
26    
27  bar baz:  bar baz:
28          touch $@          touch $@!,
29  EOF                '', "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n");
   
 close(MAKEFILE);  
   
   
 # TEST #1 -- just the syntax  
   
 &run_make_with_options($makefile, "", &get_logfile);  
 $answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n";  
 &compare_output($answer,&get_logfile(1));  
30    
31    
32  # TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated  # TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated
33    
34  &run_make_with_options($makefile, "", &get_logfile);  run_make_test(undef, '', "touch baz\n");
 $answer = "touch baz\n";  
 &compare_output($answer,&get_logfile(1));  
35    
36  unlink(qw(foo bar baz));  unlink(qw(foo bar baz));
37    
38  # Test prereqs that are both order and non-order  # TEST #3 -- Make sure the order-only prereq was promoted to normal.
   
 $makefile2 = &get_tmpfile;  
   
 open(MAKEFILE,"> $makefile2");  
39    
40  print MAKEFILE <<'EOF';  run_make_test(q!
41  foo: bar | baz  foo: bar | baz
42          @echo '$$^ = $^'          @echo '$$^ = $^'
43          @echo '$$| = $|'          @echo '$$| = $|'
# Line 54  foo: baz Line 48  foo: baz
48  .PHONY: baz  .PHONY: baz
49    
50  bar baz:  bar baz:
51          touch $@          touch $@!,
52  EOF                '', "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n");
   
 close(MAKEFILE);  
   
 # TEST #3 -- Make sure the order-only prereq was promoted to normal.  
   
 &run_make_with_options($makefile2, "", &get_logfile);  
 $answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";  
 &compare_output($answer,&get_logfile(1));  
53    
54    
55  # TEST #4 -- now we do it again  # TEST #4 -- now we do it again
56    
57  &run_make_with_options($makefile2, "", &get_logfile);  run_make_test(undef, '', "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n");
 $answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";  
 &compare_output($answer,&get_logfile(1));  
58    
59  unlink(qw(foo bar baz));  unlink(qw(foo bar baz));
60    
61  # Test empty normal prereqs  # Test empty normal prereqs
62    
63  $makefile3 = &get_tmpfile;  # TEST #5 -- make sure the parser was correct.
   
 open(MAKEFILE,"> $makefile3");  
64    
65  print MAKEFILE <<'EOF';  run_make_test(q!
66  foo:| baz  foo:| baz
67          @echo '$$^ = $^'          @echo '$$^ = $^'
68          @echo '$$| = $|'          @echo '$$| = $|'
# Line 89  foo:| baz Line 71  foo:| baz
71  .PHONY: baz  .PHONY: baz
72    
73  baz:  baz:
74          touch $@          touch $@!,
75  EOF                '', "touch baz\n\$^ = \n\$| = baz\ntouch foo\n");
   
 close(MAKEFILE);  
   
 # TEST #5 -- make sure the parser was correct.  
   
 &run_make_with_options($makefile3, "", &get_logfile);  
 $answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n";  
 &compare_output($answer,&get_logfile(1));  
   
76    
77  # TEST #6 -- now we do it again: this time foo won't be built  # TEST #6 -- now we do it again: this time foo won't be built
78    
79  &run_make_with_options($makefile3, "", &get_logfile);  run_make_test(undef, '', "touch baz\n");
 $answer = "touch baz\n";  
 &compare_output($answer,&get_logfile(1));  
80    
81  unlink(qw(foo baz));  unlink(qw(foo baz));
82    
83  # Test order-only in pattern rules  # Test order-only in pattern rules
84    
85  $makefile4 = &get_tmpfile;  # TEST #7 -- make sure the parser was correct.
   
 open(MAKEFILE,"> $makefile4");  
86    
87  print MAKEFILE <<'EOF';  run_make_test(q!
88  %.w : %.x | baz  %.w : %.x | baz
89          @echo '$$^ = $^'          @echo '$$^ = $^'
90          @echo '$$| = $|'          @echo '$$| = $|'
# Line 125  all: foo.w Line 94  all: foo.w
94    
95  .PHONY: baz  .PHONY: baz
96  foo.x baz:  foo.x baz:
97          touch $@          touch $@!,
98  EOF                '',
99                  "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n");
 close(MAKEFILE);  
   
 # TEST #7 -- make sure the parser was correct.  
   
 &run_make_with_options($makefile4, "", &get_logfile);  
 $answer = "touch foo.x\ntouch baz\n\$^ = foo.x\n\$| = baz\ntouch foo.w\n";  
 &compare_output($answer,&get_logfile(1));  
100    
101  # TEST #8 -- now we do it again: this time foo.w won't be built  # TEST #8 -- now we do it again: this time foo.w won't be built
102    
103  &run_make_with_options($makefile4, "", &get_logfile);  run_make_test(undef, '', "touch baz\n");
 $answer = "touch baz\n";  
 &compare_output($answer,&get_logfile(1));  
104    
105  unlink(qw(foo.w foo.x baz));  unlink(qw(foo.w foo.x baz));
106    
# Line 151  run_make_test(' Line 111  run_make_test('
111  %r: | baz ; @echo $< $^ $|  %r: | baz ; @echo $< $^ $|
112  bar: foo  bar: foo
113  foo:;@:  foo:;@:
114  baz:;@:  baz:;@:',
115  ', '', "foo foo baz\n");                '', "foo foo baz\n");
116    
117    
118  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