From nobody Sun Feb 8 11:25:53 2026 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 815B021CC71 for ; Mon, 12 Jan 2026 04:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768191255; cv=none; b=oYqBWhDZ9aWiGze2sJil/yl37RbNHtQSrraphMkG7oImhkn5vCMjJypUyLgB7bMS3Tg0nEPMuq3gVR6PDOlZnJDmpvsOIT4Jc3oxoZG6Kz2+QQfbsefWFz38XspttjIH1WyZ4ZOHKBhbVI+Qvz4XV7h2k/Tl6p7GZGYxw45q71E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768191255; c=relaxed/simple; bh=zEZ4FJ91wM5SW6mtBv+cwt0syhCWtJG/ZFQoV/5vuKM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J1PioJ+ctWwuvop6dXQ8tdIgfvnOB17j55MkGFdUVsTBtIUChUULLkpMDcPe51a/+N2XAGl3UmXMGX3CWhnHJc2vG6zKfKCQwJmyNpMxTBnqRDy93d62GuCVLKnn416n7MwFTzErDVimj/3biuNPdVkGgDRf394PQmHjyz3M69Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aPuwW9ni; arc=none smtp.client-ip=209.85.210.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aPuwW9ni" Received: by mail-pf1-f193.google.com with SMTP id d2e1a72fcca58-81f4e36512aso845031b3a.3 for ; Sun, 11 Jan 2026 20:14:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768191254; x=1768796054; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kXUxwFIq7nIMAiSrPnHffaEFsbuxmM0yUEysHSd0Tjw=; b=aPuwW9ni2A9FSX0RLudh8RlTeU9lBgfjdqhRhDhYk7Y8o44TKGyzBULo93TJE8z3kC PN0u02tjkdq9GRGrvTqNCTy4yOIsHMdO5zmmTSr4THa5pM1LHBbgaMblDy8eZZCT/Td6 pkSMFWBUZNOkatd5zUfDiXetCYE4ps0X9VAJQLRVpkm/wvmt/vU4+IRyUE7JHGq8FYJY 9y9A67dekRF6CkeH0Ieqww+amgLykuvjC8jt7wALltqPJVFUmI8AMjhleFREgyJMo9Wi jOpRZwuQCp0qWOggLcUh+mq7usYwVdz7fB3IZR8kOKKG18prpg9+qnVF0UKofhVGlmiv wnZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768191254; x=1768796054; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kXUxwFIq7nIMAiSrPnHffaEFsbuxmM0yUEysHSd0Tjw=; b=iVMRVgNC7zF8KSflFRVpKXLJT//xnEnhfP2TQKDFppdMqrU8pKwzL02UICgEv1/6q8 SXcXziqJ38DUqJi7kH67suFyz0p04I2o/vikE8xQD0UgrJPcYdUKF9Pq0ir7K+wplVrl Sjj5GotdxJg2ZOrFr8yRdaT7cFmS/J76MDBLLK51u7B7eczQbaYayOtqTWPa2gdIFx8V qrAJH9AswaxzdXP2fyE368cDuL0uYD4Wfnv6GtqymMiVmEfB0ZDsRUIiZFqQF2lEKxak Lgyyo7ghOIMn3gB/zNq4MXYIgvqQLw47yFFmkxjHnXjzpTTW1CZ9kRgxXV887AaT9u+4 R0LA== X-Forwarded-Encrypted: i=1; AJvYcCVh84swW9rs/rugq7u49obQ15gmE04xmnUjdlrmx3LUTcZ9TFovznwNcK15MBD7uJhROMgNL6FiUtaPC4g=@vger.kernel.org X-Gm-Message-State: AOJu0YwA1JpmO1E8w3yQLIJP0FHNVNBrGVSSt4Y2lfGcoshwTUt6Ox4h QQRHNvt8PvBSVtISystwXwzDrGjQfw3JXP+shpxzyjLp5r0a1VnG8M4= X-Gm-Gg: AY/fxX4lTnh24+yeD7oe72k/KPpC3uJaDM+R0syjY7X2+kxdLOKgaRE1xukAhinwgtA mlthJIdjWafvMiiKAu6S9fnqGPgfWZEp8IqWg+1LCEMyJFvHzbmvZJdc1I5fsFaBdtzxuJIeVQZ /2qpCvOlG3SYvec0BC7Jm7HT6FRzan4TA0JTWlNd8ji0vXAOJz1XsDnKdis5qxz/dc3IfPdCnFU sgCmOyHQPrf/HmXWNWt8YMtmoGBsU3M+LA2HaSAoR9aJ4dKCFTWW0sNuW6OYpxekXc23rIEFZ49 pp0AiV3tWXzuAlv8FKwXtgN2i5UbUD03d7G6VxylQjrJug7x7myPrRSE8MMK+4TY8UYCITCj4I6 Ft/2WNGct7srYtCA60RbbPfRwfk6oXcn29lMMgdSpNHMF6S+o1/ug0fjO9a7mDFMRAmj45XrZmd dY0kzIQbKx2yWNNS5DB/rXmVUGy9Xdeb2Z7O0x5QBN X-Google-Smtp-Source: AGHT+IFR2xRoN/aXN1qsDiZrft89+zKTzqGmIr0wW7Zg2bDoZGYSZ2ApSgKw7F11Pg6dEuplZHQW+A== X-Received: by 2002:a05:6a00:6c9d:b0:81f:3a83:9756 with SMTP id d2e1a72fcca58-81f3a839ee5mr5674290b3a.30.1768191253833; Sun, 11 Jan 2026 20:14:13 -0800 (PST) Received: from localhost.localdomain ([38.190.47.140]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-81c96d762f8sm10901231b3a.64.2026.01.11.20.14.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jan 2026 20:14:13 -0800 (PST) From: Jinseok Kim To: brendan.higgins@linux.dev, davidgow@google.com Cc: raemoar63@gmail.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Jinseok Kim Subject: [PATCH] kunit: tool: suppress confusing error output in test Date: Sun, 11 Jan 2026 20:13:22 -0800 Message-ID: <20260112041322.2168-1-always.starving0@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When running kunit_tool_test.py, the test_run_raw_output_invalid test prints invalid usage text and error messages to stderr. This happens becaus= e the test triggers kunit.main() with an invalid argument, causing argparse to print the usage and exit. This output is confusing to the user because it looks like a test failure or usage error, even though the test passed successfully. Furthermore, argparse displays 'usage: kunit_tool_test.py run ...', which is misleading since the test script itself does not accept the 'run' command. This patch mocks sys.stderr in the test to suppress this expected error output, making the test execution output cleaner. Signed-off-by: Jinseok Kim Reviewed-by: David Gow --- tools/testing/kunit/kunit_tool_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/k= unit_tool_test.py index bbba921e0eac..7a8ba8e4f1d4 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -8,6 +8,7 @@ import unittest from unittest import mock +import io import tempfile, shutil # Handling test_tmpdir @@ -688,8 +689,9 @@ class KUnitMainTest(unittest.TestCase): def test_run_raw_output_invalid(self): self.linux_source_mock.run_kernel =3D mock.Mock(return_value=3D[]) - with self.assertRaises(SystemExit) as e: - kunit.main(['run', '--raw_output=3Dinvalid']) + with mock.patch('sys.stderr', new=3Dio.StringIO()): + with self.assertRaises(SystemExit) as e: + kunit.main(['run', '--raw_output=3Dinvalid']) self.assertNotEqual(e.exception.code, 0) def test_run_raw_output_does_not_take_positional_args(self): -- 2.43.0