xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/features/echoing (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos$description = "The following test creates a makefile to test command \n"
2*69606e3fSchristos              ."echoing.  It tests that when a command line starts with \n"
3*69606e3fSchristos              ."a '\@', the echoing of that line is suppressed.  It also \n"
4*69606e3fSchristos              ."tests the -n option which tells make to ONLY echo the  \n"
5*69606e3fSchristos              ."commands and no execution happens.  In this case, even \n"
6*69606e3fSchristos              ."the commands with '\@' are printed. Lastly, it tests the \n"
7*69606e3fSchristos              ."-s flag which tells make to prevent all echoing, as if \n"
8*69606e3fSchristos              ."all commands started with a '\@'.";
9*69606e3fSchristos
10*69606e3fSchristos$details = "This test is similar to the 'clean' test except that a '\@' has\n"
11*69606e3fSchristos          ."been placed in front of the delete command line.  Four tests \n"
12*69606e3fSchristos          ."are run here.  First, make is run normally and the first echo\n"
13*69606e3fSchristos          ."command should be executed.  In this case there is no '\@' so \n"
14*69606e3fSchristos          ."we should expect make to display the command AND display the \n"
15*69606e3fSchristos          ."echoed message.  Secondly, make is run with the clean target, \n"
16*69606e3fSchristos          ."but since there is a '\@' at the beginning of the command, we\n"
17*69606e3fSchristos          ."expect no output; just the deletion of a file which we check \n"
18*69606e3fSchristos          ."for.  Third, we give the clean target again except this time\n"
19*69606e3fSchristos          ."we give make the -n option.  We now expect the command to be \n"
20*69606e3fSchristos          ."displayed but not to be executed.  In this case we need only \n"
21*69606e3fSchristos          ."to check the output since an error message would be displayed\n"
22*69606e3fSchristos          ."if it actually tried to run the delete command again and the \n"
23*69606e3fSchristos          ."file didn't exist. Lastly, we run the first test again with \n"
24*69606e3fSchristos          ."the -s option and check that make did not echo the echo \n"
25*69606e3fSchristos          ."command before printing the message.";
26*69606e3fSchristos
27*69606e3fSchristos$example = "EXAMPLE_FILE";
28*69606e3fSchristos
29*69606e3fSchristosopen(MAKEFILE,"> $makefile");
30*69606e3fSchristos
31*69606e3fSchristos# The Contents of the MAKEFILE ...
32*69606e3fSchristos
33*69606e3fSchristosprint MAKEFILE "all: \n";
34*69606e3fSchristosprint MAKEFILE "\techo This makefile did not clean the dir... good\n";
35*69606e3fSchristosprint MAKEFILE "clean: \n";
36*69606e3fSchristosprint MAKEFILE "\t\@$delete_command $example\n";
37*69606e3fSchristos
38*69606e3fSchristos# END of Contents of MAKEFILE
39*69606e3fSchristos
40*69606e3fSchristosclose(MAKEFILE);
41*69606e3fSchristos
42*69606e3fSchristos&touch($example);
43*69606e3fSchristos
44*69606e3fSchristos# TEST #1
45*69606e3fSchristos# -------
46*69606e3fSchristos
47*69606e3fSchristos&run_make_with_options($makefile,"",&get_logfile,0);
48*69606e3fSchristos$answer = "echo This makefile did not clean the dir... good\n"
49*69606e3fSchristos         ."This makefile did not clean the dir... good\n";
50*69606e3fSchristos&compare_output($answer,&get_logfile(1));
51*69606e3fSchristos
52*69606e3fSchristos
53*69606e3fSchristos# TEST #2
54*69606e3fSchristos# -------
55*69606e3fSchristos
56*69606e3fSchristos&run_make_with_options($makefile,"clean",&get_logfile,0);
57*69606e3fSchristosif (-f $example) {
58*69606e3fSchristos  $test_passed = 0;
59*69606e3fSchristos}
60*69606e3fSchristos&compare_output('',&get_logfile(1));
61*69606e3fSchristos
62*69606e3fSchristos# TEST #3
63*69606e3fSchristos# -------
64*69606e3fSchristos
65*69606e3fSchristos&run_make_with_options($makefile,"-n clean",&get_logfile,0);
66*69606e3fSchristos$answer = "$delete_command $example\n";
67*69606e3fSchristos&compare_output($answer,&get_logfile(1));
68*69606e3fSchristos
69*69606e3fSchristos
70*69606e3fSchristos# TEST #4
71*69606e3fSchristos# -------
72*69606e3fSchristos
73*69606e3fSchristos&run_make_with_options($makefile,"-s",&get_logfile,0);
74*69606e3fSchristos$answer = "This makefile did not clean the dir... good\n";
75*69606e3fSchristos&compare_output($answer,&get_logfile(1));
76*69606e3fSchristos
77*69606e3fSchristos
78*69606e3fSchristos1;
79*69606e3fSchristos
80*69606e3fSchristos
81*69606e3fSchristos
82*69606e3fSchristos
83*69606e3fSchristos
84*69606e3fSchristos
85*69606e3fSchristos
86*69606e3fSchristos
87*69606e3fSchristos
88