Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7421133rwp; Tue, 18 Jul 2023 15:18:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlGDp800/alXqTsmV3aYgZTpMlm12ble+E5QxvxXn12zyJ3LvPvZbm9mLIHK6RDEVHWn1l+2 X-Received: by 2002:a17:907:3f22:b0:95e:d3f5:3d47 with SMTP id hq34-20020a1709073f2200b0095ed3f53d47mr1036256ejc.48.1689718734873; Tue, 18 Jul 2023 15:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689718734; cv=none; d=google.com; s=arc-20160816; b=IhIaOxcNWww227zIoEffOg1yGGs5T5S6uGMVraMMvnBSB5bg5/lcaiVJX9btSRzSRU 3fSw4v6WX1ezZ4o5dM306eydH1zCcLMF3mO2yfSh6t8y+8ul113xohK/sGElOqr4PTvG sMmGGr++X1gQYpoET2MFnOSp3n/KFfqQz5vbpVuAD38ER/J6Jlh69W99CVBBA2eH+JFZ t7LhBKagCDSeHolBooLpwsazg4eM9mDQ2dMDsG8xH12wdMrNJZ2GWwWE7uwqaJS4VUyP nFIser92EcujVnF9bBeeyO9ssdFMHsoTmcL5/uV4+XVDk5dytBjWtySUj852We8RFsfi X+QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=HAAzXp0+M1aKh6Z/sgAp7fo9UiNGRNtuM1dXeeGBY3E=; fh=0DdKI3uRySxQzlTRy49d6VQh77umZfyWRaD7hOgQCS0=; b=d90X969mQQ6e1i345ky4SjkubohAWGTXYmHtqzfB2TEjPCmSZspI2Htf6qAjlUWn6S 4l/Psqo6vUf2+A8OdQdIn6Mx4qHJ7DXtUVF8AFVIUJS0rqsFot/E8+fxB5IhTDCYeDke 1hOaAOZmaavyoj8HQjJYKrvhVaMwDBYzTxkXcO62eHs4so8i0X0L1GWpeeXxLM4NqPTI AA+D278U+XF9gl4CHsDWnjE4lQ1ZTKDE8nS2LoWu/rrJ9x7h7RLmyGDAUmFnbrkvsRkW iarysZ2QNoRryJD03tLiA+/Tw7CuEOj0FfilguKMr9syx60WPTb+B1B3Ai6G8TWwj+Zl yTmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=UJzTeD3O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a170906040c00b00992ac8614b7si1648957eja.69.2023.07.18.15.18.30; Tue, 18 Jul 2023 15:18:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=UJzTeD3O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231417AbjGRWFq (ORCPT + 99 others); Tue, 18 Jul 2023 18:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbjGRWFk (ORCPT ); Tue, 18 Jul 2023 18:05:40 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C706E19AD; Tue, 18 Jul 2023 15:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1689717869; bh=Ep1Rg7y74qHacqZZsLEFQcfo3UPaVM/TmmdadAIahJk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UJzTeD3OsequcHeWcbggbUKDuNcPttt8OuZ3CwItIwHPs71doCPcqOIaUTIfC6Yoq LL2JpWcIRfuoazUISOFJ9W8tI1iwWWKY1gSXZ/GqQNdQx4GYmEIMqNMelPkRKR3l6Z fK82Q7OE/yMklMUbDI4tgi86NofiTwS60YGLZ8qc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Wed, 19 Jul 2023 00:00:39 +0200 Subject: [PATCH RFC 1/7] selftests/nolibc: statically calculate number of testsuites MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230719-nolibc-ktap-tmp-v1-1-930bd0c52ff1@weissschuh.net> References: <20230719-nolibc-ktap-tmp-v1-0-930bd0c52ff1@weissschuh.net> In-Reply-To: <20230719-nolibc-ktap-tmp-v1-0-930bd0c52ff1@weissschuh.net> To: Willy Tarreau Cc: Zhangjin Wu , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1689717869; l=1791; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Ep1Rg7y74qHacqZZsLEFQcfo3UPaVM/TmmdadAIahJk=; b=79r3iwydv7BrzBJ8xeBIw44ZpL3k0y40bdLfhfvYVY+oBgQRzCaqFx3T1ppjjEgqqGDlwwn8x dSJ99c4HJvQBBm/b+h0QAYqtQeAAm1qZAvGu+olghIfWsyCDiAuaIW/ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes it slightly nicer to report the number of suites. Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 03b1d30f5507..698af242d3e4 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -45,6 +45,8 @@ #define SINT_MAX_OF_TYPE(type) (((type)1 << (sizeof(type) * 8 - 2)) - (type)1 + ((type)1 << (sizeof(type) * 8 - 2))) #define SINT_MIN_OF_TYPE(type) (-SINT_MAX_OF_TYPE(type) - 1) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) + /* will be used to test initialization of environ */ static char **test_envp; @@ -1184,7 +1186,6 @@ static const struct test test_names[] = { { .name = "stdlib", .func = run_stdlib }, { .name = "vfprintf", .func = run_vfprintf }, { .name = "protection", .func = run_protection }, - { 0 } }; int is_setting_valid(char *test) @@ -1259,7 +1260,7 @@ int main(int argc, char **argv, char **envp) if (colon) *(colon++) = '\0'; - for (idx = 0; test_names[idx].name; idx++) { + for (idx = 0; idx < ARRAY_SIZE(test_names); idx++) { if (strcmp(test, test_names[idx].name) == 0) break; } @@ -1305,7 +1306,7 @@ int main(int argc, char **argv, char **envp) } while (test && *test); } else { /* no test mentioned, run everything */ - for (idx = 0; test_names[idx].name; idx++) { + for (idx = 0; idx < ARRAY_SIZE(test_names); idx++) { printf("Running test '%s'\n", test_names[idx].name); err = test_names[idx].func(min, max); ret += err; -- 2.41.0