Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6372346iog; Thu, 23 Jun 2022 18:07:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uM5/87BT09rLHmfobfPspIvQxPC0Ix8DS/R6dAJ00c1nSW7KHMjQHU+m2YfHrCHVoXeZk0 X-Received: by 2002:a17:902:b68a:b0:168:c167:819f with SMTP id c10-20020a170902b68a00b00168c167819fmr41935420pls.96.1656032827148; Thu, 23 Jun 2022 18:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656032827; cv=none; d=google.com; s=arc-20160816; b=GTXt1eXOzDC/N94ggnAYpVyPd1Gh49rx1yUekGy+xA5Q2AGg2BCmkchcdmDBtmYbOQ CFtQXGaDgXMDNqIsAPq0o6vbz6u/vBn7yaj0PymVPuzeQu8cLZxYz0tmdgJme8dXf0IR RnnpwxxfcQYt0szwXZsMd8U8fi9cTD2pdL1dntasL7l5M3OIgy2FBfjZ4pXFbo1fWTEI Ba1buZflYVcu21+Mcd99g+s+2iCmUzwcRih093ikolVrDtAWg5Yv6AfwIGo54wrvl6KL nouAwEZN6WweMto1vqce2fWs5VyNZuQFdV3XvvqW2aj5p75j5QFiHj0pyKSslGoi1FxB 8hiw== 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:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=0zzE+0hwQXNaa277BCLUaAHFQtGaGomDY+ljzLXGDPc=; b=YSV0StyUf7HfXQFyUlbPDcsmFKMenUh1CzSI5/t3gO2NKSB4JoP3+LShlfhI3TTea6 plNEg4ddNhDsAgwAMD31QsMStD/QKFAXQsnw7uvEF6lYy+YIHMal8t9vP68KKseAO3ud ffd5w+oe0lUZTZ59C4XT3s3k/Zi4hMEUjoXw98UxcU5BiHAvk1iAaGYLX/E++J10/aoI zU5KuY/iwP7Owv8cpfwdwAYHuR28juGFWvMVhxRzZI0pk85O/ooN1AeClyJwHoGWwNOO pIg/k1xQ1rogd4e6YaaDSpVaCqMBBZkewT37iGwOW8saIPZN5jrlCkbqUtspnC4m86LR QuHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IEzUo2Eg; 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 e7-20020a63db07000000b0040c9f10fe76si842315pgg.212.2022.06.23.18.06.55; Thu, 23 Jun 2022 18:07:07 -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=IEzUo2Eg; 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 S229499AbiFXANJ (ORCPT + 99 others); Thu, 23 Jun 2022 20:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbiFXAM7 (ORCPT ); Thu, 23 Jun 2022 20:12:59 -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 1A66FA1 for ; Thu, 23 Jun 2022 17:12:55 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id bk18-20020a17090b081200b001ec747bb1f7so1966750pjb.7 for ; Thu, 23 Jun 2022 17:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=0zzE+0hwQXNaa277BCLUaAHFQtGaGomDY+ljzLXGDPc=; b=IEzUo2EgRrGk0GpITOyDG6hDD4cn0sUzZdIKb32OJa4YDY7wxm+bUgr+FEj55cani9 yrkBkBKNlQgyT8sue6LUkGAWUGVJELS1fUW+89AZwMI7b28vjVkKR80WI/+N4dbf0nEM y0wvaGVj/JaLoMyz7dsUBA/vhH10CRfAySOJicWEuqolM+3dyXQ2CJqw8K5lktiAFGKI YR7x5M5kcNt30LP93/xMApOluh0W4JwkrUpxGPj3Q04QtFoWA8kcIMWaiZsBoYV0GTQF 4bsI9w1qDPvJj9xheuINDOc/QDKaBfLy2suVSholqIqID/cSmQ99momC8LOZ/GsfNdZu ZYIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0zzE+0hwQXNaa277BCLUaAHFQtGaGomDY+ljzLXGDPc=; b=kZW92OL8rFe7bEV1IKkm728xXDTQHhLDwyLMWcEs0xMv+b6NQH7FTmBcWUu0QVLMqu /NzrOenf4QdW9KdomrSyYEuPRfSgzhVxHuz9Zd+5fqn0ZWP10v32HwYaC3OIRVlb7QW3 I0PkX3W/jjGC/M3giio8JoU5BS4EetvlnvUP6GfHHrE3kJSjh9yJlwNIjdc+AvoyBoWe nzhdhDqFPDzw85t9ni6VbN9/tipsE6+JFPFx0WJeuhOeLqMq39bg2uJrmcNX7uVNDAcL PQYIdSZ6XArOrDlV+6CYe69T3Gg69lI1juXoLt0uQFBCtIc7oCeUseeQwaqWzbRYXVsc HZYA== X-Gm-Message-State: AJIora9RoVQbjYFEiYPMLT2iaLfkjXPIJePAZn0lcZRGXsRIQ2P5wwCb t9EOoEJb+yj6RnXC4cAEbNYIOJZzNqM0HA== X-Received: from dlatypov-spec.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3f35]) (user=dlatypov job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr85092pje.0.1656029574951; Thu, 23 Jun 2022 17:12:54 -0700 (PDT) Date: Fri, 24 Jun 2022 00:12:47 +0000 In-Reply-To: <20220624001247.3255978-1-dlatypov@google.com> Message-Id: <20220624001247.3255978-2-dlatypov@google.com> Mime-Version: 1.0 References: <20220624001247.3255978-1-dlatypov@google.com> X-Mailer: git-send-email 2.37.0.rc0.104.g0611611a94-goog Subject: [PATCH 2/2] kunit: add coverage_uml.config to enable GCOV on UML From: Daniel Latypov To: brendanhiggins@google.com, davidgow@google.com Cc: linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, Daniel Latypov 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: X-Mailing-List: linux-kernel@vger.kernel.org Now that kunit.py's --kunitconfig is repeatable, let's create a file to hold the various options needed to enable coverage under UML. This can be used like so: $ ./tools/testing/kunit/kunit.py run \ --kunitconfig=tools/testing/kunit/configs/all_tests_uml.config \ --kunitconfig=tools/testing/kunit/configs/coverage_uml.config \ --make_options=CC=/usr/bin/gcc-6 which on my system is enough to get coverage working [1]. This is still a clunky command, but far better than before. [1] at the time of this commit, I get: Overall coverage rate: lines......: 11.6% (34112 of 295033 lines) functions..: 15.3% (3721 of 24368 functions) Signed-off-by: Daniel Latypov --- Documentation/dev-tools/kunit/running_tips.rst | 3 +-- tools/testing/kunit/configs/coverage_uml.config | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 tools/testing/kunit/configs/coverage_uml.config diff --git a/Documentation/dev-tools/kunit/running_tips.rst b/Documentation/dev-tools/kunit/running_tips.rst index c36f6760087d..205ea21c9cca 100644 --- a/Documentation/dev-tools/kunit/running_tips.rst +++ b/Documentation/dev-tools/kunit/running_tips.rst @@ -123,8 +123,7 @@ Putting it together into a copy-pastable sequence of commands: .. code-block:: bash # Append coverage options to the current config - $ echo -e "CONFIG_DEBUG_KERNEL=y\nCONFIG_DEBUG_INFO=y\nCONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y\nCONFIG_GCOV=y" >> .kunit/.kunitconfig - $ ./tools/testing/kunit/kunit.py run + $ ./tools/testing/kunit/kunit.py run --kunitconfig=.kunit/ --kunitconfig=tools/testing/kunit/configs/coverage_uml.config # Extract the coverage information from the build dir (.kunit/) $ lcov -t "my_kunit_tests" -o coverage.info -c -d .kunit/ diff --git a/tools/testing/kunit/configs/coverage_uml.config b/tools/testing/kunit/configs/coverage_uml.config new file mode 100644 index 000000000000..bacb77664fa8 --- /dev/null +++ b/tools/testing/kunit/configs/coverage_uml.config @@ -0,0 +1,11 @@ +# This config fragment enables coverage on UML, which is different from the +# normal gcov used in other arches (no debugfs). +# Example usage: +# ./tools/testing/kunit/kunit.py run \ +# --kunitconfig=tools/testing/kunit/configs/all_tests_uml.config \ +# --kunitconfig=tools/testing/kunit/configs/coverage_uml.config + +CONFIG_DEBUG_KERNEL=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y +CONFIG_GCOV=y -- 2.37.0.rc0.104.g0611611a94-goog