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