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