summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog30
-rwxr-xr-xtests/run_make_tests.pl13
-rw-r--r--tests/scripts/features/patspecific_vars2
-rw-r--r--tests/scripts/functions/eval10
-rw-r--r--tests/scripts/misc/general45
-rw-r--r--tests/scripts/options/symlinks47
-rw-r--r--tests/scripts/variables/MAKE4
-rw-r--r--tests/scripts/variables/MFILE_LIST (renamed from tests/scripts/variables/MAKEFILE_LIST)0
-rw-r--r--tests/test_driver.pl49
9 files changed, 119 insertions, 41 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 462c2e6..41c9b34 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,24 +1,42 @@
-Mon Feb 28 00:31:14 2005 Boris Kolpackov <boris@kolpackov.net>
+2005-02-28 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/options/symlinks: New file to test checking of symlink
+ timestamps. Can't use filename dash-L because it conflicts with
+ dash-l on case-insensitive filesystems.
+
+ * scripts/variables/MAKEFILE_LIST, scripts/variables/MFILE_LIST:
+ Rename MAKEFILE_LIST test to MFILE_LIST, for systems that need 8.3
+ unique filenames.
+
+2005-02-28 Boris Kolpackov <boris@kolpackov.net>
* scripts/variables/DEFAULT_TARGET: Test the .DEFAULT_TARGET
special variable.
-Sun Feb 27 23:33:32 2005 Boris Kolpackov <boris@kolpackov.net>
+2005-02-27 Boris Kolpackov <boris@kolpackov.net>
* scripts/features/se_explicit: Test the second expansion in
explicit rules.
-
* scripts/features/se_implicit: Test the second expansion in
implicit rules.
-
* scripts/features/se_statpat: Test the second expansion in
static pattern rules.
-
- * tests/scripts/variables/automatic: Fix to work with the second
+ * scripts/variables/automatic: Fix to work with the second
expansion.
* scripts/misc/general4: Add a test for bug #12091.
+2005-02-27 Paul D. Smith <psmith@gnu.org>
+
+ * scripts/functions/eval: Check that eval of targets within
+ command scripts fails. See Savannah bug # 12124.
+
+2005-02-26 Paul D. Smith <psmith@gnu.org>
+
+ * test_driver.pl (compare_output): If a basic comparison of the
+ log and answer doesn't match, try harder: change all backslashes
+ to slashes and all CRLF to LF. This helps on DOS/Windows systems.
+
2005-02-09 Paul D. Smith <psmith@gnu.org>
* scripts/features/recursion: Test command line variable settings:
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index 5276d29..ca711b2 100755
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -38,7 +38,7 @@ sub valid_option
return 1;
}
-# This doesn't work--it _should_! Someone needs to fix this badly.
+# This doesn't work--it _should_! Someone badly needs to fix this.
#
# elsif ($option =~ /^-work([-_]?dir)?$/)
# {
@@ -241,20 +241,15 @@ sub set_more_defaults
# On DOS/Windows system the filesystem apparently can't track
# timestamps with second granularity (!!). Change the sleep time
# needed to force a file to be considered "old".
- #
$wtime = $port_type eq 'UNIX' ? 1 : $port_type eq 'OS/2' ? 2 : 4;
print "Port type: $port_type\n" if $debug;
print "Make path: $make_path\n" if $debug;
# Find the full pathname of Make. For DOS systems this is more
- # complicated, so we ask make itself. The following shell code does not
- # work on W32 (MinGW/MSYS)
-
- if ($port_type ne 'W32') {
- $make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
- chop $make_path;
- }
+ # complicated, so we ask make itself.
+ $make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
+ chop $make_path;
print "Make\t= `$make_path'\n" if $debug;
$string = `$make_path -v -f /dev/null 2> /dev/null`;
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/MFILE_LIST
index 076e42d..076e42d 100644
--- a/tests/scripts/variables/MAKEFILE_LIST
+++ b/tests/scripts/variables/MFILE_LIST
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 0698d26..7cd40b5 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -451,13 +451,13 @@ sub run_each_test
$status = "ok ($tests_passed passed)";
for ($i = $num_of_tmpfiles; $i; $i--)
{
- &delete ($tmp_filename . &num_suffix ($i) );
+ &rmfiles ($tmp_filename . &num_suffix ($i) );
}
for ($i = $num_of_logfiles ? $num_of_logfiles : 1; $i; $i--)
{
- &delete ($log_filename . &num_suffix ($i) );
- &delete ($base_filename . &num_suffix ($i) );
+ &rmfiles ($log_filename . &num_suffix ($i) );
+ &rmfiles ($base_filename . &num_suffix ($i) );
}
}
elsif ($code > 0) {
@@ -500,7 +500,7 @@ sub run_each_test
# If the keep flag is not set, this subroutine deletes all filenames that
# are sent to it.
-sub delete
+sub rmfiles
{
local(@files) = @_;
@@ -611,7 +611,7 @@ sub error
sub compare_output
{
local($answer,$logfile) = @_;
- local($slurp);
+ local($slurp, $answer_matched) = ('', 0);
print "Comparing Output ........ " if $debug;
@@ -624,14 +624,29 @@ sub compare_output
++$tests_run;
- if ($slurp eq $answer && $test_passed)
+ if ($slurp eq $answer) {
+ $answer_matched = 1;
+ } else {
+ # See if it is a slash or CRLF problem
+ local ($answer_mod) = $answer;
+
+ $answer_mod =~ tr,\\,/,;
+ $answer_mod =~ s,\r\n,\n,gs;
+
+ $slurp =~ tr,\\,/,;
+ $slurp =~ s,\r\n,\n,gs;
+
+ $answer_matched = ($slurp eq $answer_mod);
+ }
+
+ if ($answer_matched && $test_passed)
{
print "ok\n" if $debug;
++$tests_passed;
return 1;
}
- if ($slurp ne $answer) {
+ if (! $answer_matched) {
print "DIFFERENT OUTPUT\n" if $debug;
&create_file (&get_basefile, $answer);
@@ -639,9 +654,9 @@ sub compare_output
print "\nCreating Difference File ...\n" if $debug;
# Create the difference file
+
local($command) = "diff -c " . &get_basefile . " " . $logfile;
&run_command_with_output(&get_difffile,$command);
-
}
$suite_passed = 0;
@@ -729,15 +744,11 @@ sub run_command
{
local ($code);
- if ($debug)
- {
- print "\nrun_command: @_\n";
- $code = system @_;
- print "run_command: \"@_\" returned $code.\n";
- return $code;
- }
+ print "\nrun_command: @_\n" if $debug;
+ $code = system @_;
+ print "run_command: \"@_\" returned $code.\n" if $debug;
- return system @_;
+ return $code;
}
# run one command (passed as a list of arg 0 - n, with arg 0 being the
@@ -753,10 +764,8 @@ sub run_command_with_output
&attach_default_output ($filename);
$code = system @_;
&detach_default_output;
- if ($debug)
- {
- print "run_command_with_output: \"@_\" returned $code.\n";
- }
+
+ print "run_command_with_output: '@_' returned $code.\n" if $debug;
return $code;
}