This commit was manufactured by cvs2svn to create tag
[kbuild-mirror.git] / src / gmake / tests / scripts / functions / error
blobca9b4e44c4ce06668ac4e29973fb7b3a7865b7a2
1 $description = "\
2 The following test creates a makefile to test the error function.";
4 $details = "";
6 open(MAKEFILE,"> $makefile");
8 print MAKEFILE <<'EOF';
9 ifdef ERROR1
10 $(error error is $(ERROR1))
11 endif
13 ifdef ERROR2
14 $(error error is $(ERROR2))
15 endif
17 ifdef ERROR3
18 all: some; @echo $(error error is $(ERROR3))
19 endif
21 ifdef ERROR4
22 all: some; @echo error is $(ERROR4)
23         @echo $(error error is $(ERROR4))
24 endif
26 some: ; @echo Some stuff
28 EOF
30 close(MAKEFILE);
32 # Test #1
34 &run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512);
35 $answer = "$makefile:2: *** error is yes.  Stop.\n";
36 &compare_output($answer,&get_logfile(1));
38 # Test #2
40 &run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512);
41 $answer = "$makefile:6: *** error is no.  Stop.\n";
42 &compare_output($answer,&get_logfile(1));
44 # Test #3
46 &run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512);
47 $answer = "Some stuff\n$makefile:10: *** error is maybe.  Stop.\n";
48 &compare_output($answer,&get_logfile(1));
50 # Test #4
52 &run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512);
53 $answer = "Some stuff\n$makefile:14: *** error is definitely.  Stop.\n";
54 &compare_output($answer,&get_logfile(1));
56 # This tells the test driver that the perl test script executed properly.