Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4389867rwb; Tue, 16 Aug 2022 21:46:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR4//bVxi63YLy8CWTaIrHrth7UztlXnPmBWBa3pL/yHen4KUOUtIiIC3hcxjuwgVFgyPXHw X-Received: by 2002:a05:6a00:2cb:b0:52d:64bc:9a2a with SMTP id b11-20020a056a0002cb00b0052d64bc9a2amr23657131pft.38.1660711608663; Tue, 16 Aug 2022 21:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660711608; cv=none; d=google.com; s=arc-20160816; b=imdiVysw5xbo8k1bjX1Z+a9x0DCJ/cydoaqECk2ennTQCx0gYNYZ9aJChC6amHxK2L zYoX8kdhLvhsow31tQtf5OmlU0Hs89pLLyl2lowiWb0/bo7GYg6vY5pFw7a01PH30auj Gz4ZEF0bWMaRiz7mlmUp32yFYA6YQ3VjlO1PGZ3geth5HPNpTNYq+Iti1NHcMDLtgLGV lOSN9UIV7LK9wtstnwBenscO76xS5cOFOAxV3ZKKJEG6Tm07WNBFCkSySG7CIO+fX10i Yfhf/RH8KiQtu7GVBnwqAUaaoPff6TOYj43Li4JKyWqE/xLjL22TGOUmSfaW0pv3yPVO BSLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=UxCmLPJnsy9sW4BgZWiuWXobqIm0nq94OfYsaOLOldU=; b=exygCXJsULIY0+fFa4zl41U8O0Twb08NibOjqk43AElZqlwaK/Z64szx3leoeRV0wM ipLz4zBllR1dsCXrYReATuTSwwkP4RzBB2PyrWDAvhJ+cPXmHioBgQjB1mBQXRDJ/K2j Yas7cQ6tca0hpMXER3AMO+CxbbYwS3EPSy7XHEtOE1B6URdArR9ByKa7HcAXAzCitL66 T6JYntEdrOaW+aXQOtnfbrMtlHjgvlmTLjfLbePsaeO39beyOoHh3CD8+X5rp+SYRDUR UYYEKEnYIfkKTsiOgSWG7+bwrENpZQl8aiR6kEmy4T3xBWjL6zqGJR8/gnnA/uh8hJdv 8ezQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tfe8pk3j; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a655088000000b0041c4c7690b3si16761644pgp.151.2022.08.16.21.46.36; Tue, 16 Aug 2022 21:46:48 -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=20210112 header.b=tfe8pk3j; 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 S229915AbiHQEnh (ORCPT + 99 others); Wed, 17 Aug 2022 00:43:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbiHQEnf (ORCPT ); Wed, 17 Aug 2022 00:43:35 -0400 Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B8E31147B for ; Tue, 16 Aug 2022 21:43:33 -0700 (PDT) Received: by mail-vs1-xe32.google.com with SMTP id d126so12117089vsd.13 for ; Tue, 16 Aug 2022 21:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=UxCmLPJnsy9sW4BgZWiuWXobqIm0nq94OfYsaOLOldU=; b=tfe8pk3jgg6s5AUs4Z2PqKm6+n5bs5+pGnozkGgkRolavosZDex+zNX2z8SB1bGmcF lvmQ52f5BL6aL5S1XnfbKpNijaM6PkLRxgaHbvsYj/THWM6/eW3HMtVpfsRvLT8CHNSs n3n0xZstV37XBQWy032I+1OH3e7/QUQVBYdXh99NywztQE9InCAX55DHQqKmLw1tRh7a sjBJUmvUSOshiznTKzgdkbStxDypV8uJwjqGl4wIQLOw3OAR/7ERGymcnQpoSgl4c8g5 seYp1o8qS4MnEryV0Ux/j0RwbbPQdZMlbrNmulhTnLjhnJDurhSRE+DYomhGb5K2htRc I7hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=UxCmLPJnsy9sW4BgZWiuWXobqIm0nq94OfYsaOLOldU=; b=fBf1lmpRHvxs12jo/9te/a2n+v8MOcJbTxbG4nPtBtsBHiangGqkc4jMKZ9/+FV8aW vzh8hSA/aZLAzHg+5KTc/fRpAbkxK627Kovix37Ml5SI/QHb4DHAZn62sXlUjWIpxtgv bH9Ska56jB3N/yKdh2lpNKxSoj220wZMHMNZReutGROGSh/y6pkZCm/5yCKsOTE6j+/w Dfhtyl1hQGmQffw5uwrrfpGDDPh/k02OYQZXm7A5DnlMzdrbH5sQpcmIUoIs7C2RPfgY pQT/C8FvBB/CyNT57yB5NUcGGujLvSHV6tH8EgBahj4oGEXcn5GqXgV3n3C5JRa2hGLT Embg== X-Gm-Message-State: ACgBeo09kAVKaQZ6dlREStkQ0wgGV5XdxUOawC3Q6wqJmPHGlnyCTvfX Qs5PGJCkdXimZ6+vnNR3HoJodJj7JpgvQ77VC5oDNg== X-Received: by 2002:a67:c198:0:b0:383:b020:f7c4 with SMTP id h24-20020a67c198000000b00383b020f7c4mr10129732vsj.71.1660711411110; Tue, 16 Aug 2022 21:43:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Gow Date: Wed, 17 Aug 2022 12:43:19 +0800 Message-ID: Subject: Re: Running kunit tests on platform devices To: Ramon Fried Cc: Brendan Higgins , "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , LKML Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000c08cb705e6688129" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_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: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000c08cb705e6688129 Content-Type: text/plain; charset="UTF-8" On Mon, Aug 15, 2022 at 5:16 PM Ramon Fried wrote: > > Hi. > I implemented a test suite that checks a platform driver, that's the > only way I can test interrupts behavior in the code. > Because it's a platform, I can't use kunit_test_suite(), so I call > __kunit_test_suites_init() as part of the platform driver probe > function. > > This works fine but has the following problems. > "TAP version 14" string is not printed and it's impossible to parse > the results using the script. > In addition, the suite is not displayed in /sys/kernel/debug/kunit. > > It would be my pleasure to provide a patch that fixes this, I just > wanted to make sure that my testing strategy makes sense. > > Thanks, > Ramon > Hi Ramon, Thanks for reaching out. Calling __kunit_test_suites_init() directly is not something we'd recommend (and are trying desperately to remove existing uses), so several of the issues re: the "TAP version 14" string et al are side effects of calling what is supposed to be an internal KUnit function manually. That being said, we definitely do want to make testing platform drivers as convenient as possible. I'm not sure why kunit_test_suite() doesn't work for you for platform drivers: are you just missing some way of instantiating the device from within a test context? I know Brendan has experimented with some hardware faking code, for which there's some example use here: https://kunit-review.googlesource.com/c/linux/+/5275 (Note that you'll need to look at the other patches in the 'relation chain' for dependencies.) Equally, I've experimented a bit with testing old soundcard drivers (via a platform device) here, which may be an easier way to look through: https://github.com/sulix/linux/commit/4e1620c86553b9edde7f032318cf417dc13e4d26 Note that neither of those examples are anything other than experiments, so may not work as-is, or be ideal. Otherwise, we're always happy to accept patches, though again, if there's any way of getting your tests working without a direct call to __kunit_test_suites_init() --- even if that would require patches to work --- that'd be preferable on our end. Cheers, -- David --000000000000c08cb705e6688129 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ggz5MIIEtjCCA56gAwIBAgIQeAMYYHb81ngUVR0WyMTzqzANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA3MjgwMDAwMDBaFw0yOTAzMTgwMDAwMDBaMFQxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSowKAYDVQQDEyFHbG9iYWxTaWduIEF0bGFz IFIzIFNNSU1FIENBIDIwMjAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvLe9xPU9W dpiHLAvX7kFnaFZPuJLey7LYaMO8P/xSngB9IN73mVc7YiLov12Fekdtn5kL8PjmDBEvTYmWsuQS 6VBo3vdlqqXZ0M9eMkjcKqijrmDRleudEoPDzTumw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