summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--modules/strstr-tests8
-rw-r--r--tests/test-strstr.c9
3 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 729f727bcc..34f4b6e52c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-06-08 Eric Blake <ebb9@byu.net>
+ test-strstr: use memory fence, when possible
+ * tests/test-strstr.c (main): Use memory fence, in order to be
+ more likely to trigger Debian bug 521737.
+ * modules/strstr-tests (Files): Pull in additional files.
+
memchr: no longer obsolete, for wider field testing
* modules/memchr (Status, Notice): Delete, this module is no
longer obsolete.
diff --git a/modules/strstr-tests b/modules/strstr-tests
index 23e67b0142..8f09e58f5b 100644
--- a/modules/strstr-tests
+++ b/modules/strstr-tests
@@ -1,12 +1,18 @@
Files:
tests/test-strstr.c
+tests/zerosize-ptr.h
+m4/mmap-anon.m4
Depends-on:
+extensions
+getpagesize
configure.ac:
AC_CHECK_DECLS_ONCE([alarm])
+gl_FUNC_MMAP_ANON
+AC_CHECK_HEADERS_ONCE([sys/mman.h])
+AC_CHECK_FUNCS_ONCE([mprotect])
Makefile.am:
TESTS += test-strstr
check_PROGRAMS += test-strstr
-
diff --git a/tests/test-strstr.c b/tests/test-strstr.c
index f7bc4cb91d..37f4bace65 100644
--- a/tests/test-strstr.c
+++ b/tests/test-strstr.c
@@ -24,6 +24,8 @@
#include <stdlib.h>
#include <unistd.h>
+#include "zerosize-ptr.h"
+
#define ASSERT(expr) \
do \
{ \
@@ -68,13 +70,16 @@ main (int argc, char *argv[])
This is a bug in memchr(), see the Austin Group's clarification
<http://www.opengroup.org/austin/docs/austin_454.txt>. */
const char *fix = "aBaaaaaaaaaaax";
- char *input = malloc (strlen (fix) + 1);
+ char *page_boundary = (char *) zerosize_ptr ();
+ size_t len = strlen (fix) + 1;
+ char *input = page_boundary ? page_boundary - len : malloc (len);
const char *result;
strcpy (input, fix);
result = strstr (input, "B1x");
ASSERT (result == NULL);
- free (input);
+ if (!page_boundary)
+ free (input);
}
{