xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/functions/findstring (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos$description = "The following test creates a makefile to test the findstring "
2*69606e3fSchristos              ."function.";
3*69606e3fSchristos
4*69606e3fSchristos$details = "";
5*69606e3fSchristos
6*69606e3fSchristos# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
7*69606e3fSchristos# THE NAME OF THE MAKEFILE.  THIS INSURES CONSISTENCY AND KEEPS TRACK OF
8*69606e3fSchristos# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
9*69606e3fSchristos# EXAMPLE: $makefile2 = &get_tmpfile;
10*69606e3fSchristos
11*69606e3fSchristos
12*69606e3fSchristosopen(MAKEFILE,"> $makefile");
13*69606e3fSchristos
14*69606e3fSchristos# The Contents of the MAKEFILE ...
15*69606e3fSchristos
16*69606e3fSchristosprint MAKEFILE "string := \$(findstring port, reporter)\n"
17*69606e3fSchristos              ."all: \n"
18*69606e3fSchristos              ."\t\@echo \$(string) \n";
19*69606e3fSchristos
20*69606e3fSchristos# END of Contents of MAKEFILE
21*69606e3fSchristos
22*69606e3fSchristosclose(MAKEFILE);
23*69606e3fSchristos
24*69606e3fSchristos&run_make_with_options($makefile,
25*69606e3fSchristos                       "",
26*69606e3fSchristos                       &get_logfile,
27*69606e3fSchristos                       0);
28*69606e3fSchristos
29*69606e3fSchristos# Create the answer to what should be produced by this Makefile
30*69606e3fSchristos$answer = "port\n";
31*69606e3fSchristos
32*69606e3fSchristos# COMPARE RESULTS
33*69606e3fSchristos
34*69606e3fSchristos# In this call to compare output, you should use the call &get_logfile(1)
35*69606e3fSchristos# to send the name of the last logfile created.  You may also use
36*69606e3fSchristos# the special call &get_logfile(1) which returns the same as &get_logfile(1).
37*69606e3fSchristos
38*69606e3fSchristos&compare_output($answer,&get_logfile(1));
39*69606e3fSchristos
40*69606e3fSchristos# This tells the test driver that the perl test script executed properly.
41*69606e3fSchristos1;
42*69606e3fSchristos
43*69606e3fSchristos
44*69606e3fSchristos
45*69606e3fSchristos
46*69606e3fSchristos
47*69606e3fSchristos
48