Debian Codegraph @

tests/scripts/targets/NOTINTERMEDIATE

raw
1 # -*-perl-*-
2
3 $description = "Test the behaviour of the .NOTINTERMEDIATE target.";
4
5 $details = "\
6 Test the behavior of the .NOTINTERMEDIATE special target.\n";
7
8 touch('hello.z');
9 unlink('hello.x');
10
11
12 # Test 1. A file which matches a .NOTINTERMEDIATE pattern is not intermediate.
13 run_make_test(q!
14 hello.z:
15 %.z: %.x; touch $@
16 %.x: ;
17 .NOTINTERMEDIATE: %.q %.x
18 !, '', "touch hello.z\n");
19
20 # Test 2. .NOTINTERMEDIATE: %.q pattern has no effect on hello.x.
21 touch('hello.z');
22 run_make_test(q!
23 hello.z:
24 %.z: %.x; touch $@
25 %.x: ;
26 .NOTINTERMEDIATE: %.q
27 !, '', "#MAKE#: 'hello.z' is up to date.\n");
28
29 # Test 3. A file which is a prereq of .NOTINTERMEDIATE is not intermediate.
30 run_make_test(q!
31 hello.z:
32 %.z: %.x; touch $@
33 %.x: ;
34 .NOTINTERMEDIATE: %.q hello.x
35 !, '', "touch hello.z\n");
36
37 # Test 4. .NOTINTERMEDIATE without prerequisites makes everything
38 # notintermediate.
39 run_make_test(q!
40 hello.z:
41 %.z: %.x; touch $@
42 %.x: ;
43 .NOTINTERMEDIATE:
44 !, '', "touch hello.z\n");
45
46 # Test 5. Same file cannot be intermediate and notintermediate.
47 run_make_test(q!
48 .INTERMEDIATE: hello.x
49 .NOTINTERMEDIATE: hello.x
50 !, '', "#MAKE#: *** hello.x cannot be both .NOTINTERMEDIATE and .INTERMEDIATE. Stop.\n", 512);
51
52 # Test 6. Same file cannot be secondary and notintermediate.
53 run_make_test(q!
54 .SECONDARY: hello.x
55 .NOTINTERMEDIATE: hello.x
56 !, '', "#MAKE#: *** hello.x cannot be both .NOTINTERMEDIATE and .SECONDARY. Stop.\n", 512);
57
58 # Test 7. All .SECONDARY and all .NOTINTERMEDIATE are mutually exclusive.
59 run_make_test(q!
60 .SECONDARY:
61 .NOTINTERMEDIATE:
62 !, '', "#MAKE#: *** .NOTINTERMEDIATE and .SECONDARY are mutually exclusive. Stop.\n", 512);
63
64 # Test 8. .INTERMEDIATE file takes priority over a .NOTINTERMEDIATE pattern.
65 unlink('hello.x');
66 run_make_test(q!
67 hello.z:
68 %.z: %.x; touch $@
69 %.x: ;
70 .INTERMEDIATE: hello.x
71 .NOTINTERMEDIATE: %.q %.x
72 !, '', "#MAKE#: 'hello.z' is up to date.\n");
73
74 # Test 9. Everything is notintermediate, except hello.x.
75 unlink('hello.x');
76 run_make_test(q!
77 hello.z:
78 %.z: %.x; touch $@
79 %.x: ;
80 .INTERMEDIATE: hello.x
81 .NOTINTERMEDIATE:
82 !, '', "#MAKE#: 'hello.z' is up to date.\n");
83
84 # Test 10. Everything is notintermediate, except hello.x.
85 unlink('hello.x');
86 run_make_test(q!
87 hello.z:
88 %.z: %.x; touch $@
89 %.x: ;
90 .SECONDARY: hello.x
91 .NOTINTERMEDIATE:
92 !, '', "#MAKE#: 'hello.z' is up to date.\n");
93
94 # Test 11. Everything is secondary, except %.q, hello.x.
95 unlink('hello.x');
96 run_make_test(q!
97 hello.z:
98 %.z: %.x; touch $@
99 %.x: ;
100 .NOTINTERMEDIATE: %.q hello.x
101 .SECONDARY:
102 !, '', "touch hello.z\n");
103
104 # Test 12. Everything is secondary, except %.q %.x.
105 unlink('hello.x');
106 run_make_test(q!
107 hello.z:
108 %.z: %.x; touch $@
109 %.x: ;
110 .NOTINTERMEDIATE: %.q %.x
111 .SECONDARY:
112 !, '', "touch hello.z\n");
113
114 unlink('hello.z');
115 # This tells the test driver that the perl test script executed properly.
116 1;