| 1 | # -*-perl-*-
|
|---|
| 2 |
|
|---|
| 3 | $description = "The following test creates a makefile to test wildcard
|
|---|
| 4 | expansions and the ability to put a command on the same
|
|---|
| 5 | line as the target name separated by a semi-colon.";
|
|---|
| 6 |
|
|---|
| 7 | $details = "\
|
|---|
| 8 | This test creates 4 files by the names of 1.example,
|
|---|
| 9 | two.example and 3.example. We execute three tests. The first
|
|---|
| 10 | executes the print1 target which tests the '*' wildcard by
|
|---|
| 11 | echoing all filenames by the name of '*.example'. The second
|
|---|
| 12 | test echo's all files which match '?.example' and
|
|---|
| 13 | [a-z0-9].example. Lastly we clean up all of the files using
|
|---|
| 14 | the '*' wildcard as in the first test";
|
|---|
| 15 |
|
|---|
| 16 | if ($vos)
|
|---|
| 17 | {
|
|---|
| 18 | $delete_command = "delete_file -no_ask";
|
|---|
| 19 | }
|
|---|
| 20 | else
|
|---|
| 21 | {
|
|---|
| 22 | $delete_command = "rm";
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | open(MAKEFILE,"> $makefile");
|
|---|
| 27 |
|
|---|
| 28 | # The Contents of the MAKEFILE ...
|
|---|
| 29 |
|
|---|
| 30 | print MAKEFILE <<EOM;
|
|---|
| 31 | .PHONY: print1 print2 clean
|
|---|
| 32 | print1: ;\@echo \$(wildcard example.*)
|
|---|
| 33 | print2:
|
|---|
| 34 | \t\@echo \$(wildcard example.?)
|
|---|
| 35 | \t\@echo \$(wildcard example.[a-z0-9])
|
|---|
| 36 | \t\@echo \$(wildcard example.[!A-Za-z_\\!])
|
|---|
| 37 | clean:
|
|---|
| 38 | \t$delete_command \$(wildcard example.*)
|
|---|
| 39 | EOM
|
|---|
| 40 |
|
|---|
| 41 | # END of Contents of MAKEFILE
|
|---|
| 42 |
|
|---|
| 43 | close(MAKEFILE);
|
|---|
| 44 |
|
|---|
| 45 | &touch("example.1");
|
|---|
| 46 | &touch("example.two");
|
|---|
| 47 | &touch("example.3");
|
|---|
| 48 | &touch("example.for");
|
|---|
| 49 | &touch("example._");
|
|---|
| 50 |
|
|---|
| 51 | # TEST #1
|
|---|
| 52 | # -------
|
|---|
| 53 |
|
|---|
| 54 | $answer = "example.1 example.3 example._ example.for example.two\n";
|
|---|
| 55 |
|
|---|
| 56 | &run_make_with_options($makefile,"print1",&get_logfile);
|
|---|
| 57 |
|
|---|
| 58 | &compare_output($answer,&get_logfile(1));
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | # TEST #2
|
|---|
| 62 | # -------
|
|---|
| 63 |
|
|---|
| 64 | $answer = "example.1 example.3 example._\n"
|
|---|
| 65 | ."example.1 example.3\n"
|
|---|
| 66 | ."example.1 example.3\n";
|
|---|
| 67 |
|
|---|
| 68 | &run_make_with_options($makefile,"print2",&get_logfile);
|
|---|
| 69 |
|
|---|
| 70 | &compare_output($answer,&get_logfile(1));
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 | # TEST #3
|
|---|
| 74 | # -------
|
|---|
| 75 |
|
|---|
| 76 | $answer = "$delete_command example.1 example.3 example._ example.for example.two";
|
|---|
| 77 | if ($vos)
|
|---|
| 78 | {
|
|---|
| 79 | $answer .= " \n";
|
|---|
| 80 | }
|
|---|
| 81 | else
|
|---|
| 82 | {
|
|---|
| 83 | $answer .= "\n";
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | &run_make_with_options($makefile,"clean",&get_logfile);
|
|---|
| 87 |
|
|---|
| 88 | if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for")) {
|
|---|
| 89 | $test_passed = 0;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | &compare_output($answer,&get_logfile(1));
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 | 1;
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|