Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D428AC10DCE for ; Fri, 13 Mar 2020 02:30:51 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 879C7206F1 for ; Fri, 13 Mar 2020 02:30:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="hnJJALzx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 879C7206F1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48dqS71djvzDqFv for ; Fri, 13 Mar 2020 13:30:47 +1100 (AEDT) Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48dqQM0V76zDqDF for ; Fri, 13 Mar 2020 13:29:15 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=hnJJALzx; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 48dqQL0vqFz9sQx; Fri, 13 Mar 2020 13:29:14 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1584066554; bh=2e/6wSc8zzk17MFeEl7Gx3ZqzTPsNlvlfrLU0pTq/IU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=hnJJALzxbjcVHeUz13ZZILJonUThisqRVsruPLa9geydSxkgzE3OY5fEQQzjUruSq LO4/SHKtfvBmPMgkb4JYfUAqs49jxjt+aW411xiswDn9N6mXxr2bCi4/CEmDHueCqV 02AfzTcKZyN6dnWnHzbU81ndovwjgBMuSr2ScFnlfypi1trlzwmdhKpL3BH0tYYKXx nzhZPrkItSqaeGuI6nUz8Lrj7xXvPY4OHfG9O23k6FVqVPxoKZettJlIAdUw1SQrq6 JMNykIjndrnBuUyVBN/fjixNAFtz3v2vhn1OldQdJMQqmNwIe9nWPAkgX1SP0zbl27 YhLg8rwOnPfwQ== From: Michael Ellerman To: Nathan Lynch Subject: Re: [PATCH] powerpc/pseries: fix of_read_drc_info_cell() to point at next record In-Reply-To: <87r1xx36u5.fsf@linux.ibm.com> References: <20200307024547.5748-1-tyreld@linux.ibm.com> <87tv2w2kc2.fsf@linux.ibm.com> <87imjai0wp.fsf@mpe.ellerman.id.au> <87r1xx36u5.fsf@linux.ibm.com> Date: Fri, 13 Mar 2020 13:29:13 +1100 Message-ID: <87h7ytxa12.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tyrel Datwyler , mwb@linux.vnet.ibm.com, msuchanek@suse.de, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Nathan Lynch writes: > Michael Ellerman writes: >> >> It would also be *really* nice if we had some unit tests for this >> parsing code, it's demonstrably very bug prone. > > Can you say more about what form unit tests could take? Like some self > tests that run at boot time, or is there a way to run the code in a user > space test harness? It depends. A userspace selftest is ideal as it's the easiest option for people to run, ie. they just have to build a user program. There's also CI systems setup to run the kernel selftests automatically. See eg. tools/testing/selftests/powerpc/vphn/vphn.c We also have boot time tests, they are good for code that we want to test in the kernel proper, or that are hard to extract into a userspace program. Most of those are configurable, so testing them requires someone to enable the appropriate CONFIG_FOO and build & boot that kernel. That reduces coverage obviously. See eg. arch/powerpc/lib/code-patching.c These days there's also kunit, which is a "proper" way to do kernel unit tests. They get built into the kernel but then there's some support for running those like a user program using UML on x86. On powerpc we'd have to boot the kunit enabled kernel on hardware or in qemu to exercise the tests. So they're essentially just boot time tests but with some nicer infrastructure vs doing it all by hand like we used to. In this case the actual function we want to test could be trivially built into a userspace program, but the underlying device tree helpers probably can't be. eg. drivers/of/property.c is quite large and contains quite a few things, we'd need to shim quite a bit to get that building in userspace I suspect, which then becomes a maintenance burden. So this is probably a good candidate for a kunit test, though I haven't personally written/converted any tests to kunit so I can't say exactly how easy that is. cheers