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