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"`; 45$delete_error_code = $? >> 8; 46 47# TEST #1 48# ------- 49 50$answer = "$rm_command cleanit\n" 51 . $cleanit_error 52 ."$make_name: [clean] Error $delete_error_code (ignored)\n" 53 ."$rm_command foo\n"; 54 55&run_make_with_options($makefile,"",&get_logfile); 56 57# If make acted as planned, it should ignore the error from the first 58# command in the target and execute the second which deletes the file "foo" 59# This file, therefore, should not exist if the test PASSES. 60if (-f "foo") { 61 $test_passed = 0; 62} 63 64# The output for this on VOS is too hard to replicate, so we only check it 65# on unix. 66if (!$vos) 67{ 68 &compare_output($answer,&get_logfile(1)); 69} 70 71 72&touch("foo"); 73 74# TEST #2 75# ------- 76 77$answer = "$rm_command cleanit\n" 78 . $cleanit_error 79 ."$make_name: [clean2] Error $delete_error_code (ignored)\n" 80 ."$rm_command foo\n"; 81 82&run_make_with_options($makefile,"clean2 -i",&get_logfile); 83 84if (-f "foo") { 85 $test_passed = 0; 86} 87 88if (!$vos) { 89 &compare_output($answer,&get_logfile(1)); 90} 91 921; 93