dash-k 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # -*-perl-*-
  2. $description = "Test the make -k (don't stop on error) option.\n";
  3. $details = "\
  4. The makefile created in this test is a simulation of building
  5. a small product. However, the trick to this one is that one
  6. of the dependencies of the main target does not exist.
  7. Without the -k option, make would fail immediately and not
  8. build any part of the target. What we are looking for here,
  9. is that make builds the rest of the dependencies even though
  10. it knows that at the end it will fail to rebuild the main target.";
  11. open(MAKEFILE,"> $makefile");
  12. # The Contents of the MAKEFILE ...
  13. print MAKEFILE <<EOF;
  14. VPATH = $workdir
  15. edit: main.o kbd.o commands.o display.o
  16. \t\@echo cc -o edit main.o kbd.o commands.o display.o
  17. main.o : main.c defs.h
  18. \t\@echo cc -c main.c
  19. kbd.o : kbd.c defs.h command.h
  20. \t\@echo cc -c kbd.c
  21. commands.o : command.c defs.h command.h
  22. \t\@echo cc -c commands.c
  23. display.o : display.c defs.h buffer.h
  24. \t\@echo cc -c display.c
  25. EOF
  26. # END of Contents of MAKEFILE
  27. close(MAKEFILE);
  28. @files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
  29. "$workdir${pathsep}command.h",
  30. "$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
  31. "$workdir${pathsep}buffer.h",
  32. "$workdir${pathsep}command.c");
  33. &touch(@files_to_touch);
  34. if ($vos) {
  35. $error_code = 3307;
  36. }
  37. else {
  38. $error_code = 512;
  39. }
  40. &run_make_with_options($makefile, "-k", &get_logfile, $error_code);
  41. # Create the answer to what should be produced by this Makefile
  42. $answer = "cc -c main.c
  43. $make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.
  44. cc -c commands.c
  45. cc -c display.c
  46. $make_name: Target `edit' not remade because of errors.\n";
  47. # COMPARE RESULTS
  48. &compare_output($answer, &get_logfile(1));
  49. unlink(@files_to_touch) unless $keep;
  50. # TEST 1: Make sure that top-level targets that depend on targets that
  51. # previously failed to build, aren't attempted. Regression for PR/1634.
  52. $makefile2 = &get_tmpfile;
  53. open(MAKEFILE, "> $makefile2");
  54. print MAKEFILE <<'EOF';
  55. .SUFFIXES:
  56. all: exe1 exe2; @echo making $@
  57. exe1 exe2: lib; @echo cp $^ $@
  58. lib: foo.o; @echo cp $^ $@
  59. foo.o: ; exit 1
  60. EOF
  61. close(MAKEFILE);
  62. &run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
  63. $answer = "exit 1
  64. $make_name: *** [foo.o] Error 1
  65. $make_name: Target `all' not remade because of errors.\n";
  66. &compare_output($answer, &get_logfile(1));
  67. 1;