Message ID | 20230501181610.2617032-1-dlatypov@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp106467vqo; Mon, 1 May 2023 11:23:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KKKdHiuAGP3H3D8WpVL/N+h79AC+K0U8O76RoG8/Wvp4fa3wJ43w87ITipDZAM4YaIeGH X-Received: by 2002:a05:6a00:984:b0:63d:2f13:1f3 with SMTP id u4-20020a056a00098400b0063d2f1301f3mr22422839pfg.33.1682965412826; Mon, 01 May 2023 11:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682965412; cv=none; d=google.com; s=arc-20160816; b=FFJM1AJckyT8Qr7L33B877G8MY0h/kl0tgI3JwTR1KJFirJdf7EBvI2BqsSuwDt3xQ Jp6eY6fAwylO49v5qjQGryg3TunaeSFw+N5ggnmDzlv5zupUcxq8WOIb1ZX7Z2F9lN+l uP3QN4a3VvA5oF3wIbGx25NLhq59EggXrSMlvJ7jJYOr9g4irkueSM/zNev2mEvegs5Z FoJjdq8TEw16UQPPSak8cFoF5sYAHq//Vq04BGOuEp8Z/svrHgUTpKUs71o1wiujTPvE uutz6AzYY9gEQJjMY8zJTj6K6cDx9eWSuX8o7yu6aPaPMKF6StbnhMrhiZFgtMnuqvDE 9cnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=cTDCHDt1fJfJYcxlD44zwYcY/Rj9XwKQhtn/YVRrmp8=; b=lAIRkyQvri9CfpCgvmLmY4t1I80kaXqmFHe1mEvdni8+k28zkFf6hwQU7+XYuPxNwH jlareDlvkxFXXV/PkS/VPP5C74fT3NDrfev3PDdABVWsozxxyKEPvOMqqQK8AAwFzzIz QTfHX8S08yv3WITv2yIod+aM8E3M9F285rtksoM3wmzUOZaMCkLI3JInsubASNq5AbfT GUiRjYy0pT2tVLBHDXXW3WflhC67Nt1ApWdqVFSVp1qdA5AdWkw/PZr2aFpfwWYUtF3s WzD+rwgWkZ6XP3MlG1B3QQidOmrCUA6iWVixDQUwr4l0fqCImlu6iYfAsr+UNiLk2b0H uHBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Q4NwHl8E; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020aa79e81000000b005a908acf446si28718616pfq.104.2023.05.01.11.23.19; Mon, 01 May 2023 11:23:32 -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=@google.com header.s=20221208 header.b=Q4NwHl8E; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbjEASQ0 (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Mon, 1 May 2023 14:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjEASQZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 1 May 2023 14:16:25 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0300E1726 for <linux-kernel@vger.kernel.org>; Mon, 1 May 2023 11:16:24 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-24e205905d4so160246a91.0 for <linux-kernel@vger.kernel.org>; Mon, 01 May 2023 11:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1682964983; x=1685556983; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=cTDCHDt1fJfJYcxlD44zwYcY/Rj9XwKQhtn/YVRrmp8=; b=Q4NwHl8ELgu+CuHSTm7rZOpj3G8dviomnxGEfuFBa1UQKO8PSd5tDzYzI8T9MWxmY3 lQAnl451Gu+4BiAhZ3d0QeHcmrO5/GzQEa44522lgvpUzLFBdc7uAsFWXO3/oj3FEU7n CVuFog1n/l4MarxjDjp3jLP7ciXJX9V358SF9QquYOt0ZfHQ7uEq4EToiUnz1d4eEcV4 ouFHh7cP3o5BfTEZAEgh3pRnDLyLSaTaYp2droGOyfV58T1i1XJoy3aQJNO3YHIy4ZFy /3gWh07x7xVZKvMmMPhlkzI1qtJ/aRIEneLaR7S5+ZXsMov0kTiNFeORvLOVDtUNvun5 m/cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682964983; x=1685556983; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cTDCHDt1fJfJYcxlD44zwYcY/Rj9XwKQhtn/YVRrmp8=; b=Xj/nje0eodjHcUevyiHfzZTx62FSCFgPEkpdhau87rKVFrw1IA/QxyHYUSxl6GVxzD 88qhGd6pgmxfEnuRPZKh1+sw2aZiQM6yk5G2MFcw+O3Tqn0qe57gvR3SEmdlBe/7iQwg kcUa3gQdhRIFk/kQ0+6M68QAV8lU768/MqLb1RRoG8sX2qHcbrh/ORwQhYs8Wx71J3Si IxMq4W0TExD55gAASM2o8mrpqzfSAxjEXiXoBeS66DkV3Fjmvubmv31LRHJDBbETkrRP NcsBQljNU9dbdAj3dXLQ5/zDxKKpEit9A7XuUik+CRhLyyfQqm/xwYOBk3nZtvAhgEV1 t+QA== X-Gm-Message-State: AC+VfDymVOVBVtv9O58AtOo+aHqSuS9oW3BZ/0UOvY5vfoJfgBInjzYc EthFo0PhUHhEldnBkqb3ICXSFU8DzwrPYw== X-Received: from dlatypov-spec.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3f35]) (user=dlatypov job=sendgmr) by 2002:a17:90a:644a:b0:24e:1915:5ba3 with SMTP id y10-20020a17090a644a00b0024e19155ba3mr374293pjm.5.1682964983512; Mon, 01 May 2023 11:16:23 -0700 (PDT) Date: Mon, 1 May 2023 11:16:10 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.1.495.gc816e09b53d-goog Message-ID: <20230501181610.2617032-1-dlatypov@google.com> Subject: [PATCH] kunit: tool: undo type subscripts for subprocess.Popen From: Daniel Latypov <dlatypov@google.com> To: brendanhiggins@google.com, davidgow@google.com Cc: rmoar@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, johannes@sipsolutions.net, Daniel Latypov <dlatypov@google.com>, SeongJae Park <sj@kernel.org> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764717140642711820?= X-GMAIL-MSGID: =?utf-8?q?1764717140642711820?= |
Series |
kunit: tool: undo type subscripts for subprocess.Popen
|
|
Commit Message
Daniel Latypov
May 1, 2023, 6:16 p.m. UTC
Writing `subprocess.Popen[str]` requires python 3.9+. kunit.py has an assertion that the python version is 3.7+, so we should try to stay backwards compatible. This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix pre-existing `mypy --strict` errors and update run_checks.py"), since mypy complains like so > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] Note: `mypy --strict --python-version 3.7` does not work. We could annotate each file with comments like `# mypy: disable-error-code="type-arg" but then we might still get nudged to break back-compat in other files. This patch adds a `mypy.ini` file since it seems like the only way to disable specific error codes for all our files. Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, but I think being explicit is better, particularly since most kernel devs won't be familiar with how mypy works. Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") Reported-by: SeongJae Park <sj@kernel.org> Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org Signed-off-by: Daniel Latypov <dlatypov@google.com> --- tools/testing/kunit/kunit_kernel.py | 6 +++--- tools/testing/kunit/mypy.ini | 6 ++++++ tools/testing/kunit/run_checks.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 tools/testing/kunit/mypy.ini base-commit: a42077b787680cbc365a96446b30f32399fa3f6f
Comments
On Mon, 1 May 2023 11:16:10 -0700 Daniel Latypov <dlatypov@google.com> wrote: > Writing `subprocess.Popen[str]` requires python 3.9+. > kunit.py has an assertion that the python version is 3.7+, so we should > try to stay backwards compatible. > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > pre-existing `mypy --strict` errors and update run_checks.py"), since > mypy complains like so > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > Note: `mypy --strict --python-version 3.7` does not work. > > We could annotate each file with comments like > `# mypy: disable-error-code="type-arg" > but then we might still get nudged to break back-compat in other files. > > This patch adds a `mypy.ini` file since it seems like the only way to > disable specific error codes for all our files. > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > but I think being explicit is better, particularly since most kernel > devs won't be familiar with how mypy works. Thank you for fast fix! > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > Reported-by: SeongJae Park <sj@kernel.org> > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > Signed-off-by: Daniel Latypov <dlatypov@google.com> Tested-by: SeongJae Park <sj@kernel.org> Thanks, SJ [...]
On Tue, 2 May 2023 at 02:16, 'Daniel Latypov' via KUnit Development <kunit-dev@googlegroups.com> wrote: > > Writing `subprocess.Popen[str]` requires python 3.9+. > kunit.py has an assertion that the python version is 3.7+, so we should > try to stay backwards compatible. > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > pre-existing `mypy --strict` errors and update run_checks.py"), since > mypy complains like so > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > Note: `mypy --strict --python-version 3.7` does not work. > > We could annotate each file with comments like > `# mypy: disable-error-code="type-arg" > but then we might still get nudged to break back-compat in other files. > > This patch adds a `mypy.ini` file since it seems like the only way to > disable specific error codes for all our files. > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > but I think being explicit is better, particularly since most kernel > devs won't be familiar with how mypy works. > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > Reported-by: SeongJae Park <sj@kernel.org> > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > Signed-off-by: Daniel Latypov <dlatypov@google.com> > --- Thanks for jumping on this. Looks good to me! Reviewed-by: David Gow <davidgow@google.com> Cheers, -- David
Hi David and Brendan, On Tue, 2 May 2023 08:04:20 +0800 David Gow <davidgow@google.com> wrote: > [-- Attachment #1: Type: text/plain, Size: 1473 bytes --] > > On Tue, 2 May 2023 at 02:16, 'Daniel Latypov' via KUnit Development > <kunit-dev@googlegroups.com> wrote: > > > > Writing `subprocess.Popen[str]` requires python 3.9+. > > kunit.py has an assertion that the python version is 3.7+, so we should > > try to stay backwards compatible. > > > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > > pre-existing `mypy --strict` errors and update run_checks.py"), since > > mypy complains like so > > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > > > Note: `mypy --strict --python-version 3.7` does not work. > > > > We could annotate each file with comments like > > `# mypy: disable-error-code="type-arg" > > but then we might still get nudged to break back-compat in other files. > > > > This patch adds a `mypy.ini` file since it seems like the only way to > > disable specific error codes for all our files. > > > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > > but I think being explicit is better, particularly since most kernel > > devs won't be familiar with how mypy works. > > > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > > Reported-by: SeongJae Park <sj@kernel.org> > > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > > Signed-off-by: Daniel Latypov <dlatypov@google.com> > > --- > > Thanks for jumping on this. > > Looks good to me! > > Reviewed-by: David Gow <davidgow@google.com> Looks like this patch is still not merged in the mainline. May I ask the ETA, or any concern if you have? Thanks, SJ > > Cheers, > -- David
On Sat, 10 Jun 2023 at 03:09, SeongJae Park <sj@kernel.org> wrote: > > Hi David and Brendan, > > On Tue, 2 May 2023 08:04:20 +0800 David Gow <davidgow@google.com> wrote: > > > [-- Attachment #1: Type: text/plain, Size: 1473 bytes --] > > > > On Tue, 2 May 2023 at 02:16, 'Daniel Latypov' via KUnit Development > > <kunit-dev@googlegroups.com> wrote: > > > > > > Writing `subprocess.Popen[str]` requires python 3.9+. > > > kunit.py has an assertion that the python version is 3.7+, so we should > > > try to stay backwards compatible. > > > > > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > > > pre-existing `mypy --strict` errors and update run_checks.py"), since > > > mypy complains like so > > > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > > > > > Note: `mypy --strict --python-version 3.7` does not work. > > > > > > We could annotate each file with comments like > > > `# mypy: disable-error-code="type-arg" > > > but then we might still get nudged to break back-compat in other files. > > > > > > This patch adds a `mypy.ini` file since it seems like the only way to > > > disable specific error codes for all our files. > > > > > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > > > but I think being explicit is better, particularly since most kernel > > > devs won't be familiar with how mypy works. > > > > > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > > > Reported-by: SeongJae Park <sj@kernel.org> > > > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > > > Signed-off-by: Daniel Latypov <dlatypov@google.com> > > > --- > > > > Thanks for jumping on this. > > > > Looks good to me! > > > > Reviewed-by: David Gow <davidgow@google.com> > > Looks like this patch is still not merged in the mainline. May I ask the ETA, > or any concern if you have? > > We've got this queued for 6.5 in the kselftest/kunit tree[1], so it should land during the merge window. But I'll look into getting it applied as a fix for 6.4, beforehand. -- David [1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit&id=e30f65c4b3d671115bf2a9d9ef142285387f2aff
On Sat, 10 Jun 2023 12:15:55 +0800 David Gow <davidgow@google.com> wrote: > [-- Attachment #1: Type: text/plain, Size: 2275 bytes --] > > On Sat, 10 Jun 2023 at 03:09, SeongJae Park <sj@kernel.org> wrote: > > > > Hi David and Brendan, > > > > On Tue, 2 May 2023 08:04:20 +0800 David Gow <davidgow@google.com> wrote: > > > > > [-- Attachment #1: Type: text/plain, Size: 1473 bytes --] > > > > > > On Tue, 2 May 2023 at 02:16, 'Daniel Latypov' via KUnit Development > > > <kunit-dev@googlegroups.com> wrote: > > > > > > > > Writing `subprocess.Popen[str]` requires python 3.9+. > > > > kunit.py has an assertion that the python version is 3.7+, so we should > > > > try to stay backwards compatible. > > > > > > > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > > > > pre-existing `mypy --strict` errors and update run_checks.py"), since > > > > mypy complains like so > > > > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > > > > > > > Note: `mypy --strict --python-version 3.7` does not work. > > > > > > > > We could annotate each file with comments like > > > > `# mypy: disable-error-code="type-arg" > > > > but then we might still get nudged to break back-compat in other files. > > > > > > > > This patch adds a `mypy.ini` file since it seems like the only way to > > > > disable specific error codes for all our files. > > > > > > > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > > > > but I think being explicit is better, particularly since most kernel > > > > devs won't be familiar with how mypy works. > > > > > > > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > > > > Reported-by: SeongJae Park <sj@kernel.org> > > > > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > > > > Signed-off-by: Daniel Latypov <dlatypov@google.com> > > > > --- > > > > > > Thanks for jumping on this. > > > > > > Looks good to me! > > > > > > Reviewed-by: David Gow <davidgow@google.com> > > > > Looks like this patch is still not merged in the mainline. May I ask the ETA, > > or any concern if you have? > > > > > > We've got this queued for 6.5 in the kselftest/kunit tree[1], so it > should land during the merge window. But I'll look into getting it > applied as a fix for 6.4, beforehand. Thank you for the kind answer, Gow! I was thinking this would be treated as a fix, and hence merged into the mainline before next merge window. I'm actually getting my personal test suite failures due to absence of this fix. It's not a critical problem, but it would definitely better for me if this could be merged into the mainline as early as possible. Thanks, SJ > > -- David > > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit&id=e30f65c4b3d671115bf2a9d9ef142285387f2aff
Hi Greg and Sasha, On Sat, 10 Jun 2023 17:56:18 +0000 SeongJae Park <sj@kernel.org> wrote: > On Sat, 10 Jun 2023 12:15:55 +0800 David Gow <davidgow@google.com> wrote: > > > [-- Attachment #1: Type: text/plain, Size: 2275 bytes --] > > > > On Sat, 10 Jun 2023 at 03:09, SeongJae Park <sj@kernel.org> wrote: > > > > > > Hi David and Brendan, > > > > > > On Tue, 2 May 2023 08:04:20 +0800 David Gow <davidgow@google.com> wrote: > > > > > > > [-- Attachment #1: Type: text/plain, Size: 1473 bytes --] > > > > > > > > On Tue, 2 May 2023 at 02:16, 'Daniel Latypov' via KUnit Development > > > > <kunit-dev@googlegroups.com> wrote: > > > > > > > > > > Writing `subprocess.Popen[str]` requires python 3.9+. > > > > > kunit.py has an assertion that the python version is 3.7+, so we should > > > > > try to stay backwards compatible. > > > > > > > > > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > > > > > pre-existing `mypy --strict` errors and update run_checks.py"), since > > > > > mypy complains like so > > > > > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > > > > > > > > > Note: `mypy --strict --python-version 3.7` does not work. > > > > > > > > > > We could annotate each file with comments like > > > > > `# mypy: disable-error-code="type-arg" > > > > > but then we might still get nudged to break back-compat in other files. > > > > > > > > > > This patch adds a `mypy.ini` file since it seems like the only way to > > > > > disable specific error codes for all our files. > > > > > > > > > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > > > > > but I think being explicit is better, particularly since most kernel > > > > > devs won't be familiar with how mypy works. > > > > > > > > > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > > > > > Reported-by: SeongJae Park <sj@kernel.org> > > > > > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > > > > > Signed-off-by: Daniel Latypov <dlatypov@google.com> > > > > > --- > > > > > > > > Thanks for jumping on this. > > > > > > > > Looks good to me! > > > > > > > > Reviewed-by: David Gow <davidgow@google.com> > > > > > > Looks like this patch is still not merged in the mainline. May I ask the ETA, > > > or any concern if you have? > > > > > > > > > > We've got this queued for 6.5 in the kselftest/kunit tree[1], so it > > should land during the merge window. But I'll look into getting it > > applied as a fix for 6.4, beforehand. > > Thank you for the kind answer, Gow! I was thinking this would be treated as a > fix, and hence merged into the mainline before next merge window. I'm actually > getting my personal test suite failures due to absence of this fix. It's not a > critical problem, but it would definitely better for me if this could be merged > into the mainline as early as possible. This patch is now in the mainline (e30f65c4b3d671115bf2a9d9ef142285387f2aff). However, this fix is not in 6.4.y yet, so the original issue is reproducible on 6.4.y. Could you please add this to 6.4.y? I confirmed the mainline commit can cleanly applied on latest 6.1.y tree, and it fixes the issue. Thanks, SJ > > > Thanks, > SJ > > > > > -- David > > > > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit&id=e30f65c4b3d671115bf2a9d9ef142285387f2aff
On Mon, Jul 03, 2023 at 07:27:04PM +0000, SeongJae Park wrote: > Hi Greg and Sasha, > > On Sat, 10 Jun 2023 17:56:18 +0000 SeongJae Park <sj@kernel.org> wrote: > > > On Sat, 10 Jun 2023 12:15:55 +0800 David Gow <davidgow@google.com> wrote: > > > > > [-- Attachment #1: Type: text/plain, Size: 2275 bytes --] > > > > > > On Sat, 10 Jun 2023 at 03:09, SeongJae Park <sj@kernel.org> wrote: > > > > > > > > Hi David and Brendan, > > > > > > > > On Tue, 2 May 2023 08:04:20 +0800 David Gow <davidgow@google.com> wrote: > > > > > > > > > [-- Attachment #1: Type: text/plain, Size: 1473 bytes --] > > > > > > > > > > On Tue, 2 May 2023 at 02:16, 'Daniel Latypov' via KUnit Development > > > > > <kunit-dev@googlegroups.com> wrote: > > > > > > > > > > > > Writing `subprocess.Popen[str]` requires python 3.9+. > > > > > > kunit.py has an assertion that the python version is 3.7+, so we should > > > > > > try to stay backwards compatible. > > > > > > > > > > > > This conflicts a bit with commit 1da2e6220e11 ("kunit: tool: fix > > > > > > pre-existing `mypy --strict` errors and update run_checks.py"), since > > > > > > mypy complains like so > > > > > > > kunit_kernel.py:95: error: Missing type parameters for generic type "Popen" [type-arg] > > > > > > > > > > > > Note: `mypy --strict --python-version 3.7` does not work. > > > > > > > > > > > > We could annotate each file with comments like > > > > > > `# mypy: disable-error-code="type-arg" > > > > > > but then we might still get nudged to break back-compat in other files. > > > > > > > > > > > > This patch adds a `mypy.ini` file since it seems like the only way to > > > > > > disable specific error codes for all our files. > > > > > > > > > > > > Note: run_checks.py doesn't need to specify `--config_file mypy.ini`, > > > > > > but I think being explicit is better, particularly since most kernel > > > > > > devs won't be familiar with how mypy works. > > > > > > > > > > > > Fixes: 695e26030858 ("kunit: tool: add subscripts for type annotations where appropriate") > > > > > > Reported-by: SeongJae Park <sj@kernel.org> > > > > > > Link: https://lore.kernel.org/linux-kselftest/20230501171520.138753-1-sj@kernel.org > > > > > > Signed-off-by: Daniel Latypov <dlatypov@google.com> > > > > > > --- > > > > > > > > > > Thanks for jumping on this. > > > > > > > > > > Looks good to me! > > > > > > > > > > Reviewed-by: David Gow <davidgow@google.com> > > > > > > > > Looks like this patch is still not merged in the mainline. May I ask the ETA, > > > > or any concern if you have? > > > > > > > > > > > > > > We've got this queued for 6.5 in the kselftest/kunit tree[1], so it > > > should land during the merge window. But I'll look into getting it > > > applied as a fix for 6.4, beforehand. > > > > Thank you for the kind answer, Gow! I was thinking this would be treated as a > > fix, and hence merged into the mainline before next merge window. I'm actually > > getting my personal test suite failures due to absence of this fix. It's not a > > critical problem, but it would definitely better for me if this could be merged > > into the mainline as early as possible. > > This patch is now in the mainline (e30f65c4b3d671115bf2a9d9ef142285387f2aff). > However, this fix is not in 6.4.y yet, so the original issue is reproducible on > 6.4.y. Could you please add this to 6.4.y? I confirmed the mainline commit > can cleanly applied on latest 6.1.y tree, and it fixes the issue. As this was not specifically tagged with a "cc: stable..." marking, that is why it was not picked up automatically. Also, we do not normally add patches to any stable releases until it is in a released kernel from Linus (i.e. a -rc release), unless you have a specific reason for it to be merged earlier. Should this be merged "now" into the stable trees and not wait for 6.5-rc1? thanks, greg k-h
On Mon, 3 Jul 2023 21:44:53 +0200 Greg KH <gregkh@linuxfoundation.org> wrote: > On Mon, Jul 03, 2023 at 07:27:04PM +0000, SeongJae Park wrote: [...] > > This patch is now in the mainline (e30f65c4b3d671115bf2a9d9ef142285387f2aff). > > However, this fix is not in 6.4.y yet, so the original issue is reproducible on > > 6.4.y. Could you please add this to 6.4.y? I confirmed the mainline commit > > can cleanly applied on latest 6.1.y tree, and it fixes the issue. > > As this was not specifically tagged with a "cc: stable..." marking, that > is why it was not picked up automatically. I understand that. I thought this would be merged into the mainline before v6.4 release, but I was wrong. > Also, we do not normally add patches to any stable releases until it is in a > released kernel from Linus (i.e. a -rc release), unless you have a specific > reason for it to be merged earlier. > > Should this be merged "now" into the stable trees and not wait for > 6.5-rc1? The problem is not urgent, so I can wait until 6.5-rc1. Thanks, SJ > > thanks, > > greg k-h
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index f01f94106129..7f648802caf6 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -92,7 +92,7 @@ class LinuxSourceTreeOperations: if stderr: # likely only due to build warnings print(stderr.decode()) - def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]: + def start(self, params: List[str], build_dir: str) -> subprocess.Popen: raise RuntimeError('not implemented!') @@ -113,7 +113,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): kconfig.merge_in_entries(base_kunitconfig) return kconfig - def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]: + def start(self, params: List[str], build_dir: str) -> subprocess.Popen: kernel_path = os.path.join(build_dir, self._kernel_path) qemu_command = ['qemu-system-' + self._qemu_arch, '-nodefaults', @@ -142,7 +142,7 @@ class LinuxSourceTreeOperationsUml(LinuxSourceTreeOperations): kconfig.merge_in_entries(base_kunitconfig) return kconfig - def start(self, params: List[str], build_dir: str) -> subprocess.Popen[str]: + def start(self, params: List[str], build_dir: str) -> subprocess.Popen: """Runs the Linux UML binary. Must be named 'linux'.""" linux_bin = os.path.join(build_dir, 'linux') params.extend(['mem=1G', 'console=tty', 'kunit_shutdown=halt']) diff --git a/tools/testing/kunit/mypy.ini b/tools/testing/kunit/mypy.ini new file mode 100644 index 000000000000..ddd288309efa --- /dev/null +++ b/tools/testing/kunit/mypy.ini @@ -0,0 +1,6 @@ +[mypy] +strict = True + +# E.g. we can't write subprocess.Popen[str] until Python 3.9+. +# But kunit.py tries to support Python 3.7+, so let's disable it. +disable_error_code = type-arg diff --git a/tools/testing/kunit/run_checks.py b/tools/testing/kunit/run_checks.py index 8208c3b3135e..c6d494ea3373 100755 --- a/tools/testing/kunit/run_checks.py +++ b/tools/testing/kunit/run_checks.py @@ -23,7 +23,7 @@ commands: Dict[str, Sequence[str]] = { 'kunit_tool_test.py': ['./kunit_tool_test.py'], 'kunit smoke test': ['./kunit.py', 'run', '--kunitconfig=lib/kunit', '--build_dir=kunit_run_checks'], 'pytype': ['/bin/sh', '-c', 'pytype *.py'], - 'mypy': ['mypy', '--strict', '--exclude', '_test.py$', '--exclude', 'qemu_configs/', '.'], + 'mypy': ['mypy', '--config-file', 'mypy.ini', '--exclude', '_test.py$', '--exclude', 'qemu_configs/', '.'], } # The user might not have mypy or pytype installed, skip them if so.