VirtualBox

source: kBuild/branches/GNU/src/gmake/tests/scripts/functions/wildcard@ 284

Last change on this file since 284 was 284, checked in by bird, 20 years ago

Current make snaphot, 2005-05-16.

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1# -*-perl-*-
2
3$description = "The following test creates a makefile to test wildcard
4expansions and the ability to put a command on the same
5line as the target name separated by a semi-colon.";
6
7$details = "\
8This test creates 4 files by the names of 1.example,
9two.example and 3.example. We execute three tests. The first
10executes the print1 target which tests the '*' wildcard by
11echoing all filenames by the name of '*.example'. The second
12test echo's all files which match '?.example' and
13[a-z0-9].example. Lastly we clean up all of the files using
14the '*' wildcard as in the first test";
15
16if ($vos)
17{
18 $delete_command = "delete_file -no_ask";
19}
20else
21{
22 $delete_command = "rm";
23}
24
25
26open(MAKEFILE,"> $makefile");
27
28# The Contents of the MAKEFILE ...
29
30print MAKEFILE <<EOM;
31.PHONY: print1 print2 clean
32print1: ;\@echo \$(wildcard example.*)
33print2:
34\t\@echo \$(wildcard example.?)
35\t\@echo \$(wildcard example.[a-z0-9])
36\t\@echo \$(wildcard example.[!A-Za-z_\\!])
37clean:
38\t$delete_command \$(wildcard example.*)
39EOM
40
41# END of Contents of MAKEFILE
42
43close(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";
77if ($vos)
78{
79 $answer .= " \n";
80}
81else
82{
83 $answer .= "\n";
84}
85
86&run_make_with_options($makefile,"clean",&get_logfile);
87
88if ((-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
951;
96
97
98
99
100
101
102
103
104
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette