1 | $description = "The following tests the -i option and the '-' in front of \n"
|
---|
2 | ."commands to test that make ignores errors in these commands\n"
|
---|
3 | ."and continues processing.";
|
---|
4 |
|
---|
5 | $details = "This test runs two makes. The first runs on a target with a \n"
|
---|
6 | ."command that has a '-' in front of it (and a command that is \n"
|
---|
7 | ."intended to fail) and then a delete command after that is \n"
|
---|
8 | ."intended to succeed. If make ignores the failure of the first\n"
|
---|
9 | ."command as it is supposed to, then the second command should \n"
|
---|
10 | ."delete a file and this is what we check for. The second make\n"
|
---|
11 | ."that is run in this test is identical except that the make \n"
|
---|
12 | ."command is given with the -i option instead of the '-' in \n"
|
---|
13 | ."front of the command. They should run the same. ";
|
---|
14 |
|
---|
15 | if ($vos)
|
---|
16 | {
|
---|
17 | $delete_command = "delete_file";
|
---|
18 | }
|
---|
19 | else
|
---|
20 | {
|
---|
21 | $delete_command = "rm";
|
---|
22 | }
|
---|
23 |
|
---|
24 | open(MAKEFILE,"> $makefile");
|
---|
25 |
|
---|
26 | # The Contents of the MAKEFILE ...
|
---|
27 |
|
---|
28 | print MAKEFILE "clean:\n"
|
---|
29 | ."\t-$delete_command cleanit\n"
|
---|
30 | ."\t$delete_command foo\n"
|
---|
31 | ."clean2: \n"
|
---|
32 | ."\t$delete_command cleanit\n"
|
---|
33 | ."\t$delete_command foo\n";
|
---|
34 |
|
---|
35 | # END of Contents of MAKEFILE
|
---|
36 |
|
---|
37 | close(MAKEFILE);
|
---|
38 |
|
---|
39 | &touch("foo");
|
---|
40 |
|
---|
41 | unlink("cleanit");
|
---|
42 | $cleanit_error = `sh -c "$delete_command cleanit 2>&1"`;
|
---|
43 | $delete_error_code = $? >> 8;
|
---|
44 |
|
---|
45 | # TEST #1
|
---|
46 | # -------
|
---|
47 |
|
---|
48 | $answer = "$delete_command cleanit\n"
|
---|
49 | . $cleanit_error
|
---|
50 | ."$make_name: [clean] Error $delete_error_code (ignored)\n"
|
---|
51 | ."$delete_command foo\n";
|
---|
52 |
|
---|
53 | &run_make_with_options($makefile,"",&get_logfile);
|
---|
54 |
|
---|
55 | # The output for this on VOS is too hard to replicate, so we only check it
|
---|
56 | # on unix.
|
---|
57 | if (!$vos)
|
---|
58 | {
|
---|
59 | &compare_output($answer,&get_logfile(1));
|
---|
60 | }
|
---|
61 |
|
---|
62 | # If make acted as planned, it should ignore the error from the first
|
---|
63 | # command in the target and execute the second which deletes the file "foo"
|
---|
64 | # This file, therefore, should not exist if the test PASSES.
|
---|
65 | if (-f "foo")
|
---|
66 | {
|
---|
67 | $test_passed = 0;
|
---|
68 | }
|
---|
69 |
|
---|
70 |
|
---|
71 | &touch("foo");
|
---|
72 |
|
---|
73 | # TEST #2
|
---|
74 | # -------
|
---|
75 |
|
---|
76 | $answer = "$delete_command cleanit\n"
|
---|
77 | . $cleanit_error
|
---|
78 | ."$make_name: [clean2] Error $delete_error_code (ignored)\n"
|
---|
79 | ."$delete_command foo\n";
|
---|
80 |
|
---|
81 | &run_make_with_options($makefile,"clean2 -i",&get_logfile);
|
---|
82 |
|
---|
83 | if (!$vos)
|
---|
84 | {
|
---|
85 | &compare_output($answer,&get_logfile(1));
|
---|
86 | }
|
---|
87 |
|
---|
88 | if (-f "foo")
|
---|
89 | {
|
---|
90 | $test_passed = 0;
|
---|
91 | }
|
---|
92 |
|
---|
93 | 1;
|
---|