From patchwork Mon Dec 19 14:04:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 88473 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1173605qgi; Mon, 19 Dec 2016 06:04:59 -0800 (PST) X-Received: by 10.84.213.137 with SMTP id g9mr35053650pli.146.1482156299028; Mon, 19 Dec 2016 06:04:59 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e132si18519734pfg.66.2016.12.19.06.04.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Dec 2016 06:04:59 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-76075-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-76075-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-76075-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=aao1CuHSTGo4BDsAoS53b64LzEpFIHOfKf7M9Pdc3oHpDwZd0Ox+W 8vfvO/CMLnh+qVGbeqfe44SLti0CxAil3H/EwJ+z7KB1bco7xk+YAfCJ4D1uk7ac 5O4ytKMRbbGrKBbQX84t/cWQTZtT8XqAPQT2OdH22OWKp9i76bWbuk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=YVjNPVoMiASvXjEFsuN6CKaElVY=; b=BwknAOeuBBOcwmxDYunVOrCQZ5is ptIeX0NdvaQpFFl8XPQAORCiOZR5ZyDnIOvebpnRN7IP45uryn0ADuHL1jSUKIqM JOuDRC+NgQ0QO9Ac264ZsJrK+4uUV3zgah6ikzoRv8KmVGWXUGgWCScRgsE/6SjU uVNVE1CkSroFHWI= Received: (qmail 115914 invoked by alias); 19 Dec 2016 14:04:43 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 115894 invoked by uid 89); 19 Dec 2016 14:04:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=100000, testskeleton, test-skeleton, benchtests X-HELO: mail-yw0-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=g56try1f/nw1E/oi5GigqwEgZuVkRgAl6nUreGgAHSk=; b=MfCeKTAiXquE9M8EN6EBXi47hR2RNKgFNzUJ9HDxRcvT8nQLdNn6Kxs7pA7vFfdK7y GxRdXnEKMCxKjdmAtuWxlDE9rMXIHSNaMeEZ/lZAG0W1CIP6yGDhePaFxy47js7ygwdO r10q8P3wAcEAfCreKTCbxBrbmMhx0HffpNsDELwXNuggsKWWYXnErgh7G5IuEI3B/5wW fPnEzRK/G7EIxHfeQe361y/9gCU9EyKtDU1pNd3Meyl0I+HapGcUCluI/KaLTOLDfaz5 ajCnxupyKyrwPyzv7U0WIhN+mI1soarMVz7tgPsKtdMdCMXh5YknFXP8UgYPz8Bghy++ UdhQ== X-Gm-Message-State: AIkVDXL7+3efZirzzq2MJt7h1gT/kJD/ZXLnwha4iOEFdfHrEan5k7mEhj+CoGNMBf9ezdlK X-Received: by 10.129.39.136 with SMTP id n130mr11879807ywn.129.1482156270761; Mon, 19 Dec 2016 06:04:30 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/4] Adjust benchtests to new support library. Date: Mon, 19 Dec 2016 12:04:20 -0200 Message-Id: <1482156263-22267-1-git-send-email-adhemerval.zanella@linaro.org> 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 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. --- ChangeLog | 36 ++++++++++++++++++++++++++++++++ benchtests/bench-memccpy.c | 2 +- benchtests/bench-memchr.c | 2 +- benchtests/bench-memcmp.c | 3 ++- benchtests/bench-memcpy-large.c | 2 +- benchtests/bench-memcpy.c | 2 +- benchtests/bench-memmem.c | 2 +- benchtests/bench-memmove-large.c | 2 +- benchtests/bench-memmove.c | 4 ++-- benchtests/bench-memset-large.c | 2 +- benchtests/bench-memset.c | 2 +- benchtests/bench-rawmemchr.c | 2 +- benchtests/bench-strcasecmp.c | 2 +- benchtests/bench-strcasestr.c | 2 +- benchtests/bench-strcat.c | 2 +- benchtests/bench-strchr.c | 2 +- benchtests/bench-strcmp.c | 2 +- benchtests/bench-strcpy.c | 2 +- benchtests/bench-strcpy_chk.c | 5 +++-- benchtests/bench-string.h | 44 ++++++++++++++++++++++++---------------- benchtests/bench-strlen.c | 2 +- benchtests/bench-strncasecmp.c | 2 +- benchtests/bench-strncmp.c | 2 +- benchtests/bench-strncpy.c | 4 ++-- benchtests/bench-strnlen.c | 2 +- benchtests/bench-strpbrk.c | 2 +- benchtests/bench-strrchr.c | 2 +- benchtests/bench-strsep.c | 2 +- benchtests/bench-strspn.c | 2 +- benchtests/bench-strstr.c | 2 +- benchtests/bench-strtok.c | 2 +- 31 files changed, 96 insertions(+), 50 deletions(-) -- 2.7.4 diff --git a/benchtests/bench-memccpy.c b/benchtests/bench-memccpy.c index 00ac3e1..9be8fa0 100644 --- a/benchtests/bench-memccpy.c +++ b/benchtests/bench-memccpy.c @@ -160,4 +160,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memchr.c b/benchtests/bench-memchr.c index aa012f2..7b8299a 100644 --- a/benchtests/bench-memchr.c +++ b/benchtests/bench-memchr.c @@ -153,4 +153,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memcmp.c b/benchtests/bench-memcmp.c index 96d01a1..4f01d3d 100644 --- a/benchtests/bench-memcmp.c +++ b/benchtests/bench-memcmp.c @@ -174,4 +174,5 @@ test_main (void) return ret; } -#include "../test-skeleton.c" + +#include diff --git a/benchtests/bench-memcpy-large.c b/benchtests/bench-memcpy-large.c index 1ef670e..7be9930 100644 --- a/benchtests/bench-memcpy-large.c +++ b/benchtests/bench-memcpy-large.c @@ -120,4 +120,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c index 9d9e7b6..62e95c1 100644 --- a/benchtests/bench-memcpy.c +++ b/benchtests/bench-memcpy.c @@ -166,4 +166,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memmem.c b/benchtests/bench-memmem.c index 863f02f..ab80990 100644 --- a/benchtests/bench-memmem.c +++ b/benchtests/bench-memmem.c @@ -161,4 +161,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memmove-large.c b/benchtests/bench-memmove-large.c index b8f11c1..840907b 100644 --- a/benchtests/bench-memmove-large.c +++ b/benchtests/bench-memmove-large.c @@ -120,4 +120,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memmove.c b/benchtests/bench-memmove.c index 3858f2a..9710863 100644 --- a/benchtests/bench-memmove.c +++ b/benchtests/bench-memmove.c @@ -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 diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c index e694b92..ede0081 100644 --- a/benchtests/bench-memset-large.c +++ b/benchtests/bench-memset-large.c @@ -131,4 +131,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c index 98ec257..d7abb44 100644 --- a/benchtests/bench-memset.c +++ b/benchtests/bench-memset.c @@ -190,4 +190,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-rawmemchr.c b/benchtests/bench-rawmemchr.c index 0c00c66..9cf5d5b 100644 --- a/benchtests/bench-rawmemchr.c +++ b/benchtests/bench-rawmemchr.c @@ -123,4 +123,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strcasecmp.c b/benchtests/bench-strcasecmp.c index a9a748a..7a84ab5 100644 --- a/benchtests/bench-strcasecmp.c +++ b/benchtests/bench-strcasecmp.c @@ -173,4 +173,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strcasestr.c b/benchtests/bench-strcasestr.c index bc58880..11e1aad 100644 --- a/benchtests/bench-strcasestr.c +++ b/benchtests/bench-strcasestr.c @@ -177,4 +177,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strcat.c b/benchtests/bench-strcat.c index 4fc2806..05207be 100644 --- a/benchtests/bench-strcat.c +++ b/benchtests/bench-strcat.c @@ -171,4 +171,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strchr.c b/benchtests/bench-strchr.c index 6512085..7fc7c37 100644 --- a/benchtests/bench-strchr.c +++ b/benchtests/bench-strchr.c @@ -207,4 +207,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strcmp.c b/benchtests/bench-strcmp.c index f2d83c0..8597c69 100644 --- a/benchtests/bench-strcmp.c +++ b/benchtests/bench-strcmp.c @@ -238,4 +238,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strcpy.c b/benchtests/bench-strcpy.c index 5517221..a835662 100644 --- a/benchtests/bench-strcpy.c +++ b/benchtests/bench-strcpy.c @@ -190,4 +190,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strcpy_chk.c b/benchtests/bench-strcpy_chk.c index ded6747..e987546 100644 --- a/benchtests/bench-strcpy_chk.c +++ b/benchtests/bench-strcpy_chk.c @@ -53,8 +53,7 @@ simple_strcpy_chk (char *dst, const char *src, size_t len) #include #include -static int test_main (void); -#include "../test-skeleton.c" +#include volatile int chk_fail_ok; jmp_buf chk_fail_buf; @@ -241,3 +240,5 @@ test_main (void) return 0; } + +#include diff --git a/benchtests/bench-string.h b/benchtests/bench-string.h index 9c5371e..82cbe7a 100644 --- a/benchtests/bench-string.h +++ b/benchtests/bench-string.h @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include 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__) diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c index a5305b5..f854059 100644 --- a/benchtests/bench-strlen.c +++ b/benchtests/bench-strlen.c @@ -139,4 +139,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strncasecmp.c b/benchtests/bench-strncasecmp.c index 6cbab7d..5570df2 100644 --- a/benchtests/bench-strncasecmp.c +++ b/benchtests/bench-strncasecmp.c @@ -204,4 +204,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strncmp.c b/benchtests/bench-strncmp.c index 2f03668..ac35c86 100644 --- a/benchtests/bench-strncmp.c +++ b/benchtests/bench-strncmp.c @@ -296,4 +296,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strncpy.c b/benchtests/bench-strncpy.c index 5843571..916eedb 100644 --- a/benchtests/bench-strncpy.c +++ b/benchtests/bench-strncpy.c @@ -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 diff --git a/benchtests/bench-strnlen.c b/benchtests/bench-strnlen.c index f3dbf97..794b994 100644 --- a/benchtests/bench-strnlen.c +++ b/benchtests/bench-strnlen.c @@ -150,4 +150,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strpbrk.c b/benchtests/bench-strpbrk.c index 6591a83..4647be7 100644 --- a/benchtests/bench-strpbrk.c +++ b/benchtests/bench-strpbrk.c @@ -203,4 +203,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strrchr.c b/benchtests/bench-strrchr.c index ff93634..f211a2c 100644 --- a/benchtests/bench-strrchr.c +++ b/benchtests/bench-strrchr.c @@ -181,4 +181,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strsep.c b/benchtests/bench-strsep.c index 70dbb37..774a093 100644 --- a/benchtests/bench-strsep.c +++ b/benchtests/bench-strsep.c @@ -171,4 +171,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strspn.c b/benchtests/bench-strspn.c index 606a8dd..498b140 100644 --- a/benchtests/bench-strspn.c +++ b/benchtests/bench-strspn.c @@ -189,4 +189,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strstr.c b/benchtests/bench-strstr.c index 5e50e8e..b28685c 100644 --- a/benchtests/bench-strstr.c +++ b/benchtests/bench-strstr.c @@ -174,4 +174,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include diff --git a/benchtests/bench-strtok.c b/benchtests/bench-strtok.c index 41e0e45..0c3bfe1 100644 --- a/benchtests/bench-strtok.c +++ b/benchtests/bench-strtok.c @@ -177,4 +177,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include