This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] Detect EOL on-the-fly in strstr, strcasestr and memmem.


On Fri, Oct 5, 2012 at 12:58 PM, Roland McGrath <roland@hack.frob.com> wrote:
> Please put the test case in.  It gives us a state where 'make check' fails,
> but IMHO that's better than allowing the possibility of the bug going
> unfixed and unnoticed for much longer.

I'd like to check in:

http://sourceware.org/ml/libc-alpha/2012-10/msg00168.html

to run strcasestr/strchr/strstr test under all implementations.
This test case then becomes:

	[BZ #14602]
	* string/test-strstr.c (check2): New function.
	(test_main): Call check2.

diff --git a/string/test-strstr.c b/string/test-strstr.c
index 24f3eb5..53b20d7 100644
--- a/string/test-strstr.c
+++ b/string/test-strstr.c
@@ -157,12 +157,24 @@ check1 (void)
     check_result (impl, s1, s2, exp_result);
 }

+static void
+check2 (void)
+{
+  const char s1[] = ", enable_static, \0, enable_shared, ";
+  char *exp_result;
+
+  exp_result = stupid_strstr (s1, s1 + 18);
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s1 + 18, exp_result);
+}
+
 static int
 test_main (void)
 {
   test_init ();

   check1 ();
+  check2 ();

   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)
-- 

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]