Home | History | Annotate | Download | only in functions
      1 #                                                                    -*-Perl-*-
      2 
      3 $description = "\
      4 The following test creates a makefile to test the error function.";
      5 
      6 $details = "";
      7 
      8 open(MAKEFILE,"> $makefile");
      9 
     10 print MAKEFILE 'err = $(error Error found!)
     11 
     12 ifdef ERROR1
     13 $(error error is $(ERROR1))
     14 endif
     15 
     16 ifdef ERROR2
     17 $(error error is $(ERROR2))
     18 endif
     19 
     20 ifdef ERROR3
     21 all: some; @echo $(error error is $(ERROR3))
     22 endif
     23 
     24 ifdef ERROR4
     25 all: some; @echo error is $(ERROR4)
     26 	@echo $(error error is $(ERROR4))
     27 endif
     28 
     29 some: ; @echo Some stuff
     30 
     31 testvar: ; @: $(err)
     32 ';
     33 
     34 close(MAKEFILE);
     35 
     36 # Test #1
     37 
     38 &run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512);
     39 $answer = "$makefile:4: *** error is yes.  Stop.\n";
     40 &compare_output($answer,&get_logfile(1));
     41 
     42 # Test #2
     43 
     44 &run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512);
     45 $answer = "$makefile:8: *** error is no.  Stop.\n";
     46 &compare_output($answer,&get_logfile(1));
     47 
     48 # Test #3
     49 
     50 &run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512);
     51 $answer = "Some stuff\n$makefile:12: *** error is maybe.  Stop.\n";
     52 &compare_output($answer,&get_logfile(1));
     53 
     54 # Test #4
     55 
     56 &run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512);
     57 $answer = "Some stuff\n$makefile:16: *** error is definitely.  Stop.\n";
     58 &compare_output($answer,&get_logfile(1));
     59 
     60 # Test #5
     61 
     62 &run_make_with_options($makefile, "testvar", &get_logfile, 512);
     63 $answer = "$makefile:22: *** Error found!.  Stop.\n";
     64 &compare_output($answer,&get_logfile(1));
     65 
     66 # This tells the test driver that the perl test script executed properly.
     67 1;
     68 
     69 
     70 
     71 
     72 
     73 
     74