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