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