1 | $description = "\
|
---|
2 | The following test creates a makefile to test the error function.";
|
---|
3 |
|
---|
4 | $details = "";
|
---|
5 |
|
---|
6 | open(MAKEFILE,"> $makefile");
|
---|
7 |
|
---|
8 | print MAKEFILE <<'EOF';
|
---|
9 | ifdef ERROR1
|
---|
10 | $(error error is $(ERROR1))
|
---|
11 | endif
|
---|
12 |
|
---|
13 | ifdef ERROR2
|
---|
14 | $(error error is $(ERROR2))
|
---|
15 | endif
|
---|
16 |
|
---|
17 | ifdef ERROR3
|
---|
18 | all: some; @echo $(error error is $(ERROR3))
|
---|
19 | endif
|
---|
20 |
|
---|
21 | ifdef ERROR4
|
---|
22 | all: some; @echo error is $(ERROR4)
|
---|
23 | @echo $(error error is $(ERROR4))
|
---|
24 | endif
|
---|
25 |
|
---|
26 | some: ; @echo Some stuff
|
---|
27 |
|
---|
28 | EOF
|
---|
29 |
|
---|
30 | close(MAKEFILE);
|
---|
31 |
|
---|
32 | # Test #1
|
---|
33 |
|
---|
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));
|
---|
37 |
|
---|
38 | # Test #2
|
---|
39 |
|
---|
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));
|
---|
43 |
|
---|
44 | # Test #3
|
---|
45 |
|
---|
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));
|
---|
49 |
|
---|
50 | # Test #4
|
---|
51 |
|
---|
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));
|
---|
55 |
|
---|
56 | # This tells the test driver that the perl test script executed properly.
|
---|
57 | 1;
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|