Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines.
[make.git] / tests / scripts / features / errors
blobc0339cb60ef4e69b25445c581a6cc73b0c2a6b0f
1 #                                                                    -*-perl-*-
3 $description = "The following tests the -i option and the '-' in front of \n"
4               ."commands to test that make ignores errors in these commands\n"
5               ."and continues processing.";
7 $details = "This test runs two makes.  The first runs on a target with a \n"
8           ."command that has a '-' in front of it (and a command that is \n"
9           ."intended to fail) and then a delete command after that is \n"
10           ."intended to succeed.  If make ignores the failure of the first\n"
11           ."command as it is supposed to, then the second command should \n"
12           ."delete a file and this is what we check for.  The second make\n"
13           ."that is run in this test is identical except that the make \n"
14           ."command is given with the -i option instead of the '-' in \n"
15           ."front of the command.  They should run the same. ";
17 if ($vos)
19    $rm_command = "delete_file";
21 else
23    $rm_command = "rm";
26 open(MAKEFILE,"> $makefile");
28 # The Contents of the MAKEFILE ...
30 print MAKEFILE "clean:\n"
31               ."\t-$rm_command cleanit\n"
32               ."\t$rm_command foo\n"
33               ."clean2: \n"
34               ."\t$rm_command cleanit\n"
35               ."\t$rm_command foo\n";
37 # END of Contents of MAKEFILE
39 close(MAKEFILE);
41 &touch("foo");
43 unlink("cleanit");
44 $cleanit_error = `sh -c "$rm_command cleanit 2>&1"`;
45 chomp $cleanit_error;
46 $delete_error_code = $? >> 8;
48 # TEST #1
49 # -------
51 $answer = "$rm_command cleanit
52 $cleanit_error
53 $makefile:2: recipe for target 'clean' failed
54 $make_name: [clean] Error $delete_error_code (ignored)
55 $rm_command foo\n";
57 &run_make_with_options($makefile,"",&get_logfile);
59 # If make acted as planned, it should ignore the error from the first
60 # command in the target and execute the second which deletes the file "foo"
61 # This file, therefore, should not exist if the test PASSES.
62 if (-f "foo") {
63   $test_passed = 0;
66 # The output for this on VOS is too hard to replicate, so we only check it
67 # on unix.
68 if (!$vos)
70    &compare_output($answer,&get_logfile(1));
74 &touch("foo");
76 # TEST #2
77 # -------
79 $answer = "$rm_command cleanit
80 $cleanit_error
81 $makefile:5: recipe for target 'clean2' failed
82 $make_name: [clean2] Error $delete_error_code (ignored)
83 $rm_command foo\n";
85 &run_make_with_options($makefile,"clean2 -i",&get_logfile);
87 if (-f "foo") {
88   $test_passed = 0;
91 if (!$vos) {
92    &compare_output($answer,&get_logfile(1));