This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch, master, updated. glibc-2.14-263-g762011f


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, master has been updated
       via  762011fe9ffded81448be4dc50a2b27faaafe4c9 (commit)
       via  4badf7e8d7b44e1b6b887ff94ca7933c4a0ee336 (commit)
      from  0442afb40ec59eeee35bdcea707e085518948845 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit 762011fe9ffded81448be4dc50a2b27faaafe4c9
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Thu Sep 8 18:01:07 2011 -0400

    Move wide char tests to wcsmbs directory

diff --git a/ChangeLog b/ChangeLog
index 83e5130..347e7e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2011-09-08  Ulrich Drepper  <drepper@gmail.com>
+
+	* wcsmbs/test-wcscmp.c: Moved from string/*.  Adjust.
+	* wcsmbs/test-wmemcmp.c: Likewise.
+	* string/Makefile (strop-tests): Remove wcscmp and wmemcmp.
+	* wcsmbs/Makefile (strop-tests): Add  wcscmp and wmemcmp.
+
+2011-09-08  Liubov Dmitrieva  <liubov.dmitrieva@gmail.com>
+
+	* string/Makefile (strop-tests): Add memcmp.
+	* string/test-wmemcmp.c: New file.
+	* string/test-memcmp.c: Add wmemcmp support.
+
 2011-09-08  Roland McGrath  <roland@hack.frob.com>
 
 	[BZ #13153]
diff --git a/string/Makefile b/string/Makefile
index cc2a1ea..ab10024 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2002, 2005-2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1991-2002, 2005-2010, 2011 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
@@ -46,11 +46,11 @@ routines	:= strcat strchr strcmp strcoll strcpy strcspn		\
 # for -fbounded-pointer compiles.  Glibc uses memchr for explicit checks.
 o-objects.ob	:= memcpy.o memset.o memchr.o
 
-strop-tests	:=  wcscmp memchr memcmp memcpy memmove mempcpy memset memccpy	\
+strop-tests	:= memchr memcmp memcpy memmove mempcpy memset memccpy	\
 		   stpcpy stpncpy strcat strchr strcmp strcpy strcspn	\
 		   strlen strncmp strncpy strpbrk strrchr strspn memmem	\
 		   strstr strcasestr strnlen strcasecmp strncasecmp	\
-		   strncat wmemcmp
+		   strncat
 tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   tst-strlen stratcliff tst-svc tst-inlcall		\
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
diff --git a/string/test-wcscmp.c b/string/test-wcscmp.c
deleted file mode 100644
index ac98e6d..0000000
--- a/string/test-wcscmp.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define WIDE 1
-#include "test-strcmp.c"
diff --git a/string/test-wmemcmp.c b/string/test-wmemcmp.c
deleted file mode 100644
index bbf3068..0000000
--- a/string/test-wmemcmp.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define WIDE 1
-#include "test-memcmp.c"
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 907bb25..dbb6756 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2000,2002,2003,2004,2005,2006,2007
+# Copyright (C) 1995-2000,2002,2003,2004,2005,2006,2007,2011
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -42,9 +42,10 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
 	    isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
 	    isoc99_swscanf isoc99_vswscanf
 
+strop-tests :=  wcscmp wmemcmp
 tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
 	 tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
-	 wcsatcliff
+	 wcsatcliff $(addprefix test-,$(strop-tests))
 
 include ../Rules
 
diff --git a/wcsmbs/test-wcscmp.c b/wcsmbs/test-wcscmp.c
new file mode 100644
index 0000000..aa18c30
--- /dev/null
+++ b/wcsmbs/test-wcscmp.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strcmp.c"
diff --git a/wcsmbs/test-wmemcmp.c b/wcsmbs/test-wmemcmp.c
new file mode 100644
index 0000000..73bc4b7
--- /dev/null
+++ b/wcsmbs/test-wmemcmp.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-memcmp.c"

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4badf7e8d7b44e1b6b887ff94ca7933c4a0ee336

commit 4badf7e8d7b44e1b6b887ff94ca7933c4a0ee336
Author: Liubov Dmitrieva <liubov.dmitrieva@intel.com>
Date:   Thu Sep 8 17:51:50 2011 -0400

    New comprehensive test for wmemcmp

diff --git a/string/Makefile b/string/Makefile
index 459b2a7..cc2a1ea 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -50,7 +50,7 @@ strop-tests	:=  wcscmp memchr memcmp memcpy memmove mempcpy memset memccpy	\
 		   stpcpy stpncpy strcat strchr strcmp strcpy strcspn	\
 		   strlen strncmp strncpy strpbrk strrchr strspn memmem	\
 		   strstr strcasestr strnlen strcasecmp strncasecmp	\
-		   strncat
+		   strncat wmemcmp
 tests		:= tester inl-tester noinl-tester testcopy test-ffs	\
 		   tst-strlen stratcliff tst-svc tst-inlcall		\
 		   bug-strncat1 bug-strspn1 bug-strpbrk1 tst-bswap	\
diff --git a/string/test-memcmp.c b/string/test-memcmp.c
index 3040e21..c7f1574 100644
--- a/string/test-memcmp.c
+++ b/string/test-memcmp.c
@@ -1,7 +1,8 @@
 /* Test and measure memcmp functions.
-   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
+   Added wmemcmp support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -20,25 +21,47 @@
 
 #define TEST_MAIN
 #include "test-string.h"
-
-typedef int (*proto_t) (const char *, const char *, size_t);
-int simple_memcmp (const char *, const char *, size_t);
-
-IMPL (simple_memcmp, 0)
-IMPL (memcmp, 1)
+#ifdef WIDE
+# include <inttypes.h>
+# include <wchar.h>
+
+# define L(str) L##str
+# define MEMCMP wmemcmp
+# define MEMCPY wmemcpy
+# define SIMPLE_MEMCMP simple_wmemcmp
+# define STUPID_MEMCMP stupid_wmemcmp
+# define CHAR wchar_t
+# define MAX_CHAR 256000
+# define UCHAR uint32_t
+# define CHARBYTES 4
+#else
+# define L(str) str
+# define MEMCMP memcmp
+# define MEMCPY memcpy
+# define SIMPLE_MEMCMP simple_memcmp
+# define STUPID_MEMCMP stupid_memcmp
+# define CHAR char
+# define MAX_CHAR 255
+# define UCHAR unsigned char
+# define CHARBYTES 1
+#endif
+
+typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
 
 int
-simple_memcmp (const char *s1, const char *s2, size_t n)
+SIMPLE_MEMCMP (const CHAR *s1, const CHAR *s2, size_t n)
 {
   int ret = 0;
 
-  while (n--
-	 && (ret = *(unsigned char *) s1++ - *(unsigned char *) s2++) == 0);
+  while (n-- && (ret = *(UCHAR *) s1++ - *(UCHAR *) s2++) == 0);
   return ret;
 }
 
+IMPL (SIMPLE_MEMCMP, 0)
+IMPL (MEMCMP, 1)
+
 static int
-check_result (impl_t *impl, const char *s1, const char *s2, size_t len,
+check_result (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t len,
 	      int exp_result)
 {
   int result = CALL (impl, s1, s2, len);
@@ -56,7 +79,7 @@ check_result (impl_t *impl, const char *s1, const char *s2, size_t len,
 }
 
 static void
-do_one_test (impl_t *impl, const char *s1, const char *s2, size_t len,
+do_one_test (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t len,
 	     int exp_result)
 {
   if (check_result (impl, s1, s2, len, exp_result) < 0)
@@ -85,24 +108,24 @@ static void
 do_test (size_t align1, size_t align2, size_t len, int exp_result)
 {
   size_t i;
-  char *s1, *s2;
+  CHAR *s1, *s2;
 
   if (len == 0)
     return;
 
-  align1 &= 7;
-  if (align1 + len >= page_size)
+  align1 &= 63;
+  if (align1 + (len + 1) * CHARBYTES >= page_size)
     return;
 
-  align2 &= 7;
-  if (align2 + len >= page_size)
+  align2 &= 63;
+  if (align2 + (len + 1) * CHARBYTES >= page_size)
     return;
 
-  s1 = (char *) (buf1 + align1);
-  s2 = (char *) (buf2 + align2);
+  s1 = (CHAR *) (buf1 + align1);
+  s2 = (CHAR *) (buf2 + align2);
 
   for (i = 0; i < len; i++)
-    s1[i] = s2[i] = 1 + 23 * i % 255;
+    s1[i] = s2[i] = 1 + (23 << ((CHARBYTES - 1) * 8)) * i % MAX_CHAR;
 
   s1[len] = align1;
   s2[len] = align2;
@@ -124,12 +147,12 @@ do_random_tests (void)
   size_t i, j, n, align1, align2, pos, len;
   int result;
   long r;
-  unsigned char *p1 = buf1 + page_size - 512;
-  unsigned char *p2 = buf2 + page_size - 512;
+  UCHAR *p1 =  (UCHAR *) (buf1 + page_size - 512 * CHARBYTES);
+  UCHAR *p2 =  (UCHAR *) (buf2 + page_size - 512 * CHARBYTES);
 
   for (n = 0; n < ITERATIONS; n++)
     {
-      align1 = random () & 31;
+   align1 = random () & 31;
       if (random () & 1)
 	align2 = random () & 31;
       else
@@ -142,7 +165,7 @@ do_random_tests (void)
 	pos = 511 - j - (random () & 7);
       len = random () & 511;
       if (len + j >= 512)
-        len = 511 - j - (random () & 7);
+	len = 511 - j - (random () & 7);
       j = len + align1 + 64;
       if (j > 512) j = 512;
       for (i = 0; i < j; ++i)
@@ -152,10 +175,10 @@ do_random_tests (void)
 
       result = 0;
       if (pos >= len)
-	memcpy (p2 + align2, p1 + align1, len);
+	MEMCPY ((CHAR *) p2 + align2, (const CHAR *) p1 + align1, len);
       else
 	{
-	  memcpy (p2 + align2, p1 + align1, pos);
+	  MEMCPY ((CHAR *) p2 + align2, (const CHAR *) p1 + align1, pos);
 	  if (p2[align2 + pos] == p1[align1 + pos])
 	    {
 	      p2[align2 + pos] = random () & 255;
@@ -171,16 +194,14 @@ do_random_tests (void)
 
       FOR_EACH_IMPL (impl, 1)
 	{
-	  r = CALL (impl, (char *) (p1 + align1), (char *) (p2 + align2), len);
-	  /* Test whether on 64-bit architectures where ABI requires
-	     callee to promote has the promotion been done.  */
-	  asm ("" : "=g" (r) : "0" (r));
+	  r = CALL (impl, (CHAR *) p1 + align1, (const CHAR *) p2 + align2,
+		    len);
 	  if ((r == 0 && result)
 	      || (r < 0 && result >= 0)
 	      || (r > 0 && result <= 0))
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd) %ld != %d, p1 %p p2 %p",
-		     n, impl->name, align1, align2, len, pos, r, result, p1, p2);
+		     n, impl->name, align1 * CHARBYTES & 63,  align2 * CHARBYTES & 63, len, pos, r, result, p1, p2);
 	      ret = 1;
 	    }
 	}
@@ -190,7 +211,7 @@ do_random_tests (void)
 static void
 check1 (void)
 {
-  char s1[116], s2[116];
+  CHAR s1[116], s2[116];
   int n, exp_result;
 
   s1[0] = -108;
@@ -427,7 +448,7 @@ check1 (void)
   s2[115] = 1;
 
   n = 116;
-  exp_result = simple_memcmp (s1, s2, n);
+  exp_result = SIMPLE_MEMCMP (s1, s2, n);
   FOR_EACH_IMPL (impl, 0)
     check_result (impl, s1, s2, n, exp_result);
 }
@@ -448,9 +469,9 @@ test_main (void)
 
   for (i = 1; i < 16; ++i)
     {
-      do_test (i, i, i, 0);
-      do_test (i, i, i, 1);
-      do_test (i, i, i, -1);
+      do_test (i * CHARBYTES, i * CHARBYTES, i, 0);
+      do_test (i * CHARBYTES, i * CHARBYTES, i, 1);
+      do_test (i * CHARBYTES, i * CHARBYTES, i, -1);
     }
 
   for (i = 0; i < 16; ++i)
@@ -466,20 +487,19 @@ test_main (void)
       do_test (0, 0, 2 << i, 1);
       do_test (0, 0, 2 << i, -1);
       do_test (0, 0, 16 << i, 0);
-      do_test (8 - i, 2 * i, 16 << i, 0);
+      do_test ((8 - i) * CHARBYTES, (2 * i) * CHARBYTES, 16 << i, 0);
       do_test (0, 0, 16 << i, 1);
       do_test (0, 0, 16 << i, -1);
     }
 
   for (i = 1; i < 8; ++i)
     {
-      do_test (i, 2 * i, 8 << i, 0);
-      do_test (i, 2 * i, 8 << i, 1);
-      do_test (i, 2 * i, 8 << i, -1);
+      do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 0);
+      do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 1);
+      do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, -1);
     }
 
   do_random_tests ();
   return ret;
 }
-
 #include "../test-skeleton.c"
diff --git a/string/test-wmemcmp.c b/string/test-wmemcmp.c
new file mode 100644
index 0000000..bbf3068
--- /dev/null
+++ b/string/test-wmemcmp.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "test-memcmp.c"

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

Summary of changes:
 ChangeLog             |   13 ++++++
 string/Makefile       |    4 +-
 string/test-memcmp.c  |  102 +++++++++++++++++++++++++++++--------------------
 string/test-wcscmp.c  |    2 -
 wcsmbs/Makefile       |    5 +-
 wcsmbs/test-wcscmp.c  |    2 +
 wcsmbs/test-wmemcmp.c |    2 +
 7 files changed, 83 insertions(+), 47 deletions(-)
 delete mode 100644 string/test-wcscmp.c
 create mode 100644 wcsmbs/test-wcscmp.c
 create mode 100644 wcsmbs/test-wmemcmp.c


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


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