Patchwork [COMITTED,1/2] benchtests: Remove verification runs from benchmark tests

login
register
mail settings
Submitter Siddhesh Poyarekar
Date Aug. 11, 2017, 7:08 a.m.
Message ID <1502435291-17611-1-git-send-email-siddhesh@sourceware.org>
Download mbox | patch
Permalink /patch/22065/
State New
Headers show

Comments

Siddhesh Poyarekar - Aug. 11, 2017, 7:08 a.m.
The test run is unnecessary and interferes with the benchmark.  The
tests are done during make check, so they're unnecessary here.

	* benchtests/bench-memccpy.c (do_one_test): Remove checks.
	* benchtests/bench-memchr.c (do_one_test): Likewise.
	* benchtests/bench-memcpy-large.c (do_one_test): Likewise.
	* benchtests/bench-memcpy.c (do_one_test): Likewise.
	* benchtests/bench-memmove-large.c (do_one_test): Likewise.
	* benchtests/bench-memmove.c (do_one_test): Likewise.
	* benchtests/bench-memset-large.c (do_one_test): Likewise.
	* benchtests/bench-memset.c (do_one_test): Likewise.
	* benchtests/bench-string.h (test_init): Remove memsets.
---
 ChangeLog                        | 12 ++++++++++++
 benchtests/bench-memccpy.c       | 16 ----------------
 benchtests/bench-memchr.c        | 16 ++--------------
 benchtests/bench-memcpy-large.c  | 20 --------------------
 benchtests/bench-memcpy.c        | 20 --------------------
 benchtests/bench-memmove-large.c | 21 ---------------------
 benchtests/bench-memmove.c       | 25 -------------------------
 benchtests/bench-memset-large.c  | 19 -------------------
 benchtests/bench-memset.c        | 16 ----------------
 benchtests/bench-string.h        |  3 ---
 10 files changed, 14 insertions(+), 154 deletions(-)

Patch

diff --git a/ChangeLog b/ChangeLog
index 9e7dd95..9d80804 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@ 
+2017-08-11  Siddhesh Poyarekar  <siddhesh@sourceware.org>
+
+	* benchtests/bench-memccpy.c (do_one_test): Remove checks.
+	* benchtests/bench-memchr.c (do_one_test): Likewise.
+	* benchtests/bench-memcpy-large.c (do_one_test): Likewise.
+	* benchtests/bench-memcpy.c (do_one_test): Likewise.
+	* benchtests/bench-memmove-large.c (do_one_test): Likewise.
+	* benchtests/bench-memmove.c (do_one_test): Likewise.
+	* benchtests/bench-memset-large.c (do_one_test): Likewise.
+	* benchtests/bench-memset.c (do_one_test): Likewise.
+	* benchtests/bench-string.h (test_init): Remove memsets.
+
 2017-08-10  Rical Jasan  <ricaljasan@pacific.net>
 
 	* manual/lang.texi
diff --git a/benchtests/bench-memccpy.c b/benchtests/bench-memccpy.c
index 7549687..278de51 100644
--- a/benchtests/bench-memccpy.c
+++ b/benchtests/bench-memccpy.c
@@ -58,25 +58,9 @@  static void
 do_one_test (impl_t *impl, void *dst, const void *src, int c, size_t len,
 	     size_t n)
 {
-  void *expect = len > n ? NULL : (char *) dst + len;
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
-  if (CALL (impl, dst, src, c, n) != expect)
-    {
-      error (0, 0, "Wrong result in function %s %p %p", impl->name,
-	     CALL (impl, dst, src, c, n), expect);
-      ret = 1;
-      return;
-    }
-
-  if (memcmp (dst, src, len > n ? n : len) != 0)
-    {
-      error (0, 0, "Wrong result in function %s", impl->name);
-      ret = 1;
-      return;
-    }
-
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c
index 92b5b7f..59d6eab 100644
--- a/benchtests/bench-memchr.c
+++ b/benchtests/bench-memchr.c
@@ -59,20 +59,11 @@  SIMPLE_MEMCHR (const CHAR *s, int c, size_t n)
 #endif /* !USE_AS_MEMRCHR */
 
 static void
-do_one_test (impl_t *impl, const CHAR *s, int c, size_t n, CHAR *exp_res)
+do_one_test (impl_t *impl, const CHAR *s, int c, size_t n)
 {
-  CHAR *res = CALL (impl, s, c, n);
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
-  if (res != exp_res)
-    {
-      error (0, 0, "Wrong result in function %s %p %p", impl->name,
-	     res, exp_res);
-      ret = 1;
-      return;
-    }
-
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
@@ -89,7 +80,6 @@  static void
 do_test (size_t align, size_t pos, size_t len, int seek_char)
 {
   size_t i;
-  CHAR *result;
 
   align &= 7;
   if ((align + len) * sizeof (CHAR) >= page_size)
@@ -109,11 +99,9 @@  do_test (size_t align, size_t pos, size_t len, int seek_char)
     {
       buf[align + pos] = seek_char;
       buf[align + len] = -seek_char;
-      result = (CHAR *) (buf + align + pos);
     }
   else
     {
-      result = NULL;
       buf[align + len] = seek_char;
     }
 
@@ -121,7 +109,7 @@  do_test (size_t align, size_t pos, size_t len, int seek_char)
 	  len, pos, align);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, (CHAR *) (buf + align), seek_char, len, result);
+    do_one_test (impl, (CHAR *) (buf + align), seek_char, len);
 
   putchar ('\n');
 }
diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c
index 965edf5..1dea16f 100644
--- a/benchtests/bench-memcpy-large.c
+++ b/benchtests/bench-memcpy-large.c
@@ -39,26 +39,6 @@  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
   size_t i, iters = 16;
   timing_t start, stop, cur;
 
-  /* Must clear the destination buffer updated by the previous run.  */
-  for (i = 0; i < len; i++)
-    dst[i] = 0;
-
-  if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
-    {
-      error (0, 0, "Wrong result in function %s %p %p", impl->name,
-	     CALL (impl, dst, src, len), MEMCPY_RESULT (dst, len));
-      ret = 1;
-      return;
-    }
-
-  if (memcmp (dst, src, len) != 0)
-    {
-      error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
-	     impl->name, dst, src);
-      ret = 1;
-      return;
-    }
-
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c
index d80c644..af920bc 100644
--- a/benchtests/bench-memcpy.c
+++ b/benchtests/bench-memcpy.c
@@ -57,26 +57,6 @@  do_one_test (json_ctx_t *json_ctx, impl_t *impl, char *dst, const char *src,
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
-  /* Must clear the destination buffer set by the previous run.  */
-  for (i = 0; i < len; i++)
-    dst[i] = 0;
-
-  if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
-    {
-      error (0, 0, "Wrong result in function %s %p %p", impl->name,
-	     CALL (impl, dst, src, len), MEMCPY_RESULT (dst, len));
-      ret = 1;
-      return;
-    }
-
-  if (memcmp (dst, src, len) != 0)
-    {
-      error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
-	     impl->name, dst, src);
-      ret = 1;
-      return;
-    }
-
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c
index e17cea0..5230c6e 100644
--- a/benchtests/bench-memmove-large.c
+++ b/benchtests/bench-memmove-large.c
@@ -35,27 +35,6 @@  do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
   size_t i, iters = 16;
   timing_t start, stop, cur;
 
-  /* This also clears the destination buffer updated by the previous
-     run.  */
-  memcpy (src, orig_src, len);
-
-  char *res = CALL (impl, dst, src, len);
-  if (res != dst)
-    {
-      error (0, 0, "Wrong result in function %s %p %p", impl->name,
-	     res, dst);
-      ret = 1;
-      return;
-    }
-
-  if (memcmp (dst, orig_src, len) != 0)
-    {
-      error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
-	     impl->name, dst, src);
-      ret = 1;
-      return;
-    }
-
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
diff --git a/benchtests/bench-memmove.c b/benchtests/bench-memmove.c
index 4cbaa46..93c58a6 100644
--- a/benchtests/bench-memmove.c
+++ b/benchtests/bench-memmove.c
@@ -70,31 +70,6 @@  do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
-  /* This also clears the destination buffer set by the previous run.  */
-  memcpy (src, orig_src, len);
-#ifdef TEST_BCOPY
-  CALL (impl, src, dst, len);
-#else
-  char *res;
-
-  res = CALL (impl, dst, src, len);
-  if (res != dst)
-    {
-      error (0, 0, "Wrong result in function %s %p %p", impl->name,
-	     res, dst);
-      ret = 1;
-      return;
-    }
-#endif
-
-  if (memcmp (dst, orig_src, len) != 0)
-    {
-      error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
-	     impl->name, dst, src);
-      ret = 1;
-      return;
-    }
-
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
     {
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 6cfe8a5..d18a05e 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -61,23 +61,6 @@  do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
 {
   size_t i, iters = 16;
   timing_t start, stop, cur;
-  CHAR *tstbuf = malloc (n * sizeof (*s));
-  assert (tstbuf != NULL);
-
-  /* Must clear the destination buffer updated by the previous run.  */
-  for (i = 0; i < n; i++)
-    s[i] = 0;
-
-  CHAR *res = CALL (impl, s, c, n);
-  if (res != s
-      || SIMPLE_MEMSET (tstbuf, c, n) != tstbuf
-      || MEMCMP (s, tstbuf, n) != 0)
-    {
-      error (0, 0, "Wrong result in function %s", impl->name);
-      ret = 1;
-      free (tstbuf);
-      return;
-    }
 
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
@@ -89,8 +72,6 @@  do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
   TIMING_DIFF (cur, start, stop);
 
   TIMING_PRINT_MEAN ((double) cur, (double) iters);
-
-  free (tstbuf);
 }
 
 static void
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index dc7944c..6b5c57f 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -98,22 +98,6 @@  do_one_test (impl_t *impl, CHAR *s, int c __attribute ((unused)), size_t n)
 {
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
-  CHAR tstbuf[n];
-#ifdef TEST_BZERO
-  simple_bzero (tstbuf, n);
-  CALL (impl, s, n);
-  if (memcmp (s, tstbuf, n) != 0)
-#else
-  CHAR *res = CALL (impl, s, c, n);
-  if (res != s
-      || SIMPLE_MEMSET (tstbuf, c, n) != tstbuf
-      || MEMCMP (s, tstbuf, n) != 0)
-#endif /* !TEST_BZERO */
-    {
-      error (0, 0, "Wrong result in function %s", impl->name);
-      ret = 1;
-      return;
-    }
 
   TIMING_NOW (start);
   for (i = 0; i < iters; ++i)
diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h
index d76724d..3aacfdf 100644
--- a/benchtests/bench-string.h
+++ b/benchtests/bench-string.h
@@ -203,9 +203,6 @@  test_init (void)
       printf ("Setting seed to 0x%x\n", seed);
       srandom (seed);
     }
-
-  memset (buf1, 0xa5, BUF1PAGES * page_size);
-  memset (buf2, 0x5a, page_size);
 }
 
 #endif /* TEST_MAIN */