about summary refs log tree commit diff
path: root/string/test-strncpy.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-07 09:03:23 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-07 09:03:23 +0000
commit739ca6906afb26bcf3c01cdf47e8cca0bbeca635 (patch)
tree745d311ad7f15fd7ffe1496f9d5d417d6e4c69d0 /string/test-strncpy.c
parent4614167ae7b81851d332316d09bd418a062b1278 (diff)
downloadglibc-739ca6906afb26bcf3c01cdf47e8cca0bbeca635.tar.gz
glibc-739ca6906afb26bcf3c01cdf47e8cca0bbeca635.tar.xz
glibc-739ca6906afb26bcf3c01cdf47e8cca0bbeca635.zip
Update.
2002-12-07  Kenneth W. Chen <kenneth.w.chen@intel.com>.

	* sysdeps/ia64/strncpy.S (strncpy): Clear ar.ec.  Fix .recovery4.

2002-12-07  Jakub Jelinek  <jakub@redhat.com>

	* string/test-strncpy.c (do_random_tests): Improve test coverage.
Diffstat (limited to 'string/test-strncpy.c')
-rw-r--r--string/test-strncpy.c59
1 files changed, 42 insertions, 17 deletions
diff --git a/string/test-strncpy.c b/string/test-strncpy.c
index 7820b61158..c30c9b040b 100644
--- a/string/test-strncpy.c
+++ b/string/test-strncpy.c
@@ -144,32 +144,57 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
 static void
 do_random_tests (void)
 {
-  size_t i, j, n, align1, align2, len, size;
+  size_t i, j, n, align1, align2, len, size, mode;
   unsigned char *p1 = buf1 + page_size - 512;
   unsigned char *p2 = buf2 + page_size - 512;
   unsigned char *res;
 
   for (n = 0; n < ITERATIONS; n++)
     {
-      align1 = random () & 31;
-      if (random () & 1)
-	align2 = random () & 31;
-      else
-	align2 = align1 + (random () & 24);
-      len = random () & 511;
-      j = align1;
-      if (align2 > j)
-	j = align2;
-      if (random () & 1)
+      mode = random ();
+      if (mode & 1)
 	{
-	  size = random () & 511;
-	  if (size + align2 > 512)
-	    size = 512 - align2 - (random() & 31);
+	  size = random () & 255;
+	  align1 = 512 - size - (random () & 15);
+	  if (mode & 2)
+	    align2 = align1 - (random () & 24);
+	  else
+	    align2 = align1 - (random () & 31);
+	  if (mode & 4)
+	    {
+	      j = align1;
+	      align1 = align2;
+	      align2 = j;
+	    }
+	  if (mode & 8)
+	    len = size - (random () & 31);
+	  else
+	    len = 512;
+	  if (len >= 512)
+	    len = random () & 511;
 	}
       else
-	size = 512 - align2;
-      if (len + j >= 511)
-	len = 510 - j - (random () & 7);
+	{
+	  align1 = random () & 31;
+	  if (mode & 2)
+	    align2 = random () & 31;
+	  else
+	    align2 = align1 + (random () & 24);
+	  len = random () & 511;
+	  j = align1;
+	  if (align2 > j)
+	    j = align2;
+	  if (mode & 4)
+	    {
+	      size = random () & 511;
+	      if (size + j > 512)
+		size = 512 - j - (random() & 31);
+	    }
+	  else
+	    size = 512 - j;
+	  if ((mode & 8) && len + j >= 512)
+	    len = 512 - j - (random () & 7);
+	}
       j = len + align1 + 64;
       if (j > 512)
 	j = 512;