Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5557026pxu; Thu, 22 Oct 2020 05:40:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOOixehtscVT5bWZuz3L91MYgktq/eIvt5scl7kPqnLcLV43OH/GbacLzZ57j2VanAIc0w X-Received: by 2002:a50:cd51:: with SMTP id d17mr1928336edj.93.1603370411607; Thu, 22 Oct 2020 05:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603370411; cv=none; d=google.com; s=arc-20160816; b=t74r4tJG0iYrbOsDtFqTx+tsFPBGcyFpGz+4P/3ja4bd2SJkQBKWswRVS5dOD9/+aX Ya2zdwuGO0RxHWqMqKGu+Qnrfm5x9BQX4oKABV5fCO55rKepaGmbiKrR7Qcpawf2tWh2 +2mOJ+qCx9Jw/NJCePaOXDW13jmYKJI+bV7Uql6j6MUNGBgd2bSc2kvwlTvLtDPdOQDt 4Fp8cIbZ9zzkBO/5Qo5sp4K9yJhe3QjdoefRgnrbaozFop820sK/kiJr9HXFX9jrDEO9 RaItG23HUjJGzebWo+m0cU8rOUQzjF9tW8JiZJ31hoTl/hRuo/nB9APNT2M9CkQuKIDl vVcQ== 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:mime-version:message-id:date :sender:dkim-signature; bh=b1umzvlGhO00O3+bWPexwSNZ9i6JQ+0lmukCzM058aM=; b=oszVbfENMYDbnz8YgeU2LDioj3fvjVxs1FtLEWUCiBTk/wpdCwrZYUjJ5RxgwpbG62 +merZc8jOvQvKKEWc2ckMP82sPGK2aj5q4mvstv4HJGC6liDyi4CuW8usD6NLGM+vTag te1QJgez4HNb1E+s3aPGgmjhZAVhHTfuXjoAjujFVCJkIp58/b2/LjwRDEVNY9S9eCm0 yNiauR+6MgogRDCtLCRv1jIrGZAtcgY8mrgnW/Lc5TCmMXbwsReKl+w/dF8IgE7T2rDr 6ezBlJwDpU5chM9sJ6FO/f10edkOzj43T7dgL5jQlHbjFapwPgHIXudic+zc50U+QVqX pYHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LI1PAYlv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga5si993578ejb.47.2020.10.22.05.39.49; Thu, 22 Oct 2020 05:40:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LI1PAYlv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2504148AbgJUUjU (ORCPT + 99 others); Wed, 21 Oct 2020 16:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439488AbgJUUjU (ORCPT ); Wed, 21 Oct 2020 16:39:20 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88C7C0613CE for ; Wed, 21 Oct 2020 13:39:19 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id c9so3560358ybs.8 for ; Wed, 21 Oct 2020 13:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=b1umzvlGhO00O3+bWPexwSNZ9i6JQ+0lmukCzM058aM=; b=LI1PAYlv5RLhZbICd0vdEZEo8RO2vdUlcVR9fiwfc+quDZDfph349CCJ5fHSEfb0RE uUTRfkbOeaMZ3P9Lj9gRYfG+qdic1IyV1TB3wqTnTSSSa7nfRRbWkVCEoNfLIgDC+DCd jO27of2wmRdp5pmRufO4DXdDe4pUk/qxfE3GYYr/fdaZOBa4A3MaBFSjAKlCnWWMdssk WUVXhIp24SpNKFtoN2MwN2DVVr7lbhGIlZc8UBc6ec4zK+dACwovpdZ3INDGwEIxtA/J zuyNfm5n3GJlZA00mxp5Mp/XjTpgpYbsM43JEBZt8xweBXd1KLTihtZ+e3Q/Cr8yCK3+ 0/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=b1umzvlGhO00O3+bWPexwSNZ9i6JQ+0lmukCzM058aM=; b=fbCwyczmi6uTdcB2Gp22kHH9qOKWFmo73b3t3MfUn4DuGJQ3wePB3rPwyk2RHHke+I 8lZbN/CvHLfWCt2wLIGtsOR+JHq+rIvxtGtV2d9Bs1Dz4tEF1Bc3eMAdqbdkhw6b5m+8 6F9ZUnGtSUBYcCUprj61DiHPu3sxoJSH2Ga2GddRm9RFrLEeT+wjoo0HA/E83L4NEiTy Okl7GIxEuKUCDQG8vpk1z+Gene/CaqcyefdQ2rC/Wraf1ETSfGfbYSydbWzeiMZlVmRl KGSCN0Vm6qiBy3gF9byKRUcHXO7P602yn8Td2IsBDjo8ofytaisW80wnwl+nk+i2ixUv QELg== X-Gm-Message-State: AOAM533jAAa7FvBti8EVhXay8Rr6vUwpkkN4w1c2q0d1QufDnax9SrrL T0cecCwXo3H4Mshq4yXwUOgtY1ACdNjcTOt9ZE8cWw== Sender: "brendanhiggins via sendgmr" X-Received: from mactruck.svl.corp.google.com ([2620:15c:2cb:201:c634:6bff:fe71:d8d1]) (user=brendanhiggins job=sendgmr) by 2002:a25:e710:: with SMTP id e16mr7836816ybh.429.1603312759128; Wed, 21 Oct 2020 13:39:19 -0700 (PDT) Date: Wed, 21 Oct 2020 13:39:14 -0700 Message-Id: <20201021203914.2650778-1-brendanhiggins@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog Subject: [PATCH v1] kunit: tools: fix kunit_tool tests for parsing test plans From: Brendan Higgins To: shuah@kernel.org, davidgow@google.com Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Brendan Higgins Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some tests logs for kunit_tool tests are missing their test plans causing their tests to fail; fix this by adding the test plans. Fixes: 45dcbb6f5ef7 ("kunit: test: add test plan to KUnit TAP format") Signed-off-by: Brendan Higgins --- tools/testing/kunit/kunit_tool_test.py | 32 ++++++++++++++---- .../test_data/test_config_printk_time.log | Bin 1584 -> 1605 bytes .../test_data/test_interrupted_tap_output.log | Bin 1982 -> 2003 bytes .../test_data/test_kernel_panic_interrupt.log | Bin 1321 -> 1342 bytes .../test_data/test_multiple_prefixes.log | Bin 1832 -> 1861 bytes .../kunit/test_data/test_pound_no_prefix.log | Bin 1193 -> 1200 bytes .../kunit/test_data/test_pound_sign.log | Bin 1656 -> 1676 bytes 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 99c3c5671ea48..0b60855fb8198 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -179,7 +179,7 @@ class KUnitParserTest(unittest.TestCase): print_mock = mock.patch('builtins.print').start() result = kunit_parser.parse_run_tests( kunit_parser.isolate_kunit_output(file.readlines())) - print_mock.assert_any_call(StrContains("no kunit output detected")) + print_mock.assert_any_call(StrContains('no tests run!')) print_mock.stop() file.close() @@ -198,39 +198,57 @@ class KUnitParserTest(unittest.TestCase): 'test_data/test_config_printk_time.log') with open(prefix_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual('kunit-resource-test', result.suites[0].name) + self.assertEqual( + kunit_parser.TestStatus.SUCCESS, + result.status) + self.assertEqual('kunit-resource-test', result.suites[0].name) def test_ignores_multiple_prefixes(self): prefix_log = get_absolute_path( 'test_data/test_multiple_prefixes.log') with open(prefix_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual('kunit-resource-test', result.suites[0].name) + self.assertEqual( + kunit_parser.TestStatus.SUCCESS, + result.status) + self.assertEqual('kunit-resource-test', result.suites[0].name) def test_prefix_mixed_kernel_output(self): mixed_prefix_log = get_absolute_path( 'test_data/test_interrupted_tap_output.log') with open(mixed_prefix_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual('kunit-resource-test', result.suites[0].name) + self.assertEqual( + kunit_parser.TestStatus.SUCCESS, + result.status) + self.assertEqual('kunit-resource-test', result.suites[0].name) def test_prefix_poundsign(self): pound_log = get_absolute_path('test_data/test_pound_sign.log') with open(pound_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual('kunit-resource-test', result.suites[0].name) + self.assertEqual( + kunit_parser.TestStatus.SUCCESS, + result.status) + self.assertEqual('kunit-resource-test', result.suites[0].name) def test_kernel_panic_end(self): panic_log = get_absolute_path('test_data/test_kernel_panic_interrupt.log') with open(panic_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual('kunit-resource-test', result.suites[0].name) + self.assertEqual( + kunit_parser.TestStatus.TEST_CRASHED, + result.status) + self.assertEqual('kunit-resource-test', result.suites[0].name) def test_pound_no_prefix(self): pound_log = get_absolute_path('test_data/test_pound_no_prefix.log') with open(pound_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual('kunit-resource-test', result.suites[0].name) + self.assertEqual( + kunit_parser.TestStatus.SUCCESS, + result.status) + self.assertEqual('kunit-resource-test', result.suites[0].name) class KUnitJsonTest(unittest.TestCase): diff --git a/tools/testing/kunit/test_data/test_config_printk_time.log b/tools/testing/kunit/test_data/test_config_printk_time.log index c02ca773946d641291e27d44d73174cc16a17d9d..6bdb57f76eacef0396e68942cb3fa983b6992bab 100644 GIT binary patch delta 25 hcmdnMbChSob{0cDJ>$uC%rcYXnAkR+OlM`}0sw1)2Xg=b delta 10 RcmX@gvw>&A_Kl}2Spgdh1kV5f diff --git a/tools/testing/kunit/test_data/test_interrupted_tap_output.log b/tools/testing/kunit/test_data/test_interrupted_tap_output.log index 5c73fb3a1c6fd13a9b163a48d02eb33b0315a375..1fb677728abeb0fe6aa5edb3a0387c05906b9815 100644 GIT binary patch delta 21 dcmdnTf0=*6b{0cDJ>$t2n3Xo3{L0421prz=2g3jW delta 17 Zcmcc2zmI>y_Q@YucqXy1ZM^%H4FE=v2d@AC diff --git a/tools/testing/kunit/test_data/test_kernel_panic_interrupt.log b/tools/testing/kunit/test_data/test_kernel_panic_interrupt.log index c045eee75f27fefaabf3ba073d9e282721c19a67..a014ffe9725e3c4e81697f742cee2652a41b2108 100644 GIT binary patch delta 25 hcmZ3$uC%rcYXnAkR+OkiQ;0sv{Y2U!3B delta 10 RcmdnTwUTSX_Kl~DSO6Mc1hoJF diff --git a/tools/testing/kunit/test_data/test_multiple_prefixes.log b/tools/testing/kunit/test_data/test_multiple_prefixes.log index bc48407dcc36c44665c7d2ac620e42e7caf98481..0ad78481a0b450bf463ca7aaab0ae739d4e43018 100644 GIT binary patch delta 16 YcmZ3%ca(3!^~t;}vKwy%urYE005`P-oB#j- delta 15 XcmX@gw}NlN^~vX$gf_D>+Oq)wG*bm+ diff --git a/tools/testing/kunit/test_data/test_pound_no_prefix.log b/tools/testing/kunit/test_data/test_pound_no_prefix.log index 2ceb360be7d52cbee4b0a5a426456605ded7466e..dc4cf09a96d077bbc0b5fbcb312251742e390379 100644 GIT binary patch delta 17 YcmZ3PCZ&xh*RuiuM}Y?y delta 14 WcmeC-{lPO~`{cDuLL2X{X9WN;2?l!r base-commit: 7cf726a59435301046250c42131554d9ccc566b8 -- 2.29.0.rc1.297.gfa9743e501-goog