VirtualBox

source: kBuild/branches/GNU/src/gmake/tests/scripts/features/errors@ 280

Last change on this file since 280 was 280, checked in by bird, 20 years ago

Current make snaphot, 2005-05-16.

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
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
15if ($vos)
16{
17 $delete_command = "delete_file";
18}
19else
20{
21 $delete_command = "rm";
22}
23
24open(MAKEFILE,"> $makefile");
25
26# The Contents of the MAKEFILE ...
27
28print 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
37close(MAKEFILE);
38
39&touch("foo");
40
41unlink("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# If make acted as planned, it should ignore the error from the first
56# command in the target and execute the second which deletes the file "foo"
57# This file, therefore, should not exist if the test PASSES.
58if (-f "foo") {
59 $test_passed = 0;
60}
61
62# The output for this on VOS is too hard to replicate, so we only check it
63# on unix.
64if (!$vos)
65{
66 &compare_output($answer,&get_logfile(1));
67}
68
69
70&touch("foo");
71
72# TEST #2
73# -------
74
75$answer = "$delete_command cleanit\n"
76 . $cleanit_error
77 ."$make_name: [clean2] Error $delete_error_code (ignored)\n"
78 ."$delete_command foo\n";
79
80&run_make_with_options($makefile,"clean2 -i",&get_logfile);
81
82if (-f "foo") {
83 $test_passed = 0;
84}
85
86if (!$vos) {
87 &compare_output($answer,&get_logfile(1));
88}
89
901;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette