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