xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/functions/warning (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos#                                                                    -*-Perl-*-
2*69606e3fSchristos
3*69606e3fSchristos$description = "\
4*69606e3fSchristosThe following test creates a makefile to test the warning function.";
5*69606e3fSchristos
6*69606e3fSchristos$details = "";
7*69606e3fSchristos
8*69606e3fSchristosopen(MAKEFILE,"> $makefile");
9*69606e3fSchristos
10*69606e3fSchristosprint MAKEFILE <<'EOF';
11*69606e3fSchristosifdef WARNING1
12*69606e3fSchristos$(warning warning is $(WARNING1))
13*69606e3fSchristosendif
14*69606e3fSchristos
15*69606e3fSchristosifdef WARNING2
16*69606e3fSchristos$(warning warning is $(WARNING2))
17*69606e3fSchristosendif
18*69606e3fSchristos
19*69606e3fSchristosifdef WARNING3
20*69606e3fSchristosall: some; @echo hi $(warning warning is $(WARNING3))
21*69606e3fSchristosendif
22*69606e3fSchristos
23*69606e3fSchristosifdef WARNING4
24*69606e3fSchristosall: some; @echo hi
25*69606e3fSchristos	@echo there $(warning warning is $(WARNING4))
26*69606e3fSchristosendif
27*69606e3fSchristos
28*69606e3fSchristossome: ; @echo Some stuff
29*69606e3fSchristos
30*69606e3fSchristosEOF
31*69606e3fSchristos
32*69606e3fSchristosclose(MAKEFILE);
33*69606e3fSchristos
34*69606e3fSchristos# Test #1
35*69606e3fSchristos
36*69606e3fSchristos&run_make_with_options($makefile, "WARNING1=yes", &get_logfile, 0);
37*69606e3fSchristos$answer = "$makefile:2: warning is yes\nSome stuff\n";
38*69606e3fSchristos&compare_output($answer,&get_logfile(1));
39*69606e3fSchristos
40*69606e3fSchristos# Test #2
41*69606e3fSchristos
42*69606e3fSchristos&run_make_with_options($makefile, "WARNING2=no", &get_logfile, 0);
43*69606e3fSchristos$answer = "$makefile:6: warning is no\nSome stuff\n";
44*69606e3fSchristos&compare_output($answer,&get_logfile(1));
45*69606e3fSchristos
46*69606e3fSchristos# Test #3
47*69606e3fSchristos
48*69606e3fSchristos&run_make_with_options($makefile, "WARNING3=maybe", &get_logfile, 0);
49*69606e3fSchristos$answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n";
50*69606e3fSchristos&compare_output($answer,&get_logfile(1));
51*69606e3fSchristos
52*69606e3fSchristos# Test #4
53*69606e3fSchristos
54*69606e3fSchristos&run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0);
55*69606e3fSchristos$answer = "Some stuff\n$makefile:14: warning is definitely\nhi\nthere\n";
56*69606e3fSchristos&compare_output($answer,&get_logfile(1));
57*69606e3fSchristos
58*69606e3fSchristos# This tells the test driver that the perl test script executed properly.
59*69606e3fSchristos1;
60*69606e3fSchristos
61*69606e3fSchristos
62*69606e3fSchristos
63*69606e3fSchristos
64*69606e3fSchristos
65*69606e3fSchristos
66