Imported Upstream version 3.82
[platform/upstream/make.git] / tests / scripts / options / dash-t
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
15 open(MAKEFILE, "> $makefile");
16 print MAKEFILE <<'EOMAKE';
17 final-a: interm-a ; echo >> $@
18 final-b: interm-b ; echo >> $@
19 interm-a:: orig1-a ; echo >> $@
20 interm-a:: orig2-a ; echo >> $@
21 interm-b:: orig1-b ; echo >> $@
22 interm-b:: orig2-b ; echo >> $@
23 EOMAKE
24 close(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
35 unlink('orig1-a', 'orig2-a', 'interm-a', 'final-a');
36 unlink('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
43 open(MAKEFILE, "> $makefile2");
44 print MAKEFILE <<'EOMAKE';
45
46 PHOOEY: xxx
47 xxx: ; @:
48
49 EOMAKE
50 close(MAKEFILE);
51
52 &run_make_with_options($makefile2, "-t", &get_logfile);
53 $answer = "touch xxx\n";
54 &compare_output($answer, &get_logfile(1));
55
56 unlink('xxx');
57
58 1;