VirtualBox

source: kBuild/vendor/gnumake/current/tests/scripts/features/errors@ 3208

最後變更 在這個檔案從3208是 3138,由 bird 提交於 7 年 前

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

  • 屬性 svn:eol-style 設為 LF
檔案大小: 2.7 KB
 
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
17if ($vos)
18{
19 $rm_command = "delete_file";
20}
21else
22{
23 $rm_command = "rm";
24}
25
26open(MAKEFILE,"> $makefile");
27
28# The Contents of the MAKEFILE ...
29
30print 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
39close(MAKEFILE);
40
41&touch("foo");
42
43unlink("cleanit");
44$cleanit_error = `sh -c "$rm_command cleanit 2>&1"`;
45chomp $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.
61if (-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.
67if (!$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
85if (-f "foo") {
86 $test_passed = 0;
87}
88
89if (!$vos) {
90 &compare_output($answer,&get_logfile(1));
91}
92
93# Test that error line offset works
94
95run_make_test(q!
96all:
97 @echo hi
98 @echo there
99 @exit 1
100!,
101 '', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512);
102
1031;
104
105### Local Variables:
106### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
107### End:
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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