warning 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $description = "\
  2. The following test creates a makefile to test the warning function.";
  3. $details = "";
  4. open(MAKEFILE,"> $makefile");
  5. print MAKEFILE <<'EOF';
  6. ifdef WARNING1
  7. $(warning warning is $(WARNING1))
  8. endif
  9. ifdef WARNING2
  10. $(warning warning is $(WARNING2))
  11. endif
  12. ifdef WARNING3
  13. all: some; @echo hi $(warning warning is $(WARNING3))
  14. endif
  15. ifdef WARNING4
  16. all: some; @echo hi
  17. @echo there $(warning warning is $(WARNING4))
  18. endif
  19. some: ; @echo Some stuff
  20. EOF
  21. close(MAKEFILE);
  22. # Test #1
  23. &run_make_with_options($makefile, "WARNING1=yes", &get_logfile, 0);
  24. $answer = "$makefile:2: warning is yes\nSome stuff\n";
  25. &compare_output($answer,&get_logfile(1));
  26. # Test #2
  27. &run_make_with_options($makefile, "WARNING2=no", &get_logfile, 0);
  28. $answer = "$makefile:6: warning is no\nSome stuff\n";
  29. &compare_output($answer,&get_logfile(1));
  30. # Test #3
  31. &run_make_with_options($makefile, "WARNING3=maybe", &get_logfile, 0);
  32. $answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n";
  33. &compare_output($answer,&get_logfile(1));
  34. # Test #4
  35. &run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0);
  36. $answer = "Some stuff\n$makefile:14: warning is definitely\nhi\nthere\n";
  37. &compare_output($answer,&get_logfile(1));
  38. # This tells the test driver that the perl test script executed properly.
  39. 1;