diff options
Diffstat (limited to 'tests/scripts/misc')
-rw-r--r-- | tests/scripts/misc/general1 | 51 | ||||
-rw-r--r-- | tests/scripts/misc/general2 | 50 | ||||
-rw-r--r-- | tests/scripts/misc/general3 | 45 | ||||
-rw-r--r-- | tests/scripts/misc/version | 35 |
4 files changed, 181 insertions, 0 deletions
diff --git a/tests/scripts/misc/general1 b/tests/scripts/misc/general1 new file mode 100644 index 0000000..352fc6a --- /dev/null +++ b/tests/scripts/misc/general1 @@ -0,0 +1,51 @@ +# -*-perl-*- + +$description = "The following test creates a makefile to test the +simple functionality of make. It mimics the +rebuilding of a product with dependencies. +It also tests the simple definition of VPATH."; + +open(MAKEFILE,"> $makefile"); + +print MAKEFILE <<EOF; +VPATH = $workdir +edit: main.o kbd.o commands.o display.o \\ + insert.o +\t\@echo cc -o edit main.o kbd.o commands.o display.o \\ + insert.o +main.o : main.c defs.h +\t\@echo cc -c main.c +kbd.o : kbd.c defs.h command.h +\t\@echo cc -c kbd.c +commands.o : command.c defs.h command.h +\t\@echo cc -c commands.c +display.o : display.c defs.h buffer.h +\t\@echo cc -c display.c +insert.o : insert.c defs.h buffer.h +\t\@echo cc -c insert.c +EOF + +close(MAKEFILE); + + +@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h", + "$workdir${pathsep}kbd.c","$workdir${pathsep}command.h", + "$workdir${pathsep}commands.c","$workdir${pathsep}display.c", + "$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c", + "$workdir${pathsep}command.c"); + +&touch(@files_to_touch); + +&run_make_with_options($makefile,"",&get_logfile); + +# Create the answer to what should be produced by this Makefile +$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c +cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n"; + +# COMPARE RESULTS + +if (&compare_output($answer,&get_logfile(1))) { + unlink @files_to_touch; +} + +1; diff --git a/tests/scripts/misc/general2 b/tests/scripts/misc/general2 new file mode 100644 index 0000000..fb5c3aa --- /dev/null +++ b/tests/scripts/misc/general2 @@ -0,0 +1,50 @@ +# -*-perl-*- + +$description = "The following test creates a makefile to test the +simple functionality of make. It is the same as +general_test1 except that this one tests the +definition of a variable to hold the object filenames."; + +open(MAKEFILE,"> $makefile"); + +# The contents of the Makefile ... + +print MAKEFILE <<EOF; +VPATH = $workdir +objects = main.o kbd.o commands.o display.o insert.o +edit: \$(objects) +\t\@echo cc -o edit \$(objects) +main.o : main.c defs.h +\t\@echo cc -c main.c +kbd.o : kbd.c defs.h command.h +\t\@echo cc -c kbd.c +commands.o : command.c defs.h command.h +\t\@echo cc -c commands.c +display.o : display.c defs.h buffer.h +\t\@echo cc -c display.c +insert.o : insert.c defs.h buffer.h +\t\@echo cc -c insert.c +EOF + +close(MAKEFILE); + + +@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h", + "$workdir${pathsep}kbd.c","$workdir${pathsep}command.h", + "$workdir${pathsep}commands.c","$workdir${pathsep}display.c", + "$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c", + "$workdir${pathsep}command.c"); + +&touch(@files_to_touch); + +&run_make_with_options($makefile,"",&get_logfile); + +# Create the answer to what should be produced by this Makefile +$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c +cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n"; + +if (&compare_output($answer,&get_logfile(1))) { + unlink @files_to_touch; +} + +1; diff --git a/tests/scripts/misc/general3 b/tests/scripts/misc/general3 new file mode 100644 index 0000000..a265f71 --- /dev/null +++ b/tests/scripts/misc/general3 @@ -0,0 +1,45 @@ +# -*-perl-*- + +$description = "\ +This tests random features of the parser that need to be supported, and +which have either broken at some point in the past or seem likely to +break."; + +open(MAKEFILE,"> $makefile"); + +# The contents of the Makefile ... + +print MAKEFILE <<EOF; +\# We want to allow both empty commands _and_ commands that resolve to empty. +EMPTY = + +.PHONY: all a1 a2 a3 a4 +all: a1 a2 a3 a4 + +a1:; +a2: +\t +a3:;\$(EMPTY) +a4: +\t\$(EMPTY) + +\# Non-empty lines that expand to nothing should also be ignored. +STR = \# Some spaces +TAB = \t \# A TAB and some spaces + +\$(STR) + +\$(STR) \$(TAB) + +EOF + +close(MAKEFILE); + +&run_make_with_options($makefile,"",&get_logfile); + +# Create the answer to what should be produced by this Makefile +$answer = "$make_name: Nothing to be done for `all'.\n"; + +&compare_output($answer,&get_logfile(1)); + +1; diff --git a/tests/scripts/misc/version b/tests/scripts/misc/version new file mode 100644 index 0000000..d49b153 --- /dev/null +++ b/tests/scripts/misc/version @@ -0,0 +1,35 @@ +$description = "The following test creates a makefile to ... \n"; + +$details = "Fill in Later\n"; + +open(MAKEFILE,"> $makefile"); + +# The Contents of the MAKEFILE ... + +print MAKEFILE "all: \n"; + +# END of Contents of MAKEFILE + +close(MAKEFILE); + +&run_make_with_options($makefile,"-v",&get_logfile,0); + +# This tells the test driver that the perl test script executed properly. +1; + + + + + + + + + + + + + + + + + |