From d2516343bc5c105543b22eed3b073a8a4e14a659 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 28 Feb 2005 07:48:22 +0000 Subject: * New feature: -L option * New function: $(info ...) * Disallow $(eval ...) to create prereq relationships inside command scripts (caused core dumps) * Try to allow more tests to succeed in Windows/DOS by sanitizing CRLF and \ * Various bug fixes and code cleanups (see the ChangeLog entry) --- tests/scripts/features/patspecific_vars | 2 +- tests/scripts/functions/eval | 10 +++++++ tests/scripts/misc/general4 | 5 +--- tests/scripts/options/symlinks | 47 +++++++++++++++++++++++++++++++++ tests/scripts/variables/MAKE | 4 ++- tests/scripts/variables/MAKEFILE_LIST | 30 --------------------- tests/scripts/variables/MFILE_LIST | 30 +++++++++++++++++++++ 7 files changed, 92 insertions(+), 36 deletions(-) create mode 100644 tests/scripts/options/symlinks delete mode 100644 tests/scripts/variables/MAKEFILE_LIST create mode 100644 tests/scripts/variables/MFILE_LIST (limited to 'tests/scripts') diff --git a/tests/scripts/features/patspecific_vars b/tests/scripts/features/patspecific_vars index 31359cf..9e98b43 100644 --- a/tests/scripts/features/patspecific_vars +++ b/tests/scripts/features/patspecific_vars @@ -67,7 +67,7 @@ run_make_test(' /%: export foo := foo /bar: - @test "$(foo)" == "$$foo" + @test "$(foo)" = "$$foo" ', '', ''); diff --git a/tests/scripts/functions/eval b/tests/scripts/functions/eval index c69a110..bc43053 100644 --- a/tests/scripts/functions/eval +++ b/tests/scripts/functions/eval @@ -158,4 +158,14 @@ $(eval $(FOO)) ', '', 'hello world'); + +# We don't allow new target/prerequisite relationships to be defined within a +# command script, because these are evaluated after snap_deps() and that +# causes lots of problems (like core dumps!) +# See Savannah bug # 12124. + +run_make_test('deps: ; $(eval deps: foo)', '', + '#MAKEFILE#:1: *** prerequisites cannot be defined in command scripts. Stop.', + 512); + 1; diff --git a/tests/scripts/misc/general4 b/tests/scripts/misc/general4 index 3b4595f..63320e2 100644 --- a/tests/scripts/misc/general4 +++ b/tests/scripts/misc/general4 @@ -24,13 +24,10 @@ close(MAKEFILE); $answer = "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n"; &compare_output($answer,&get_logfile(1)); - # Test implicit rules &touch('foo.c'); -run_make_test(' -foo: foo.o -', +run_make_test('foo: foo.o', 'CC="@echo cc" OUTPUT_OPTION=', 'cc -c foo.c cc foo.o -o foo'); diff --git a/tests/scripts/options/symlinks b/tests/scripts/options/symlinks new file mode 100644 index 0000000..4dcc67a --- /dev/null +++ b/tests/scripts/options/symlinks @@ -0,0 +1,47 @@ +# -*-perl-*- + +$description = "Test the -L option."; + +$details = "Verify that symlink handling with and without -L works properly."; + +# Only run these tests if the system sypports symlinks +if (eval { symlink("",""); 1 }) { + + # Set up a symlink sym -> dep + # We'll make both dep and targ older than sym + $pwd =~ m%/([^/]+)$%; + $dirnm = $1; + &utouch(-10, 'dep'); + &utouch(-5, 'targ'); + symlink("../$dirnm/dep", 'sym'); + + # Without -L, nothing should happen + # With -L, it should update targ + run_make_test('targ: sym ; @echo make $@ from $<', '', + "#MAKE#: `targ' is up to date."); + run_make_test(undef, '-L', "make targ from sym"); + + # Now update dep; in all cases targ should be out of date. + &touch('dep'); + run_make_test(undef, '', "make targ from sym"); + run_make_test(undef, '-L', "make targ from sym"); + + # Now update targ; in all cases targ should be up to date. + &touch('targ'); + run_make_test(undef, '', "#MAKE#: `targ' is up to date."); + run_make_test(undef, '-L', "#MAKE#: `targ' is up to date."); + + # Add in a new link between sym and dep. Be sure it's newer than targ. + sleep(1); + rename('dep', 'dep1'); + symlink('dep1', 'dep'); + + # Without -L, nothing should happen + # With -L, it should update targ + run_make_test(undef, '', "#MAKE#: `targ' is up to date."); + run_make_test(undef, '-L', "make targ from sym"); + + rmfiles('targ', 'dep', 'sym', 'dep1'); +} + +1; diff --git a/tests/scripts/variables/MAKE b/tests/scripts/variables/MAKE index 7c4cf0a..079c57e 100644 --- a/tests/scripts/variables/MAKE +++ b/tests/scripts/variables/MAKE @@ -1,3 +1,5 @@ +# -*-perl-*- + $description = "The following test creates a makefile to test MAKE \n" ."(very generic)"; @@ -26,7 +28,7 @@ $answer = "$mkpath\n$mkpath -f $makefile foo\n" &run_make_with_options($makefile,"",&get_logfile,0); -&delete("foo"); +&rmfiles("foo"); # COMPARE RESULTS &compare_output($answer,&get_logfile(1)); diff --git a/tests/scripts/variables/MAKEFILE_LIST b/tests/scripts/variables/MAKEFILE_LIST deleted file mode 100644 index 076e42d..0000000 --- a/tests/scripts/variables/MAKEFILE_LIST +++ /dev/null @@ -1,30 +0,0 @@ -# -*-perl-*- - -$description = "Test the MAKEFILE_LIST variable."; - -$makefile2 = &get_tmpfile; - -open(MAKEFILE,"> $makefile"); -print MAKEFILE < $makefile2"); -print MAKEFILE "m2 := \$(MAKEFILE_LIST)\n"; -close(MAKEFILE); - - -&run_make_with_options($makefile, "", &get_logfile); -$answer = "$makefile\n$makefile $makefile2\n$makefile $makefile2\n"; -&compare_output($answer,&get_logfile(1)); - -1; diff --git a/tests/scripts/variables/MFILE_LIST b/tests/scripts/variables/MFILE_LIST new file mode 100644 index 0000000..076e42d --- /dev/null +++ b/tests/scripts/variables/MFILE_LIST @@ -0,0 +1,30 @@ +# -*-perl-*- + +$description = "Test the MAKEFILE_LIST variable."; + +$makefile2 = &get_tmpfile; + +open(MAKEFILE,"> $makefile"); +print MAKEFILE < $makefile2"); +print MAKEFILE "m2 := \$(MAKEFILE_LIST)\n"; +close(MAKEFILE); + + +&run_make_with_options($makefile, "", &get_logfile); +$answer = "$makefile\n$makefile $makefile2\n$makefile $makefile2\n"; +&compare_output($answer,&get_logfile(1)); + +1; -- cgit v1.2.3