update test memmove.c to cover 16KB

This commit is contained in:
liqingqing_1229 2021-10-11 09:01:17 +08:00
parent 62e383a696
commit 09e73f980a
2 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,78 @@
From c333dcf8d8f9e6e46475d9eff24bd5394b5d3d9e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 1 Feb 2021 17:23:12 -0800
Subject: [PATCH] Update string/test-memmove.c to cover 16KB copy
---
string/test-memmove.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/string/test-memmove.c b/string/test-memmove.c
index b271248..670094c 100644
--- a/string/test-memmove.c
+++ b/string/test-memmove.c
@@ -312,6 +312,50 @@ do_test2 (size_t offset)
munmap ((void *) large_buf, size);
}
+static void
+do_test3 (size_t bytes_move, size_t offset)
+{
+ size_t size = bytes_move * 3;
+ uint32_t *buf;
+
+ buf = mmap (NULL, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+
+ if (buf == MAP_FAILED)
+ error (EXIT_UNSUPPORTED, errno, "mmap failed");
+
+ size_t arr_size = bytes_move / sizeof (uint32_t);
+ size_t i;
+
+ FOR_EACH_IMPL (impl, 0)
+ {
+ for (i = 0; i < arr_size; i++)
+ buf[i] = (uint32_t) i;
+
+ uint32_t *dst = &buf[arr_size + offset];
+
+#ifdef TEST_BCOPY
+ CALL (impl, (char *) buf, (char *) dst, bytes_move);
+#else
+ CALL (impl, (char *) dst, (char *) buf, bytes_move);
+#endif
+
+ for (i = 0; i < arr_size; i++)
+ {
+ if (dst[i] != (uint32_t) i)
+ {
+ error (0, 0,
+ "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%zd\"",
+ impl->name, dst, buf, i);
+ ret = 1;
+ break;
+ }
+ }
+ }
+
+ munmap ((void *) buf, size);
+}
+
int
test_main (void)
{
@@ -356,6 +400,10 @@ test_main (void)
do_test2 (0x200000);
do_test2 (0x4000000 - 1);
do_test2 (0x4000000);
+
+ /* Copy 16KB data. */
+ do_test3 (16384, 3);
+
return ret;
}
--
1.8.3.1

View File

@ -63,7 +63,7 @@
##############################################################################
Name: glibc
Version: 2.34
Release: 9
Release: 10
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -106,6 +106,7 @@ Patch25: Remove-sysdeps-tls-macros.h.patch
Patch26: riscv-Drop-reliance-on-_GLOBAL_OFFSET_TABLE_-0.patch
Patch27: x86_64-Simplify-elf_machine_-load_address-dynamic.patch
Patch28: x86-fix-Autoconf-caching-of-instruction-support-chec.patch
Patch29: Update-string-test-memmove.c-to-cover-16KB-copy.patch
#Patch9000: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch
Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch
@ -1197,6 +1198,9 @@ fi
%doc hesiod/README.hesiod
%changelog
* Mon Oct 11 2021 Qingqing Li<liqingqing3@huawei.com> - 2.34-10
- update test memmove.c to cover 16KB.
* Wed Sep 29 2021 Qingqing Li<liqingqing3@huawei.com> - 2.34-9
- elf: drop elf/tls-macros.h in favor of thread tls_mode attribute.
- use __ehdr_start for __GLOBAL_OFFSET_TABLE[0]