From patchwork Thu Apr 11 23:19:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13626609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B724C4345F for ; Thu, 11 Apr 2024 23:20:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68DCB6B007B; Thu, 11 Apr 2024 19:20:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 617076B0082; Thu, 11 Apr 2024 19:20:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4906D6B0083; Thu, 11 Apr 2024 19:20:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 280136B007B for ; Thu, 11 Apr 2024 19:20:01 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E32DF1C06A8 for ; Thu, 11 Apr 2024 23:20:00 +0000 (UTC) X-FDA: 81998820960.12.7C8236D Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf30.hostedemail.com (Postfix) with ESMTP id 3B02E8001A for ; Thu, 11 Apr 2024 23:19:59 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Rx2lt7RI; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3HXAYZgYKCJY43B80M6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--edliaw.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3HXAYZgYKCJY43B80M6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--edliaw.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712877599; a=rsa-sha256; cv=none; b=NLqT/Qr3FNH9Jqh/lqvy05CJtiKfxFZBAOA4fz98cDnxsc5SfUOKOAcUTM590dXFaljnZ2 ya4UiChOV0Bvp0DAfTBKfP6tsWNZgdwwFc2i75l73KBPmbhZpu1LlcU6w1T0MGJins3j5d U7Bb6LLWygBZsob+9qmXkl0ICb3ryUk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Rx2lt7RI; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3HXAYZgYKCJY43B80M6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--edliaw.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3HXAYZgYKCJY43B80M6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--edliaw.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712877599; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=5zpMelPR/Q05P4yZbANW3smZq3nLKCEwEnHHYOEX7BY=; b=XHkoqCKTrIkeZaxbEsF01+iE5yycp+dBiw+6hyCV9Cb6Okbl/iltwuSmOJyZUBNC8tPfhB A7s80JqXziipb9dCfUhetj19gGC0zIIJbD/u1D1ZOl+IHOOzanuCsnM8aRawjrzH0XAH9j S9HBBuda0haUfPp3GyRBLF+bHmh1j1A= Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-6ed25eb26d6so303846b3a.0 for ; Thu, 11 Apr 2024 16:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712877598; x=1713482398; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5zpMelPR/Q05P4yZbANW3smZq3nLKCEwEnHHYOEX7BY=; b=Rx2lt7RIVacXjgyYA3XKH8DIuMinUkw9phYrzKuvIDwZpYq+0NpJw0NQY0e0W1+RPo rt0YvF/baWD9u9yqs36gHFbbYko3IsS4bs61qLFnCiLXxrFJLv2o5bYGQSz4MN9pgilJ e0fSqIkJQAzolMtG6o2Hbm8wkBcmY1p09Yu0usDZj+UXf7jZ+5AHCI540NygT4xKz2T0 1ngvhPIeP/4/aqob+oi3sVb7LL/D8dClf3RHlcH3P4XL8NOihFRXzLtjEPSX2OJ6uoIS rwDoqgLZxz9+0ZsSUxFUei/2nFvqMS30M4doUyX8FUfhwe+PhU0OOlzmyE/3hgfE487O Oj9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712877598; x=1713482398; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5zpMelPR/Q05P4yZbANW3smZq3nLKCEwEnHHYOEX7BY=; b=DIt+90PI46BBV8lrldY4EG36FWhR27EuVtcyLP7gj0Xsv/X5ye1YKJvRoeOaSaLzQG Y639d8c93vMIlP/gdudSJ6pg2QHQdthHzrVFbJuHaLpyN+J2/lfiV0XJfxw39ch4TO0q gIvX/iC38hgsC+F1KiAU40+ULT5p+9lqUgw5yxQNpQxb6KrKwF5NSFqvTc9IdmC0PfyU f50qM+wAL1xMfHOE/OcV8GXPfwt6SPH4TZDTjFZFzYCVjByxTWlj45OgsUSheR8Kl0Sv IHFtAhFdO4iq9yz3jULQLnBMOqVmMsurL75WVdw7/ooBdFFvfHBHF6ZfyuKt0L52YYQF XzQw== X-Forwarded-Encrypted: i=1; AJvYcCUBuYvPXOpIx79TvnpleXg5o9X589U37VjTmUWwgVNWVuq9tCXAiDYqYRP9lA0Mn+XB+fIEO/UK0GoOrUpZrNdzy24= X-Gm-Message-State: AOJu0YzyT+Im3fW2bHXrIOF4ZFMc7mAxzyULDLahYNs7K3Dh3kiMZOTM eAY9fIv1aBjqxmjJ13NvultoYNjeAwJzal8Omg9IETBJcHU1ptOcLqDcg9/6Cr0ntaVaCvpiHUx 0wg== X-Google-Smtp-Source: AGHT+IFLfDrP1amVJB3d3HaxnBLnZmZqMjR5reHrOoeYxEPUItc4VJwMrhhWU2YhVGvypmJmcL1x4zlOcQA= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a05:6a00:a16:b0:6ea:8a0d:185f with SMTP id p22-20020a056a000a1600b006ea8a0d185fmr70673pfh.2.1712877597805; Thu, 11 Apr 2024 16:19:57 -0700 (PDT) Date: Thu, 11 Apr 2024 23:19:49 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.683.g7961c838ac-goog Message-ID: <20240411231954.62156-1-edliaw@google.com> Subject: [PATCH] selftests/harness: remove use of LINE_MAX From: Edward Liaw To: linux-kernel@vger.kernel.org, Kees Cook , Andy Lutomirski , Will Drewry , Shuah Khan , Andrew Morton , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Peter Xu , David Hildenbrand , Axel Rasmussen , "Mike Rapoport (IBM)" Cc: linux-kselftest@vger.kernel.org, kernel-team@android.com, Edward Liaw , linux-mm@kvack.org, llvm@lists.linux.dev X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3B02E8001A X-Stat-Signature: yn1dtqmr7y81x461rihkp4n93jcaow3y X-HE-Tag: 1712877599-331480 X-HE-Meta: U2FsdGVkX18a1bnD1mZMzFSbJ2bCacY+odmATa+PUJqxcKSexU9fDNxOoVfuAPQyPOgjw1A2HKyDRTZUmd36kGvV4Xw1ijyR9bQa6XHpFakee1vsb6I4AYaOjILItH4qYaVbwZQ5vUOnlv1ESL5UaKPw0vKU/SkKE9vG55z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4YTPVkba8uV0w53ssj1HZdar3dKB8ml35lAMtDvJJ0OL7B40y29l536z9PP3nXOiccnuR1/TkDsOHoshyecJ7u8nKvYpxDQSBAIABD4xt+yvoe4PRHQnHm5opJMmUvJ9BvTgM+zTN1ntahEXlAMdw93J+9DZ/2UILhRwYbrYU3EAi6X2FxWfRpHLbHWGjjJ1DMZBTX4VaZGCBeJhAHRdYYfzgEklMkPRxm9JHR3BeSrCiArviGlVKZf19MH3u1Du1mA4y/LQtokG1WBZGhgC65zvvjYVDaXnXALl4TPpKcc7Jj1lRhvqODetrt8dkAE8cxqOKWozQE6377/mctyj35acT0XRCJwt39UC9M6CR/X2NPzXp0qfDuK38xFtuA3qmkG8NXOCMz74CpHFQr2kCL72d5ffzU3IOGQrohgYgMsaiV05MhAOzyJqNZg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Android was seeing a compliation error because its C library does not define LINE_MAX. This replaces the use of LINE_MAX / snprintf with asprintf, which will change the behavior to not truncate the test name if it is over 2048 chars long. See also: https://github.com/llvm/llvm-project/issues/88119 Signed-off-by: Edward Liaw --- tools/testing/selftests/kselftest_harness.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index 4fd735e48ee7..70fedd2411ed 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -1156,7 +1156,7 @@ void __run_test(struct __fixture_metadata *f, struct __test_metadata *t) { struct __test_xfail *xfail; - char test_name[LINE_MAX]; + char *test_name; const char *diagnostic; /* reset test struct */ @@ -1164,8 +1164,8 @@ void __run_test(struct __fixture_metadata *f, t->trigger = 0; memset(t->results->reason, 0, sizeof(t->results->reason)); - snprintf(test_name, sizeof(test_name), "%s%s%s.%s", - f->name, variant->name[0] ? "." : "", variant->name, t->name); + asprintf(&test_name, "%s%s%s.%s", f->name, + variant->name[0] ? "." : "", variant->name, t->name); ksft_print_msg(" RUN %s ...\n", test_name); @@ -1203,6 +1203,7 @@ void __run_test(struct __fixture_metadata *f, ksft_test_result_code(t->exit_code, test_name, diagnostic ? "%s" : "", diagnostic); + free(test_name); } static int test_harness_run(int argc, char **argv)