1#                                                                    -*-perl-*-
2
3$description = "Test the -t option.\n";
4
5$details = "Look out for regressions of prior bugs related to -t.\n";
6# That means, nobody has even tried to make the tests below comprehensive
7
8# TEST 0
9# bug reported by Henning Makholm <henning@makholm.net> on 2001-11-03:
10#   make 3.79.1 touches only interm-[ab] but reports final-[a] as
11#   'up to date' without touching them.
12# The 'obvious' fix didn't work for double-colon rules, so pay special
13# attention to them.
14
15open(MAKEFILE, "> $makefile");
16print MAKEFILE <<'EOMAKE';
17final-a: interm-a ; echo >> $@
18final-b: interm-b ; echo >> $@
19interm-a:: orig1-a ; echo >> $@
20interm-a:: orig2-a ; echo >> $@
21interm-b:: orig1-b ; echo >> $@
22interm-b:: orig2-b ; echo >> $@
23EOMAKE
24close(MAKEFILE);
25
26&utouch(-30, 'orig1-a','orig2-b');
27&utouch(-20, 'interm-a','interm-b');
28&utouch(-10, 'final-a','final-b');
29&touch('orig2-a','orig1-b');
30
31&run_make_with_options($makefile, "-t final-a final-b", &get_logfile);
32$answer = "touch interm-a\ntouch final-a\ntouch interm-b\ntouch final-b\n";
33&compare_output($answer, &get_logfile(1));
34
35unlink('orig1-a', 'orig2-a', 'interm-a', 'final-a');
36unlink('orig1-b', 'orig2-b', 'interm-b', 'final-b');
37
38# TEST 1
39# -t should not touch files with no commands.
40
41$makefile2 = &get_tmpfile;
42
43open(MAKEFILE, "> $makefile2");
44print MAKEFILE <<'EOMAKE';
45
46PHOOEY: xxx
47xxx: ; @:
48
49EOMAKE
50close(MAKEFILE);
51
52&run_make_with_options($makefile2, "-t", &get_logfile);
53$answer = "touch xxx\n";
54&compare_output($answer, &get_logfile(1));
55
56unlink('xxx');
57
581;
59