summaryrefslogtreecommitdiff
path: root/tests/scripts/functions
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/functions')
-rw-r--r--tests/scripts/functions/addprefix44
-rw-r--r--tests/scripts/functions/addsuffix44
-rw-r--r--tests/scripts/functions/basename44
-rw-r--r--tests/scripts/functions/call38
-rw-r--r--tests/scripts/functions/dir44
-rw-r--r--tests/scripts/functions/error63
-rw-r--r--tests/scripts/functions/filter-out35
-rw-r--r--tests/scripts/functions/findstring47
-rw-r--r--tests/scripts/functions/foreach53
-rw-r--r--tests/scripts/functions/if31
-rw-r--r--tests/scripts/functions/join44
-rw-r--r--tests/scripts/functions/notdir44
-rw-r--r--tests/scripts/functions/origin65
-rw-r--r--tests/scripts/functions/sort55
-rw-r--r--tests/scripts/functions/strip53
-rw-r--r--tests/scripts/functions/substitution37
-rw-r--r--tests/scripts/functions/suffix57
-rw-r--r--tests/scripts/functions/warning63
-rw-r--r--tests/scripts/functions/wildcard103
-rw-r--r--tests/scripts/functions/word70
20 files changed, 1034 insertions, 0 deletions
diff --git a/tests/scripts/functions/addprefix b/tests/scripts/functions/addprefix
new file mode 100644
index 0000000..1845552
--- /dev/null
+++ b/tests/scripts/functions/addprefix
@@ -0,0 +1,44 @@
+$description = "The following test creates a makefile to test the addprefix "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(addprefix src${pathsep},a.b.z.foo hacks) \n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "src${pathsep}a.b.z.foo src${pathsep}hacks\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/addsuffix b/tests/scripts/functions/addsuffix
new file mode 100644
index 0000000..d150f07
--- /dev/null
+++ b/tests/scripts/functions/addsuffix
@@ -0,0 +1,44 @@
+$description = "The following test creates a makefile to test the addsuffix "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(addsuffix .c,src${pathsep}a.b.z.foo hacks) \n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "src${pathsep}a.b.z.foo.c hacks.c\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/basename b/tests/scripts/functions/basename
new file mode 100644
index 0000000..08f2ea5
--- /dev/null
+++ b/tests/scripts/functions/basename
@@ -0,0 +1,44 @@
+$description = "The following test creates a makefile to test the suffix "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(basename src${pathsep}a.b.z.foo.c src${pathsep}hacks src.bar${pathsep}a.b.z.foo.c src.bar${pathsep}hacks hacks) \n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "src${pathsep}a.b.z.foo src${pathsep}hacks src.bar${pathsep}a.b.z.foo src.bar${pathsep}hacks hacks\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/call b/tests/scripts/functions/call
new file mode 100644
index 0000000..3303d5b
--- /dev/null
+++ b/tests/scripts/functions/call
@@ -0,0 +1,38 @@
+# -*-perl-*-
+$description = "Test the call function.\n";
+
+$details = "Try various uses of call and ensure they all give the correct
+results.\n";
+
+open(MAKEFILE, "> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE <<'EOMAKE';
+# Simple, just reverse something
+#
+reverse = $2 $1
+
+# A complex `map' function, using recursive `call'.
+#
+map = $(foreach a,$2,$(call $1,$a))
+
+# Test using a builtin; this is silly as it's simpler to do without call
+#
+my-notdir = $(call notdir,$(1))
+
+all: ; @echo '$(call reverse,bar,foo)'; \
+ echo '$(call map,origin,MAKE reverse map)'; \
+ echo '$(call my-notdir,a/b c/d e/f)'
+
+EOMAKE
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "foo bar\ndefault file file\nb d f\n";
+&compare_output($answer, &get_logfile(1));
+
+1;
diff --git a/tests/scripts/functions/dir b/tests/scripts/functions/dir
new file mode 100644
index 0000000..f48fb8c
--- /dev/null
+++ b/tests/scripts/functions/dir
@@ -0,0 +1,44 @@
+$description = "The following test creates a makefile to test the dir "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(dir src${pathsep}foo.c hacks) \n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "src${pathsep} .${pathsep}\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/error b/tests/scripts/functions/error
new file mode 100644
index 0000000..ca9b4e4
--- /dev/null
+++ b/tests/scripts/functions/error
@@ -0,0 +1,63 @@
+$description = "\
+The following test creates a makefile to test the error function.";
+
+$details = "";
+
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<'EOF';
+ifdef ERROR1
+$(error error is $(ERROR1))
+endif
+
+ifdef ERROR2
+$(error error is $(ERROR2))
+endif
+
+ifdef ERROR3
+all: some; @echo $(error error is $(ERROR3))
+endif
+
+ifdef ERROR4
+all: some; @echo error is $(ERROR4)
+ @echo $(error error is $(ERROR4))
+endif
+
+some: ; @echo Some stuff
+
+EOF
+
+close(MAKEFILE);
+
+# Test #1
+
+&run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512);
+$answer = "$makefile:2: *** error is yes. Stop.\n";
+&compare_output($answer,&get_logfile(1));
+
+# Test #2
+
+&run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512);
+$answer = "$makefile:6: *** error is no. Stop.\n";
+&compare_output($answer,&get_logfile(1));
+
+# Test #3
+
+&run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512);
+$answer = "Some stuff\n$makefile:10: *** error is maybe. Stop.\n";
+&compare_output($answer,&get_logfile(1));
+
+# Test #4
+
+&run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512);
+$answer = "Some stuff\n$makefile:14: *** error is definitely. Stop.\n";
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/filter-out b/tests/scripts/functions/filter-out
new file mode 100644
index 0000000..0559a8d
--- /dev/null
+++ b/tests/scripts/functions/filter-out
@@ -0,0 +1,35 @@
+$description = "The following test creates a makefile to test static \n"
+ ."pattern rules. Static pattern rules are rules which \n"
+ ."specify multiple targets and construct the dependency \n"
+ ."names for each target based on the target name. ";
+
+$details = "The makefile created in this test has three targets. The \n"
+ ."filter command is used to get those target names ending in \n"
+ .".o and statically creates a compile command with the target\n"
+ ."name and the target name with .c. It also does the same thing\n"
+ ."for another target filtered with .elc and creates a command\n"
+ ."to emacs a .el file";
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "files := \$(filter-out %.o, foo.elc bar.o lose.o) \n"
+ ."all: \n"
+ ."\t\@echo \$(files) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,
+ "",
+ &get_logfile,
+ 0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "foo.elc\n";
+
+&compare_output($answer,&get_logfile(1));
+
+1;
diff --git a/tests/scripts/functions/findstring b/tests/scripts/functions/findstring
new file mode 100644
index 0000000..48abede
--- /dev/null
+++ b/tests/scripts/functions/findstring
@@ -0,0 +1,47 @@
+$description = "The following test creates a makefile to test the findstring "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(findstring port, reporter)\n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,
+ "",
+ &get_logfile,
+ 0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "port\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/foreach b/tests/scripts/functions/foreach
new file mode 100644
index 0000000..0c63c47
--- /dev/null
+++ b/tests/scripts/functions/foreach
@@ -0,0 +1,53 @@
+# -*-perl-*-
+
+# Updated 6.16.93 variable "MAKE" is default was environment override
+# For make 3.63 and above
+
+$description = "The following test creates a makefile to verify
+test the foreach function.";
+
+$details = "This is a test of the foreach function in gnu make.
+This function starts with a space separated list of
+names and a variable. Each name in the list is subsituted
+into the variable and the given text evaluated. The general
+form of the command is $(foreach var,$list,$text). Several
+types of foreach loops are tested\n";
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+# On WIN32 systems, the user's path is found in %Path% ($Path)
+#
+$pathvar = (($osname =~ /Windows/i) ? "Path" : "PATH");
+
+print MAKEFILE <<EOF;
+foo = bletch null \@ garf
+null :=
+space = ' '
+auto_var = udef space CC null $pathvar MAKE foo CFLAGS WHITE \@ <
+av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
+override WHITE := BLACK
+for_var = \$(addsuffix .c,foo \$(null) \$(foo) \$(space) \$(av) )
+fe = \$(foreach var2, \$(for_var),\$(subst .c,.o, \$(var2) ) )
+all: auto for2
+auto :
+\t\@echo \$(av)
+for2:
+\t\@echo \$(fe)
+EOF
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,
+ "-e WHITE=WHITE CFLAGS=",
+ &get_logfile);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "undefined file default file environment default file command line override automatic automatic
+foo.o bletch.o null.o @.o garf.o .o .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o\n";
+
+&compare_output($answer,&get_logfile(1));
+
+1;
diff --git a/tests/scripts/functions/if b/tests/scripts/functions/if
new file mode 100644
index 0000000..cb1f5fc
--- /dev/null
+++ b/tests/scripts/functions/if
@@ -0,0 +1,31 @@
+# -*-perl-*-
+$description = "Test the if function.\n";
+
+$details = "Try various uses of if and ensure they all give the correct
+results.\n";
+
+open(MAKEFILE, "> $makefile");
+
+print MAKEFILE <<EOMAKE;
+NEQ = \$(subst \$1,,\$2)
+
+all:
+\t\@echo \$(if ,true,false)
+\t\@echo \$(if ,true,)
+\t\@echo \$(if ,true)
+\t\@echo \$(if z,true,false)
+\t\@echo \$(if z,true,\$(shell echo hi))
+\t\@echo \$(if ,\$(shell echo hi),false)
+\t\@echo \$(if \$(call NEQ,a,b),true,false)
+\t\@echo \$(if \$(call NEQ,a,a),true,false)
+\t\@echo \$(if z,true,fal,se)
+\t\@echo \$(if ,true,fal,se)
+EOMAKE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile, "", &get_logfile);
+$answer = "false\n\n\ntrue\ntrue\nfalse\ntrue\nfalse\ntrue\nfal,se\n";
+&compare_output($answer, &get_logfile(1));
+
+1;
diff --git a/tests/scripts/functions/join b/tests/scripts/functions/join
new file mode 100644
index 0000000..302c307
--- /dev/null
+++ b/tests/scripts/functions/join
@@ -0,0 +1,44 @@
+$description = "The following test creates a makefile to test the join "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(join a b c,foo hacks .pl1) \n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "afoo bhacks c.pl1\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/notdir b/tests/scripts/functions/notdir
new file mode 100644
index 0000000..4ed8f9c
--- /dev/null
+++ b/tests/scripts/functions/notdir
@@ -0,0 +1,44 @@
+$description = "The following test creates a makefile to test the notdir "
+ ."function.";
+
+$details = "";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := \$(notdir ${pathsep}src${pathsep}foo.c hacks) \n"
+ ."all: \n"
+ ."\t\@echo \$(string) \n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "foo.c hacks\n";
+
+# COMPARE RESULTS
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin
new file mode 100644
index 0000000..721d928
--- /dev/null
+++ b/tests/scripts/functions/origin
@@ -0,0 +1,65 @@
+# -*-perl-*-
+
+$description = "Test the origin function.";
+
+$details = "This is a test of the origin function in gnu make.
+This function will report on where a variable was
+defined per the following list:
+
+'undefined' never defined
+'default' default definition
+'environment' environment var without -e
+'environment override' environment var with -e
+'file' defined in makefile
+'command line' defined on the command line
+'override' defined by override in makefile
+'automatic' Automatic variable\n";
+
+# On WIN32 systems, HOME is meaningless. SystemRoot should be defined though.
+# With DJGPP, HOME is not guaranteed to be defined. Use DJDIR instead.
+#
+$homevar = (($osname =~ /Windows/i)
+ ? "SystemRoot"
+ : (($osname =~ /DOS/i) ? "DJDIR" : "HOME"));
+
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<EOF;
+foo := bletch garf
+auto_var = udef CC $homevar MAKE foo CFLAGS WHITE \@
+av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
+override WHITE := BLACK
+all: auto
+\t\@echo \$(origin undefined)
+\t\@echo \$(origin CC)
+\t\@echo \$(origin $homevar)
+\t\@echo \$(origin MAKE)
+\t\@echo \$(origin foo)
+\t\@echo \$(origin CFLAGS)
+\t\@echo \$(origin WHITE)
+\t\@echo \$(origin \@)
+auto :
+\t\@echo \$(av)
+EOF
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,
+ "-e WHITE=WHITE CFLAGS=",
+ &get_logfile);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "undefined default environment default file command line override automatic
+undefined
+default
+environment
+default
+file
+command line
+override
+automatic\n";
+
+
+&compare_output($answer,&get_logfile(1));
+
+1;
diff --git a/tests/scripts/functions/sort b/tests/scripts/functions/sort
new file mode 100644
index 0000000..d472102
--- /dev/null
+++ b/tests/scripts/functions/sort
@@ -0,0 +1,55 @@
+$description = "The following test creates a makefile to verify\n"
+ ."the ability of make to sort lists of object. Sort\n"
+ ."will also remove any duplicate entries. This will also\n"
+ ."be tested.";
+
+$details = "The make file is built with a list of object in a random order\n"
+ ."and includes some duplicates. Make should sort all of the elements\n"
+ ."remove all duplicates\n";
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "foo := moon_light days \n"
+ ."foo1:= jazz\n"
+ ."bar := captured \n"
+ ."bar2 = boy end, has rise A midnight \n"
+ ."bar3:= \$(foo)\n"
+ ."s1 := _by\n"
+ ."s2 := _and_a\n"
+ ."t1 := \$(addsuffix \$(s1), \$(bar) )\n"
+ ."t2 := \$(addsuffix \$(s2), \$(foo1) )\n"
+ ."t3 := \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \n"
+ ."t4 := \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \n"
+ ."t5 := \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \n"
+ ."t6 := \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \n"
+ ."t7 := \$(t6) \$(t6) \$(t6) \n"
+ ."p1 := \$(addprefix \$(foo1), \$(s2) )\n"
+ ."blank:= \n"
+ ."all:\n"
+ ."\t\@echo \$(sort \$(bar2) \$(foo) \$(addsuffix \$(s1), \$(bar) ) \$(t2) \$(bar2) \$(bar3))\n"
+ ."\t\@echo \$(sort \$(blank) \$(foo) \$(bar2) \$(t1) \$(p1) )\n"
+ ."\t\@echo \$(sort \$(foo) \$(bar2) \$(t1) \$(t4) \$(t5) \$(t7) \$(t6) )\n";
+
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"
+ ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"
+ ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n";
+
+&compare_output($answer,&get_logfile(1));
+
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/strip b/tests/scripts/functions/strip
new file mode 100644
index 0000000..1f487c0
--- /dev/null
+++ b/tests/scripts/functions/strip
@@ -0,0 +1,53 @@
+# -*-perl-*-
+$description = "The following test creates a makefile to verify
+the ability of make to strip white space from lists of object.\n";
+
+
+$details = "The make file is built with a list of objects that contain white space
+These are then run through the strip command to remove it. This is then
+verified by echoing the result.\n";
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE <<'EOMAKE';
+TEST1 := "Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING..."
+E :=
+TEST2 := $E try this and this $E
+
+define TEST3
+
+and these test out
+
+
+some
+blank lines
+
+
+
+endef
+
+.PHONY: all
+all:
+ @echo '$(strip $(TEST1) )'
+ @echo '$(strip $(TEST2) )'
+ @echo '$(strip $(TEST3) )'
+
+EOMAKE
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "\"Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING...\"
+try this and this
+and these test out some blank lines
+";
+
+&compare_output($answer,&get_logfile(1));
+
+1;
diff --git a/tests/scripts/functions/substitution b/tests/scripts/functions/substitution
new file mode 100644
index 0000000..9280dbb
--- /dev/null
+++ b/tests/scripts/functions/substitution
@@ -0,0 +1,37 @@
+$description = "The following test creates a makefile to ...";
+
+$details = "";
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "foo := a.o b.o c.o\n"
+ ."bar := \$(foo:.o=.c)\n"
+ ."bar2:= \$(foo:%.o=%.c)\n"
+ ."bar3:= \$(patsubst %.c,%.o,x.c.c bar.c)\n"
+ ."all:\n"
+ ."\t\@echo \$(bar)\n"
+ ."\t\@echo \$(bar2)\n"
+ ."\t\@echo \$(bar3)\n";
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile);
+
+# Create the answer to what should be produced by this Makefile
+$answer = "a.c b.c c.c\n"
+ ."a.c b.c c.c\n"
+ ."x.c.o bar.o\n";
+
+&compare_output($answer,&get_logfile(1));
+
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/suffix b/tests/scripts/functions/suffix
new file mode 100644
index 0000000..0c4f919
--- /dev/null
+++ b/tests/scripts/functions/suffix
@@ -0,0 +1,57 @@
+$description = "The following test creates a makefile to test the suffix\n"
+ ."function. \n";
+
+$details = "The suffix function will return the string following the last _._\n"
+ ."the list provided. It will provide all of the unique suffixes found\n"
+ ."in the list. The long strings are sorted to remove duplicates.\n";
+
+# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
+# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
+# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
+# EXAMPLE: $makefile2 = &get_tmpfile;
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := word.pl general_test2.pl1 FORCE.pl word.pl3 generic_test.perl /tmp.c/bar foo.baz/bar.c MAKEFILES_variable.c\n"
+ ."string2 := \$(string) \$(string) \$(string) \$(string) \$(string) \$(string) \$(string)\n"
+ ."string3 := \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2)\n"
+ ."string4 := \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3)\n"
+ ."all: \n"
+ ."\t\@echo \$(suffix \$(string)) \n"
+ ."\t\@echo \$(sort \$(suffix \$(string4))) \n"
+ ."\t\@echo \$(suffix \$(string) a.out) \n"
+ ."\t\@echo \$(sort \$(suffix \$(string3))) \n";
+
+
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+
+# COMPARE RESULTS
+$answer = ".pl .pl1 .pl .pl3 .perl .c .c\n"
+ .".c .perl .pl .pl1 .pl3\n"
+ .".pl .pl1 .pl .pl3 .perl .c .c .out\n"
+ .".c .perl .pl .pl1 .pl3\n";
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/warning b/tests/scripts/functions/warning
new file mode 100644
index 0000000..ac0ad64
--- /dev/null
+++ b/tests/scripts/functions/warning
@@ -0,0 +1,63 @@
+$description = "\
+The following test creates a makefile to test the warning function.";
+
+$details = "";
+
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<'EOF';
+ifdef WARNING1
+$(warning warning is $(WARNING1))
+endif
+
+ifdef WARNING2
+$(warning warning is $(WARNING2))
+endif
+
+ifdef WARNING3
+all: some; @echo hi $(warning warning is $(WARNING3))
+endif
+
+ifdef WARNING4
+all: some; @echo hi
+ @echo there $(warning warning is $(WARNING4))
+endif
+
+some: ; @echo Some stuff
+
+EOF
+
+close(MAKEFILE);
+
+# Test #1
+
+&run_make_with_options($makefile, "WARNING1=yes", &get_logfile, 0);
+$answer = "$makefile:2: warning is yes\nSome stuff\n";
+&compare_output($answer,&get_logfile(1));
+
+# Test #2
+
+&run_make_with_options($makefile, "WARNING2=no", &get_logfile, 0);
+$answer = "$makefile:6: warning is no\nSome stuff\n";
+&compare_output($answer,&get_logfile(1));
+
+# Test #3
+
+&run_make_with_options($makefile, "WARNING3=maybe", &get_logfile, 0);
+$answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n";
+&compare_output($answer,&get_logfile(1));
+
+# Test #4
+
+&run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0);
+$answer = "Some stuff\n$makefile:14: warning is definitely\nhi\nthere\n";
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+
diff --git a/tests/scripts/functions/wildcard b/tests/scripts/functions/wildcard
new file mode 100644
index 0000000..d21747f
--- /dev/null
+++ b/tests/scripts/functions/wildcard
@@ -0,0 +1,103 @@
+# -*-perl-*-
+
+$description = "The following test creates a makefile to test wildcard\n"
+ ."expansions and the ability to put a command on the same\n"
+ ."line as the target name separated by a semi-colon.";
+
+$details = "This test creates 4 files by the names of 1.example, \n"
+ ."two.example and 3.example. We execute three tests. The first\n"
+ ."executes the print1 target which tests the '*' wildcard by \n"
+ ."echoing all filenames by the name of '*.example'. The second\n"
+ ."test echo's all files which match '?.example' and \n"
+ ."[a-z0-9].example. Lastly we clean up all of the files using\n"
+ ."the '*' wildcard as in the first test";
+
+if ($vos)
+{
+ $delete_command = "delete_file -no_ask";
+}
+else
+{
+ $delete_command = "rm";
+}
+
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE <<EOM;
+print1: ;\@echo \$(wildcard example.*)
+print2:
+\t\@echo \$(wildcard example.?)
+\t\@echo \$(wildcard example.[a-z0-9])
+\t\@echo \$(wildcard example.[!A-Za-z_\\!])
+clean:
+\t$delete_command \$(wildcard example.*)
+EOM
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&touch("example.1");
+&touch("example.two");
+&touch("example.3");
+&touch("example.for");
+&touch("example._");
+
+# TEST #1
+# -------
+
+$answer = "example.1 example.3 example._ example.for example.two\n";
+
+&run_make_with_options($makefile,"print1",&get_logfile);
+
+&compare_output($answer,&get_logfile(1));
+
+
+# TEST #2
+# -------
+
+$answer = "example.1 example.3 example._\n"
+ ."example.1 example.3\n"
+ ."example.1 example.3\n";
+
+&run_make_with_options($makefile,"print2",&get_logfile);
+
+&compare_output($answer,&get_logfile(1));
+
+
+# TEST #3
+# -------
+
+$answer = "$delete_command example.1 example.3 example._ example.for example.two";
+if ($vos)
+{
+ $answer .= " \n";
+}
+else
+{
+ $answer .= "\n";
+}
+
+&run_make_with_options($makefile,"clean",&get_logfile);
+
+&compare_output($answer,&get_logfile(1));
+
+if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for"))
+{
+ $test_passed = 0;
+}
+
+
+1;
+
+
+
+
+
+
+
+
+
diff --git a/tests/scripts/functions/word b/tests/scripts/functions/word
new file mode 100644
index 0000000..f786e47
--- /dev/null
+++ b/tests/scripts/functions/word
@@ -0,0 +1,70 @@
+$description = "The following test creates a makefile to test the word, words,\n"
+ ."and wordlist functions.\n";
+
+$details = "The word function will return the number of words in a variable or\n"
+ ."the word specified. The test will produce a variable with a large\n"
+ ."number of words in it, determine the number of word and then read\n"
+ ."each one back.\n";
+
+open(MAKEFILE,"> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE "string := word.pl general_test2.pl FORCE.pl word.pl generic_test.perl MAKEFILES_variable.pl \n"
+ ."string2 := \$(string) \$(string) \$(string) \$(string) \$(string) \$(string) \$(string)\n"
+ ."string3 := \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2)\n"
+ ."string4 := \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3)\n"
+ ."all: \n"
+ ."\t\@echo \$(words \$(string)) \n"
+ ."\t\@echo \$(words \$(string4)) \n"
+ ."\t\@echo \$(word 1, \$(string)) \n"
+ ."\t\@echo \$(word 100, \$(string)) \n"
+ ."\t\@echo \$(word 1, \$(string)) \n"
+ ."\t\@echo \$(word 1000, \$(string3)) \n"
+ ."\t\@echo \$(wordlist 3, 4, \$(string)) \n"
+ ."\t\@echo \$(wordlist 4, 3, \$(string)) \n"
+ ."\t\@echo \$(wordlist 1, 6, \$(string)) \n"
+ ."\t\@echo \$(wordlist 7, 5, \$(string)) \n"
+ ."\t\@echo \$(wordlist 100, 110, \$(string)) \n"
+ ."\t\@echo \$(wordlist 7, 10, \$(string2)) \n"
+;
+
+
+
+# END of Contents of MAKEFILE
+
+close(MAKEFILE);
+
+&run_make_with_options($makefile,"",&get_logfile,0);
+
+# Create the answer to what should be produced by this Makefile
+
+# COMPARE RESULTS
+$answer = "6\n"
+ ."2058\n"
+ ."word.pl\n"
+ ."\n"
+ ."word.pl\n"
+ ."\n"
+ ."FORCE.pl word.pl\n"
+ ."FORCE.pl word.pl\n"
+ ."word.pl general_test2.pl FORCE.pl word.pl generic_test.perl MAKEFILES_variable.pl\n"
+ ."generic_test.perl MAKEFILES_variable.pl\n"
+ ."\n"
+ ."word.pl general_test2.pl FORCE.pl word.pl\n"
+;
+
+# In this call to compare output, you should use the call &get_logfile(1)
+# to send the name of the last logfile created. You may also use
+# the special call &get_logfile(1) which returns the same as &get_logfile(1).
+
+&compare_output($answer,&get_logfile(1));
+
+# This tells the test driver that the perl test script executed properly.
+1;
+
+
+
+
+
+