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