echoing 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. $description = "The following test creates a makefile to test command \n"
  2. ."echoing. It tests that when a command line starts with \n"
  3. ."a '\@', the echoing of that line is suppressed. It also \n"
  4. ."tests the -n option which tells make to ONLY echo the \n"
  5. ."commands and no execution happens. In this case, even \n"
  6. ."the commands with '\@' are printed. Lastly, it tests the \n"
  7. ."-s flag which tells make to prevent all echoing, as if \n"
  8. ."all commands started with a '\@'.";
  9. $details = "This test is similar to the 'clean' test except that a '\@' has\n"
  10. ."been placed in front of the delete command line. Four tests \n"
  11. ."are run here. First, make is run normally and the first echo\n"
  12. ."command should be executed. In this case there is no '\@' so \n"
  13. ."we should expect make to display the command AND display the \n"
  14. ."echoed message. Secondly, make is run with the clean target, \n"
  15. ."but since there is a '\@' at the beginning of the command, we\n"
  16. ."expect no output; just the deletion of a file which we check \n"
  17. ."for. Third, we give the clean target again except this time\n"
  18. ."we give make the -n option. We now expect the command to be \n"
  19. ."displayed but not to be executed. In this case we need only \n"
  20. ."to check the output since an error message would be displayed\n"
  21. ."if it actually tried to run the delete command again and the \n"
  22. ."file didn't exist. Lastly, we run the first test again with \n"
  23. ."the -s option and check that make did not echo the echo \n"
  24. ."command before printing the message.";
  25. $example = "EXAMPLE_FILE";
  26. open(MAKEFILE,"> $makefile");
  27. # The Contents of the MAKEFILE ...
  28. print MAKEFILE "all: \n";
  29. print MAKEFILE "\techo This makefile did not clean the dir... good\n";
  30. print MAKEFILE "clean: \n";
  31. print MAKEFILE "\t\@$delete_command $example\n";
  32. # END of Contents of MAKEFILE
  33. close(MAKEFILE);
  34. &touch($example);
  35. # TEST #1
  36. # -------
  37. &run_make_with_options($makefile,"",&get_logfile,0);
  38. $answer = "echo This makefile did not clean the dir... good\n"
  39. ."This makefile did not clean the dir... good\n";
  40. &compare_output($answer,&get_logfile(1));
  41. # TEST #2
  42. # -------
  43. &run_make_with_options($makefile,"clean",&get_logfile,0);
  44. $answer = "";
  45. &compare_output($answer,&get_logfile(1));
  46. if (-f $example)
  47. {
  48. $test_passed = 0;
  49. }
  50. # TEST #3
  51. # -------
  52. &run_make_with_options($makefile,"-n clean",&get_logfile,0);
  53. $answer = "$delete_command $example\n";
  54. &compare_output($answer,&get_logfile(1));
  55. # TEST #4
  56. # -------
  57. &run_make_with_options($makefile,"-s",&get_logfile,0);
  58. $answer = "This makefile did not clean the dir... good\n";
  59. &compare_output($answer,&get_logfile(1));
  60. 1;