1 | # -*-perl-*-
|
---|
2 |
|
---|
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.";
|
---|
6 |
|
---|
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. ";
|
---|
16 |
|
---|
17 | if ($vos)
|
---|
18 | {
|
---|
19 | $rm_command = "delete_file";
|
---|
20 | }
|
---|
21 | else
|
---|
22 | {
|
---|
23 | $rm_command = "rm";
|
---|
24 | }
|
---|
25 |
|
---|
26 | open(MAKEFILE,"> $makefile");
|
---|
27 |
|
---|
28 | # The Contents of the MAKEFILE ...
|
---|
29 |
|
---|
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";
|
---|
36 |
|
---|
37 | # END of Contents of MAKEFILE
|
---|
38 |
|
---|
39 | close(MAKEFILE);
|
---|
40 |
|
---|
41 | &touch("foo");
|
---|
42 |
|
---|
43 | unlink("cleanit");
|
---|
44 | $cleanit_error = `sh -c "$rm_command cleanit 2>&1"`;
|
---|
45 | chomp $cleanit_error;
|
---|
46 | $delete_error_code = $? >> 8;
|
---|
47 |
|
---|
48 | # TEST #1
|
---|
49 | # -------
|
---|
50 |
|
---|
51 | $answer = "$rm_command cleanit
|
---|
52 | $cleanit_error
|
---|
53 | $make_name: [$makefile:2: clean] Error $delete_error_code (ignored)
|
---|
54 | $rm_command foo\n";
|
---|
55 |
|
---|
56 | &run_make_with_options($makefile,"",&get_logfile);
|
---|
57 |
|
---|
58 | # If make acted as planned, it should ignore the error from the first
|
---|
59 | # command in the target and execute the second which deletes the file "foo"
|
---|
60 | # This file, therefore, should not exist if the test PASSES.
|
---|
61 | if (-f "foo") {
|
---|
62 | $test_passed = 0;
|
---|
63 | }
|
---|
64 |
|
---|
65 | # The output for this on VOS is too hard to replicate, so we only check it
|
---|
66 | # on unix.
|
---|
67 | if (!$vos)
|
---|
68 | {
|
---|
69 | &compare_output($answer,&get_logfile(1));
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | &touch("foo");
|
---|
74 |
|
---|
75 | # TEST #2
|
---|
76 | # -------
|
---|
77 |
|
---|
78 | $answer = "$rm_command cleanit
|
---|
79 | $cleanit_error
|
---|
80 | $make_name: [$makefile:5: clean2] Error $delete_error_code (ignored)
|
---|
81 | $rm_command foo\n";
|
---|
82 |
|
---|
83 | &run_make_with_options($makefile,"clean2 -i",&get_logfile);
|
---|
84 |
|
---|
85 | if (-f "foo") {
|
---|
86 | $test_passed = 0;
|
---|
87 | }
|
---|
88 |
|
---|
89 | if (!$vos) {
|
---|
90 | &compare_output($answer,&get_logfile(1));
|
---|
91 | }
|
---|
92 |
|
---|
93 | # Test that error line offset works
|
---|
94 |
|
---|
95 | run_make_test(q!
|
---|
96 | all:
|
---|
97 | @echo hi
|
---|
98 | @echo there
|
---|
99 | @exit 1
|
---|
100 | !,
|
---|
101 | '', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512);
|
---|
102 |
|
---|
103 | 1;
|
---|
104 |
|
---|
105 | ### Local Variables:
|
---|
106 | ### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
---|
107 | ### End:
|
---|