GNU C Library master sources branch hjl/pr14602 created. glibc-2.16-ports-merge-445-g000f678
hjl@sourceware.org
hjl@sourceware.org
Fri Oct 5 19:59: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 000f67849a079b41fecd706f60f2db58dd898a02 (commit)
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=000f67849a079b41fecd706f60f2db58dd898a02
commit 000f67849a079b41fecd706f60f2db58dd898a02
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Oct 5 12:59:07 2012 -0700
Add a testase for BZ #14602
diff --git a/ChangeLog.pr14602 b/ChangeLog.pr14602
index 3783779..1c9feae 100644
--- a/ChangeLog.pr14602
+++ b/ChangeLog.pr14602
@@ -1,5 +1,11 @@
2012-10-08 H.J. Lu <hongjiu.lu@intel.com>
+ [BZ #14602]
+ * string/test-strstr.c (check2): New function.
+ (test_main): Call check2.
+
+2012-10-08 H.J. Lu <hongjiu.lu@intel.com>
+
* string/Makefile (tests): Remove bug-strstr1, bug-strcasestr1
and bug-strchr1.
* string/bug-strcasestr1.c (do_test): Moved to ...
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)
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0483a2d72fd1f891736b9df0bb20d585b8fed061
commit 0483a2d72fd1f891736b9df0bb20d585b8fed061
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Oct 5 12:57:10 2012 -0700
Test strcasestr/strchr/strstr under all implementations
diff --git a/ChangeLog.pr14602 b/ChangeLog.pr14602
new file mode 100644
index 0000000..3783779
--- /dev/null
+++ b/ChangeLog.pr14602
@@ -0,0 +1,25 @@
+2012-10-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * string/Makefile (tests): Remove bug-strstr1, bug-strcasestr1
+ and bug-strchr1.
+ * string/bug-strcasestr1.c (do_test): Moved to ...
+ * string/test-strcasestr.c (check1): Here. New function.
+ (do_one_test): Break out result checking code into ...
+ (check_result): This. New function.
+ (do_one_test): Call check_result.
+ (test_main): Call check1.
+ * string/bug-strchr1.c (do_test): Moved to ...
+ * string/test-strchr.c (check1): Here. New function.
+ (do_one_test): Break out result checking code into ...
+ (check_result): This. New function.
+ (do_one_test): Call check_result.
+ (test_main): Call check1.
+ * string/bug-strstr1.c (main): Moved to ...
+ * string/test-strchr.c (check1): Here. New function.
+ (do_one_test): Break out result checking code into ...
+ (check_result): This. New function.
+ (do_one_test): Call check_result.
+ (test_main): Call check1.
+ * string/bug-strcasestr1.c: Removed.
+ * string/bug-strchr1.c: Likewise.
+ * string/bug-strstr1.c: Likewise.
diff --git a/string/Makefile b/string/Makefile
index 51e9fde..ce2446b 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -62,7 +62,7 @@ tests := tester inl-tester noinl-tester testcopy test-ffs \
tst-strtok tst-strxfrm bug-strcoll1 tst-strfry \
bug-strtok1 $(addprefix test-,$(strop-tests)) \
bug-envz1 tst-strxfrm2 tst-endian tst-svc2 \
- bug-strstr1 bug-strcasestr1 bug-strchr1 tst-strtok_r
+ tst-strtok_r
ifunc-tests = $(addprefix test-,$(strop-tests))
tests-ifunc = $(addsuffix -ifunc,$(ifunc-tests))
diff --git a/string/bug-strcasestr1.c b/string/bug-strcasestr1.c
deleted file mode 100644
index e8334d7..0000000
--- a/string/bug-strcasestr1.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Test for non-submitted strcasestr bug.
- Copyright (C) 2012 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stdio.h>
-#include <string.h>
-
-#define TEST_FUNCTION do_test ()
-static int
-do_test (void)
-{
- const char haystack[] = "AOKB";
- const char needle[] = "OK";
- const char *sub = strcasestr (haystack, needle);
-
- if (sub == NULL)
- {
- fprintf (stderr, "BUG: didn't find \"%s\" in \"%s\"\n", needle, haystack);
- return 1;
- }
-
- return 0;
-}
-
-#include "../test-skeleton.c"
diff --git a/string/bug-strchr1.c b/string/bug-strchr1.c
deleted file mode 100644
index 21155d8..0000000
--- a/string/bug-strchr1.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-static int
-do_test (void)
-{
- char s[] __attribute__((aligned(16))) = "\xff";
- char *p = strchr (s, '\xfe');
- printf ("%p\n", p);
- return p != NULL;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/string/bug-strstr1.c b/string/bug-strstr1.c
deleted file mode 100644
index 889de12..0000000
--- a/string/bug-strstr1.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-int main (int argc, char** argv)
-{
- const char haystack[] =
- "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
-
- const char needle[] =
- "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
-
- const char* sub = strstr (haystack, needle);
-
- if (sub != NULL)
- {
- int j;
-
- fprintf (stderr, "BUG: expected NULL, got:\n%s\n%s\n", sub, needle);
- for (j = 0; needle[j] != '\0'; ++j)
- putchar (needle[j] == sub[j] ? ' ' : '^');
- puts ("");
- return 1;
- }
-
- return 0;
-}
diff --git a/string/test-strcasestr.c b/string/test-strcasestr.c
index 650b865..9a0f30c 100644
--- a/string/test-strcasestr.c
+++ b/string/test-strcasestr.c
@@ -58,8 +58,9 @@ IMPL (simple_strcasestr, 0)
IMPL (strcasestr, 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)
@@ -67,8 +68,16 @@ 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)
{
@@ -137,12 +146,25 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2,
putchar ('\n');
}
+static void
+check1 (void)
+{
+ const char s1[] = "AOKB";
+ const char s2[] = "OK";
+ char *exp_result;
+
+ exp_result = stupid_strcasestr (s1, s2);
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, s1, s2, exp_result);
+}
static int
test_main (void)
{
test_init ();
+ check1 ();
+
printf ("%23s", "");
FOR_EACH_IMPL (impl, 0)
printf ("\t%s", impl->name);
diff --git a/string/test-strchr.c b/string/test-strchr.c
index e7c5298..1ed6966 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -88,8 +88,8 @@ IMPL (stupid_STRCHR, 0)
IMPL (simple_STRCHR, 0)
IMPL (STRCHR, 1)
-static void
-do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
+static int
+check_result (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
{
CHAR *res = CALL (impl, s, c);
if (res != exp_res)
@@ -97,8 +97,16 @@ do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
error (0, 0, "Wrong result in function %s %#x %p %p", impl->name,
c, res, exp_res);
ret = 1;
- return;
+ return -1;
}
+ return 0;
+}
+
+static void
+do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
+{
+ if (check_result (impl, s, c, exp_res) < 0)
+ return;
if (HP_TIMING_AVAIL)
{
@@ -233,6 +241,17 @@ do_random_tests (void)
}
}
+static void
+check1 (void)
+{
+ char s[] __attribute__((aligned(16))) = "\xff";
+ char c = '\xfe';
+ char *exp_result = stupid_STRCHR (s, c);
+
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, s, c, exp_result);
+}
+
int
test_main (void)
{
@@ -240,6 +259,8 @@ test_main (void)
test_init ();
+ check1 ();
+
printf ("%20s", "");
FOR_EACH_IMPL (impl, 0)
printf ("\t%s", impl->name);
diff --git a/string/test-strstr.c b/string/test-strstr.c
index c2c6705..24f3eb5 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,26 @@ do_test (size_t align1, size_t align2, size_t len1, size_t len2,
putchar ('\n');
}
+static void
+check1 (void)
+{
+ const char s1[] =
+ "F_BD_CE_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_88_20_EF_BF_BD_EF_BF_BD_EF_BF_BD_C3_A7_20_EF_BF_BD";
+ const char s2[] = "_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD_EF_BF_BD";
+ char *exp_result;
+
+ exp_result = stupid_strstr (s1, s2);
+ FOR_EACH_IMPL (impl, 0)
+ check_result (impl, s1, s2, 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