GNU C Library master sources branch hjl/pr14602 created. glibc-2.16-ports-merge-444-g650ef74

hjl@sourceware.org hjl@sourceware.org
Fri Oct 5 19:18:00 GMT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr14602 has been created
        at  650ef74ed14d4121d31155b52f207a52c5a79d93 (commit)

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=650ef74ed14d4121d31155b52f207a52c5a79d93

commit 650ef74ed14d4121d31155b52f207a52c5a79d93
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Oct 5 12:18:18 2012 -0700

    Add a testase for BZ #14602

diff --git a/ChangeLog b/ChangeLog
index 1ff00ac..953df6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2012-10-08  H.J. Lu  <hongjiu.lu@intel.com>
 
+	[BZ #14602]
+	* string/test-strstr.c (do_one_test): Break out result checking
+	code into ...
+	(check_result): This.  New function.
+	(do_one_test): Call check_result.
+	(check1): New function.
+	(test_main): Call check1.
+
+2012-10-08  H.J. Lu  <hongjiu.lu@intel.com>
+
 	* wcsmbs/Makefile (ifunc-tests): New macro.
 	(tests-ifunc): Likewise.
 	(tests): Add $(tests-ifunc).
diff --git a/string/test-strstr.c b/string/test-strstr.c
index c2c6705..09646b4 100644
--- a/string/test-strstr.c
+++ b/string/test-strstr.c
@@ -56,8 +56,9 @@ IMPL (simple_strstr, 0)
 IMPL (strstr, 1)
 
 
-static void
-do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
+static int
+check_result (impl_t *impl, const char *s1, const char *s2,
+	      char *exp_result)
 {
   char *result = CALL (impl, s1, s2);
   if (result != exp_result)
@@ -65,8 +66,17 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
       error (0, 0, "Wrong result in function %s %s %s", impl->name,
 	     result, exp_result);
       ret = 1;
-      return;
+      return -1;
     }
+ 
+  return 0;
+}
+
+static void
+do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
+{
+  if (check_result (impl, s1, s2, exp_result) < 0)
+    return;
 
   if (HP_TIMING_AVAIL)
     {
@@ -134,12 +144,25 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2,
     putchar ('\n');
 }
 
+static void
+check1 (void)
+{
+  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 ();
+
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)
     printf ("\t%s", impl->name);

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list