Adjust benchtests to new support library.
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 16 Dec 2016 17:35:06 +0000 (17:35 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 19 Dec 2016 18:04:16 +0000 (16:04 -0200)
This patch basically replaces the test-skeleton.c inclusion by
support/test-driver.c and also minor adjustments in bench-string.h.

Checked on x86_64-linux-gnu and powerpc64le-linux-gnu.

* benchtests/bench-string.h (TEST_FUNCTION): Use name without
parenthesis.
(CMDLINE_PROCESS): Define using function instead of macro.
* benchtests/bench-memccpy.c: Include <support/test-driver.c> instead
of test-skeleton.
* benchtests/bench-memchr.c: Likewise.
* benchtests/bench-memcmp.c: Likewise.
* benchtests/bench-memcpy-large.c: Likewise.
* benchtests/bench-memcpy.c: Likewise.
* benchtests/bench-memmem.c: Likewise.
* benchtests/bench-memmove-large.c: Likewise.
* benchtests/bench-memmove.c: Likewise.
* benchtests/bench-memset-large.c: Likewise.
* benchtests/bench-memset.c: Likewise.
* benchtests/bench-rawmemchr.c: Likewise.
* benchtests/bench-strcasecmp.c: Likewise.
* benchtests/bench-strcasestr.c: Likewise.
* benchtests/bench-strcat.c: Likewise.
* benchtests/bench-strchr.c: Likewise.
* benchtests/bench-strcmp.c: Likewise.
* benchtests/bench-strcpy.c: Likewise.
* benchtests/bench-strcpy_chk.c: Likewise.
* benchtests/bench-strlen.c: Likewise.
* benchtests/bench-strncasecmp.c: Likewise.
* benchtests/bench-strncmp.c: Likewise.
* benchtests/bench-strncpy.c: Likewise.
* benchtests/bench-strnlen.c: Likewise.
* benchtests/bench-strpbrk.c: Likewise.
* benchtests/bench-strrchr.c: Likewise.
* benchtests/bench-strsep.c: Likewise.
* benchtests/bench-strspn.c: Likewise.
* benchtests/bench-strstr.c: Likewise.
* benchtests/bench-strtok.c: Likewise.

31 files changed:
ChangeLog
benchtests/bench-memccpy.c
benchtests/bench-memchr.c
benchtests/bench-memcmp.c
benchtests/bench-memcpy-large.c
benchtests/bench-memcpy.c
benchtests/bench-memmem.c
benchtests/bench-memmove-large.c
benchtests/bench-memmove.c
benchtests/bench-memset-large.c
benchtests/bench-memset.c
benchtests/bench-rawmemchr.c
benchtests/bench-strcasecmp.c
benchtests/bench-strcasestr.c
benchtests/bench-strcat.c
benchtests/bench-strchr.c
benchtests/bench-strcmp.c
benchtests/bench-strcpy.c
benchtests/bench-strcpy_chk.c
benchtests/bench-string.h
benchtests/bench-strlen.c
benchtests/bench-strncasecmp.c
benchtests/bench-strncmp.c
benchtests/bench-strncpy.c
benchtests/bench-strnlen.c
benchtests/bench-strpbrk.c
benchtests/bench-strrchr.c
benchtests/bench-strsep.c
benchtests/bench-strspn.c
benchtests/bench-strstr.c
benchtests/bench-strtok.c

index 6a27320..fdb68ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2016-12-19  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * benchtests/bench-string.h (TEST_FUNCTION): Use name without
+       parenthesis.
+       (CMDLINE_PROCESS): Define using function instead of macro.
+       * benchtests/bench-memccpy.c: Include <support/test-driver.c> instead
+       of test-skeleton.
+       * benchtests/bench-memchr.c: Likewise.
+       * benchtests/bench-memcmp.c: Likewise.
+       * benchtests/bench-memcpy-large.c: Likewise.
+       * benchtests/bench-memcpy.c: Likewise.
+       * benchtests/bench-memmem.c: Likewise.
+       * benchtests/bench-memmove-large.c: Likewise.
+       * benchtests/bench-memmove.c: Likewise.
+       * benchtests/bench-memset-large.c: Likewise.
+       * benchtests/bench-memset.c: Likewise.
+       * benchtests/bench-rawmemchr.c: Likewise.
+       * benchtests/bench-strcasecmp.c: Likewise.
+       * benchtests/bench-strcasestr.c: Likewise.
+       * benchtests/bench-strcat.c: Likewise.
+       * benchtests/bench-strchr.c: Likewise.
+       * benchtests/bench-strcmp.c: Likewise.
+       * benchtests/bench-strcpy.c: Likewise.
+       * benchtests/bench-strcpy_chk.c: Likewise.
+       * benchtests/bench-strlen.c: Likewise.
+       * benchtests/bench-strncasecmp.c: Likewise.
+       * benchtests/bench-strncmp.c: Likewise.
+       * benchtests/bench-strncpy.c: Likewise.
+       * benchtests/bench-strnlen.c: Likewise.
+       * benchtests/bench-strpbrk.c: Likewise.
+       * benchtests/bench-strrchr.c: Likewise.
+       * benchtests/bench-strsep.c: Likewise.
+       * benchtests/bench-strspn.c: Likewise.
+       * benchtests/bench-strstr.c: Likewise.
+       * benchtests/bench-strtok.c: Likewise.
+
 2016-12-19  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * sysdeps/x86/cpu-features.c (get_common_indeces): Add
index 00ac3e1..9be8fa0 100644 (file)
@@ -160,4 +160,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index aa012f2..7b8299a 100644 (file)
@@ -153,4 +153,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 96d01a1..4f01d3d 100644 (file)
@@ -174,4 +174,5 @@ test_main (void)
 
   return ret;
 }
-#include "../test-skeleton.c"
+
+#include <support/test-driver.c>
index 1ef670e..7be9930 100644 (file)
@@ -120,4 +120,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 9d9e7b6..62e95c1 100644 (file)
@@ -166,4 +166,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 863f02f..ab80990 100644 (file)
@@ -161,4 +161,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index b8f11c1..840907b 100644 (file)
@@ -120,4 +120,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 3858f2a..9710863 100644 (file)
@@ -139,7 +139,7 @@ do_test (size_t align1, size_t align2, size_t len)
   putchar ('\n');
 }
 
-int
+static int
 test_main (void)
 {
   size_t i;
@@ -188,4 +188,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index e694b92..ede0081 100644 (file)
@@ -131,4 +131,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 98ec257..d7abb44 100644 (file)
@@ -190,4 +190,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 0c00c66..9cf5d5b 100644 (file)
@@ -123,4 +123,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index a9a748a..7a84ab5 100644 (file)
@@ -173,4 +173,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index bc58880..11e1aad 100644 (file)
@@ -177,4 +177,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 4fc2806..05207be 100644 (file)
@@ -171,4 +171,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 6512085..7fc7c37 100644 (file)
@@ -207,4 +207,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index f2d83c0..8597c69 100644 (file)
@@ -238,4 +238,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 5517221..a835662 100644 (file)
@@ -190,4 +190,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index ded6747..e987546 100644 (file)
@@ -53,8 +53,7 @@ simple_strcpy_chk (char *dst, const char *src, size_t len)
 #include <setjmp.h>
 #include <signal.h>
 
-static int test_main (void);
-#include "../test-skeleton.c"
+#include <support/support.h>
 
 volatile int chk_fail_ok;
 jmp_buf chk_fail_buf;
@@ -241,3 +240,5 @@ test_main (void)
 
   return 0;
 }
+
+#include <support/test-driver.c>
index 9c5371e..82cbe7a 100644 (file)
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <getopt.h>
 #include <sys/cdefs.h>
 
 typedef struct
@@ -55,7 +56,7 @@ extern impl_t __start_impls[], __stop_impls[];
 # include "bench-timing.h"
 
 
-# define TEST_FUNCTION test_main ()
+# define TEST_FUNCTION test_main
 # ifndef TIMEOUT
 #  define TIMEOUT (4 * 60)
 # endif
@@ -87,24 +88,31 @@ size_t iterations = 100000;
 # define CMDLINE_OPTIONS ITERATIONS_OPTIONS \
     { "random", no_argument, NULL, OPT_RANDOM },                             \
     { "seed", required_argument, NULL, OPT_SEED },
-# define CMDLINE_PROCESS ITERATIONS_PROCESS \
-    case OPT_RANDOM:                                                         \
-      {                                                                              \
-       int fdr = open ("/dev/urandom", O_RDONLY);                            \
-                                                                             \
-       if (fdr < 0 || read (fdr, &seed, sizeof(seed)) != sizeof (seed))      \
-         seed = time (NULL);                                                 \
-       if (fdr >= 0)                                                         \
-         close (fdr);                                                        \
-       do_srandom = 1;                                                       \
-       break;                                                                \
-      }                                                                              \
-                                                                             \
-    case OPT_SEED:                                                           \
-      seed = strtoul (optarg, NULL, 0);                                              \
-      do_srandom = 1;                                                        \
-      break;
 
+static void __attribute__ ((used))
+cmdline_process_function (int c)
+{
+  switch (c)
+    {
+      ITERATIONS_PROCESS
+      case OPT_RANDOM:
+       {
+         int fdr = open ("/dev/urandom", O_RDONLY);
+         if (fdr < 0 || read (fdr, &seed, sizeof(seed)) != sizeof (seed))
+           seed = time (NULL);
+         if (fdr >= 0)
+           close (fdr);
+         do_srandom = 1;
+         break;
+       }
+
+      case OPT_SEED:
+       seed = strtoul (optarg, NULL, 0);
+       do_srandom = 1;
+      break;
+    }
+}
+# define CMDLINE_PROCESS cmdline_process_function
 # define CALL(impl, ...)       \
     (* (proto_t) (impl)->fn) (__VA_ARGS__)
 
index a5305b5..f854059 100644 (file)
@@ -139,4 +139,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 6cbab7d..5570df2 100644 (file)
@@ -204,4 +204,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 2f03668..ac35c86 100644 (file)
@@ -296,4 +296,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 5843571..916eedb 100644 (file)
@@ -172,7 +172,7 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char)
   putchar ('\n');
 }
 
-int
+static int
 test_main (void)
 {
   size_t i;
@@ -207,4 +207,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index f3dbf97..794b994 100644 (file)
@@ -150,4 +150,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 6591a83..4647be7 100644 (file)
@@ -203,4 +203,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index ff93634..f211a2c 100644 (file)
@@ -181,4 +181,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 70dbb37..774a093 100644 (file)
@@ -171,4 +171,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 606a8dd..498b140 100644 (file)
@@ -189,4 +189,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 5e50e8e..b28685c 100644 (file)
@@ -174,4 +174,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
index 41e0e45..0c3bfe1 100644 (file)
@@ -177,4 +177,4 @@ test_main (void)
   return ret;
 }
 
-#include "../test-skeleton.c"
+#include <support/test-driver.c>