summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2006-02-10 05:29:00 +0000
committerPaul Smith <psmith@gnu.org>2006-02-10 05:29:00 +0000
commit5a7a42cfce638f52f702b4d317c45c7186b8c0b4 (patch)
treef212e35eac087bedeb88d64d96fb5a4c8c25d08c /tests
parentd0c4e92f1145110793ffb04596019a864c88d2fc (diff)
downloadgunmake-5a7a42cfce638f52f702b4d317c45c7186b8c0b4.tar.gz
- New code capability: a read-only string cache. Start of solution for
Savannah bug #15182, but not much uses it yet. Coming shortly. - Added short-circuiting $(and ..) and $(or ...) functions.
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog15
-rwxr-xr-xtests/run_make_tests.pl4
-rw-r--r--tests/scripts/functions/andor50
-rw-r--r--tests/test_driver.pl9
4 files changed, 69 insertions, 9 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3e05ab8..950c71a 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,13 @@
+2006-02-09 Paul D. Smith <psmith@gnu.org>
+
+ * run_make_tests.pl (set_more_defaults): Update valgrind support
+ for newer versions.
+ * test_driver.pl (toplevel): Skip all hidden files/directories (ones
+ beginning with ".").
+
+ * scripts/functions/andor: Tests for $(and ..) and $(or ...)
+ functions.
+
2006-02-08 Boris Kolpackov <boris@kolpackov.net>
* scripts/features/parallelism: Add a test for bug #15641.
@@ -471,9 +481,8 @@
2002-07-11 Paul D. Smith <psmith@gnu.org>
- * run_make_tests.pl (valid_option): Add support for Valgrind
- <http://developer.kde.org/~sewardj/>. Use -valgrind option to the
- test suite.
+ * run_make_tests.pl (valid_option): Add support for Valgrind. Use
+ -valgrind option to the test suite.
(set_more_defaults): Set up the file descriptor to capture
Valgrind output. We have to unset its close-on-exec flag; we
hardcode the value for F_SETFD (2) rather than load it; hopefully
diff --git a/tests/run_make_tests.pl b/tests/run_make_tests.pl
index b7614e2..5c500ef 100755
--- a/tests/run_make_tests.pl
+++ b/tests/run_make_tests.pl
@@ -12,6 +12,7 @@
# (and others)
$valgrind = 0; # invoke make with valgrind
+$valgrind_args = '--num-callers=15 --tool=memcheck --leak-check=full';
$pure_log = undef;
require "test_driver.pl";
@@ -314,7 +315,8 @@ sub set_more_defaults
open(VALGRIND, "> valgrind.out")
|| die "Cannot open valgrind.out: $!\n";
# -q --leak-check=yes
- $make_path = "valgrind --num-callers=15 --logfile-fd=".fileno(VALGRIND)." $make_path";
+ exists $ENV{VALGRIND_ARGS} and $valgrind_args = $ENV{VALGRIND_ARGS};
+ $make_path = "valgrind --log-fd=".fileno(VALGRIND)." $valgrind_args $make_path";
# F_SETFD is 2
fcntl(VALGRIND, 2, 0) or die "fcntl(setfd) failed: $!\n";
system("echo Starting on `date` 1>&".fileno(VALGRIND));
diff --git a/tests/scripts/functions/andor b/tests/scripts/functions/andor
new file mode 100644
index 0000000..62e0c2e
--- /dev/null
+++ b/tests/scripts/functions/andor
@@ -0,0 +1,50 @@
+# -*-perl-*-
+$description = "Test the and & or functions.\n";
+
+$details = "Try various uses of and & or to ensure they all give the correct
+results.\n";
+
+# TEST #0
+# For $(and ...), it will either be empty or the last value
+run_make_test('
+NEQ = $(subst $1,,$2)
+f =
+t = true
+
+all:
+ @echo 1 $(and ,$t)
+ @echo 2 $(and $t)
+ @echo 3 $(and $t,)
+ @echo 4 $(and z,true,$f,false)
+ @echo 5 $(and $t,$f,$(info bad short-circuit))
+ @echo 6 $(and $(call NEQ,a,b),true)
+ @echo 7 $(and $(call NEQ,a,a),true)
+ @echo 8 $(and z,true,fal,se) hi
+ @echo 9 $(and ,true,fal,se)there
+ @echo 10 $(and $(e) ,$t)',
+ '',
+ "1\n2 true\n3\n4\n5\n6 true\n7\n8 se hi\n9 there\n10\n");
+
+# TEST #1
+# For $(or ...), it will either be empty or the first true value
+run_make_test('
+NEQ = $(subst $1,,$2)
+f =
+t = true
+
+all:
+ @echo 1 $(or , )
+ @echo 2 $(or $t)
+ @echo 3 $(or ,$t)
+ @echo 4 $(or z,true,$f,false)
+ @echo 5 $(or $t,$(info bad short-circuit))
+ @echo 6 $(or $(info short-circuit),$t)
+ @echo 7 $(or $(call NEQ,a,b),true)
+ @echo 8 $(or $(call NEQ,a,a),true)
+ @echo 9 $(or z,true,fal,se) hi
+ @echo 10 $(or ,true,fal,se)there
+ @echo 11 $(or $(e) ,$f)',
+ '',
+ "short-circuit\n1\n2 true\n3 true\n4 z\n5 true\n6 true\n7 b\n8 true\n9 z hi\n10 truethere\n11\n");
+
+1;
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 4b4e72b..631fa1a 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -148,22 +148,21 @@ sub toplevel
print "Finding tests...\n";
opendir (SCRIPTDIR, $scriptpath)
|| &error ("Couldn't opendir $scriptpath: $!\n");
- @dirs = grep (!/^(\.\.?|CVS|RCS)$/, readdir (SCRIPTDIR) );
+ @dirs = grep (!/^(\..*|CVS|RCS)$/, readdir (SCRIPTDIR) );
closedir (SCRIPTDIR);
foreach $dir (@dirs)
{
- next if ($dir =~ /^\.\.?$/ || $dir eq 'CVS' || $dir eq 'RCS'
- || ! -d "$scriptpath/$dir");
+ next if ($dir =~ /^(\..*|CVS|RCS)$/ || ! -d "$scriptpath/$dir");
push (@rmdirs, $dir);
mkdir ("$workpath/$dir", 0777)
|| &error ("Couldn't mkdir $workpath/$dir: $!\n");
opendir (SCRIPTDIR, "$scriptpath/$dir")
|| &error ("Couldn't opendir $scriptpath/$dir: $!\n");
- @files = grep (!/^(\.\.?|CVS|RCS)$/, readdir (SCRIPTDIR) );
+ @files = grep (!/^(\..*|CVS|RCS|.*~)$/, readdir (SCRIPTDIR) );
closedir (SCRIPTDIR);
foreach $test (@files)
{
- next if $test =~ /~$/ || -d $test;
+ -d $test and next;
push (@TESTS, "$dir/$test");
}
}