public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] arm: XFAIL string/tst-memmove-overflow due to bug 25620
@ 2020-05-13 14:46 Florian Weimer
  2020-05-13 14:47 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2020-05-13 14:46 UTC (permalink / raw)
  To: libc-alpha; +Cc: Andreas Schwab, carlos

Also reduce the amount of output in case of a large-scale mismatch in
the copied data.

---
 string/tst-memmove-overflow.c | 23 +++++++++++++++++++++--
 sysdeps/arm/Makefile          |  5 +++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/string/tst-memmove-overflow.c b/string/tst-memmove-overflow.c
index b744679ef4..77d693d0dd 100644
--- a/string/tst-memmove-overflow.c
+++ b/string/tst-memmove-overflow.c
@@ -57,6 +57,25 @@ expected_value (size_t index)
   return randomized >> 25;	/* Result is in the range [0, 127].  */
 }
 
+/* Used to count mismatches up to a limit, to avoid creating a huge
+   test output file.  */
+static unsigned int mismatch_count;
+
+/* Check ACTUAL == EXPECTED.  Use INDEX for error reporting.  Exit the
+   process after too many errors.  */
+static inline void
+check_one_index (size_t index, unsigned char actual, unsigned char expected)
+{
+  if (actual != expected)
+    {
+      printf ("error: mismatch at index %zu: expected 0x%02x, got 0x%02x\n",
+	      index, actual, expected);
+      ++mismatch_count;
+      if (mismatch_count > 200)
+	FAIL_EXIT1 ("bailing out due to too many errors");
+    }
+}
+
 static int
 test_main (void)
 {
@@ -138,13 +157,13 @@ test_main (void)
 			 start + allocation_size - sizeof (expected_end) - 1,
 			 sizeof (expected_end));
       for (size_t i = 0; i < unshared_size - 1; ++i)
-	TEST_COMPARE (start[i], expected_value (i + 1));
+	check_one_index (i, start[i], expected_value (i + 1));
       /* The gap between the checked start and end area of the mapping
 	 has shared mappings at unspecified boundaries, so do not
 	 check the expected values in the middle.  */
       for (size_t i = allocation_size - unshared_size; i < allocation_size - 1;
 	   ++i)
-	TEST_COMPARE (start[i], expected_value (i + 1));
+	check_one_index (i, start[i], expected_value (i + 1));
 
       support_blob_repeat_free (&repeat);
     }
diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
index ad2042b93a..a0cb7f3c32 100644
--- a/sysdeps/arm/Makefile
+++ b/sysdeps/arm/Makefile
@@ -68,3 +68,8 @@ ifeq ($(subdir),nptl)
 libpthread-sysdep_routines += pt-arm-unwind-resume
 libpthread-shared-only-routines += pt-arm-unwind-resume
 endif
+
+ifeq ($(subdir),string)
+# This test fails on arm due to bug 25620 and related issues.
+test-xfail-tst-memmove-overflow = yes
+endif

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm: XFAIL string/tst-memmove-overflow due to bug 25620
  2020-05-13 14:46 [PATCH] arm: XFAIL string/tst-memmove-overflow due to bug 25620 Florian Weimer
@ 2020-05-13 14:47 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2020-05-13 14:47 UTC (permalink / raw)
  To: Florian Weimer, libc-alpha; +Cc: Andreas Schwab

On 5/13/20 10:46 AM, Florian Weimer wrote:
> Also reduce the amount of output in case of a large-scale mismatch in
> the copied data.

OK formaster.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  string/tst-memmove-overflow.c | 23 +++++++++++++++++++++--
>  sysdeps/arm/Makefile          |  5 +++++
>  2 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/string/tst-memmove-overflow.c b/string/tst-memmove-overflow.c
> index b744679ef4..77d693d0dd 100644
> --- a/string/tst-memmove-overflow.c
> +++ b/string/tst-memmove-overflow.c
> @@ -57,6 +57,25 @@ expected_value (size_t index)
>    return randomized >> 25;	/* Result is in the range [0, 127].  */
>  }
>  
> +/* Used to count mismatches up to a limit, to avoid creating a huge
> +   test output file.  */
> +static unsigned int mismatch_count;

OK.

> +
> +/* Check ACTUAL == EXPECTED.  Use INDEX for error reporting.  Exit the
> +   process after too many errors.  */
> +static inline void
> +check_one_index (size_t index, unsigned char actual, unsigned char expected)
> +{
> +  if (actual != expected)
> +    {
> +      printf ("error: mismatch at index %zu: expected 0x%02x, got 0x%02x\n",
> +	      index, actual, expected);
> +      ++mismatch_count;
> +      if (mismatch_count > 200)
> +	FAIL_EXIT1 ("bailing out due to too many errors");

OK.

> +    }
> +}
> +
>  static int
>  test_main (void)
>  {
> @@ -138,13 +157,13 @@ test_main (void)
>  			 start + allocation_size - sizeof (expected_end) - 1,
>  			 sizeof (expected_end));
>        for (size_t i = 0; i < unshared_size - 1; ++i)
> -	TEST_COMPARE (start[i], expected_value (i + 1));
> +	check_one_index (i, start[i], expected_value (i + 1));

OK.

>        /* The gap between the checked start and end area of the mapping
>  	 has shared mappings at unspecified boundaries, so do not
>  	 check the expected values in the middle.  */
>        for (size_t i = allocation_size - unshared_size; i < allocation_size - 1;
>  	   ++i)
> -	TEST_COMPARE (start[i], expected_value (i + 1));
> +	check_one_index (i, start[i], expected_value (i + 1));

OK.

>  
>        support_blob_repeat_free (&repeat);
>      }
> diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
> index ad2042b93a..a0cb7f3c32 100644
> --- a/sysdeps/arm/Makefile
> +++ b/sysdeps/arm/Makefile
> @@ -68,3 +68,8 @@ ifeq ($(subdir),nptl)
>  libpthread-sysdep_routines += pt-arm-unwind-resume
>  libpthread-shared-only-routines += pt-arm-unwind-resume
>  endif
> +
> +ifeq ($(subdir),string)
> +# This test fails on arm due to bug 25620 and related issues.
> +test-xfail-tst-memmove-overflow = yes

OK.

> +endif
> 


-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-13 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 14:46 [PATCH] arm: XFAIL string/tst-memmove-overflow due to bug 25620 Florian Weimer
2020-05-13 14:47 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).