source: trunk/src/kmk/tests/scripts/options/dash-W

Last change on this file was 3140, checked in by bird, 7 years ago

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

  • Property svn:eol-style set to LF
File size: 1.9 KB
Line 
1# -*-perl-*-
2
3$description = "Test make -W (what if) option.\n";
4
5# Basic build
6
7run_make_test('
8a.x: b.x
9a.x b.x: ; echo >> $@
10',
11 '', "echo >> b.x\necho >> a.x");
12
13# Run it again: nothing should happen
14
15run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
16
17# Now run it with -W b.x: should rebuild a.x
18
19run_make_test(undef, '-W b.x', 'echo >> a.x');
20
21# Put the timestamp for a.x into the future; it should still be remade.
22
23utouch(1000, 'a.x');
24run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
25run_make_test(undef, '-W b.x', 'echo >> a.x');
26
27# Clean up
28
29rmfiles('a.x', 'b.x');
30
31# Test -W with the re-exec feature: we don't want to re-exec forever
32# Savannah bug # 7566
33
34# First set it up with a normal build
35
36run_make_test('
37all: baz.x ; @:
38include foo.x
39foo.x: bar.x
40 @echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
41 @echo "touch $@"
42bar.x: ; echo >> $@
43baz.x: bar.x ; @echo "touch $@"
44',
45 '', 'echo >> bar.x
46touch foo.x
47restarts=1
48touch baz.x');
49
50# Now run with -W bar.x
51
52# Tweak foo.x's timestamp so the update will change it.
53&utouch(1000, 'foo.x');
54
55run_make_test(undef, '-W bar.x', "restarts=\ntouch foo.x\nrestarts=1\ntouch baz.x");
56
57rmfiles('foo.x', 'bar.x');
58
59# Test -W on vpath-found files: it should take effect.
60# Savannah bug # 15341
61
62mkdir('x-dir', 0777);
63utouch(-20, 'x-dir/x');
64touch('y');
65
66run_make_test('
67y: x ; @echo cp $< $@
68',
69 '-W x-dir/x VPATH=x-dir',
70 'cp x-dir/x y');
71
72# Make sure ./ stripping doesn't interfere with the match.
73
74run_make_test('
75y: x ; @echo cp $< $@
76',
77 '-W ./x-dir/x VPATH=x-dir',
78 'cp x-dir/x y');
79
80run_make_test(undef,
81 '-W x-dir/x VPATH=./x-dir',
82 'cp ./x-dir/x y');
83
84unlink(qw(y x-dir/x));
85rmdir('x-dir');
86
871;
88
89### Local Variables:
90### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
91### End:
Note: See TracBrowser for help on using the repository browser.