errors 2.4 KB

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