From patchwork Wed Aug 9 15:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 13388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2957377vqr; Wed, 9 Aug 2023 10:23:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0Sug3CFF4NAq/rxmnzXi4BSuWM2V8DOorYRCwejdEuJTX4S1IsArU4lmLdrTfkMz+AycP X-Received: by 2002:aca:bc08:0:b0:3a3:baf8:5b8a with SMTP id m8-20020acabc08000000b003a3baf85b8amr3071176oif.13.1691601805172; Wed, 09 Aug 2023 10:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691601805; cv=none; d=google.com; s=arc-20160816; b=CCGkNQsp6G5fLnb8TmvB3+s3jafRRPsNtmvJ8Oyfz+R0v+XD6+bl7F9ddCM3QuYtkT uRPHnzS5q9Mxpr+cCSjV/Q9D0032VViTAjzfs6NBaP9XzYtfTP+shdcx7ozaJdFSkzhM KviV/sZofohnhSXFuRJ8/YxOkNvNSVeCMDj8X5SRKGzio6+9YP+QTwdc74eL5aS39mwa 9/iI4DrNtsvhM/pN6fh9JMt5SfDW3hFLJubocib1NbArPcxewr3my7VyIQdjqeXk7gAp 6Xx/gUgFH+bgbnZ5jROWQ1Ubq+klwqu14GcBQgObZTdzcv4eLZoWyw5eWIRYgOf8RGo4 aqCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZkHLOZxL/zUPQBtzRZ/2aFe1CQ5Jd2Dy1yhV/zJ7Hmc=; fh=bGF4ESczbIrmrNxFOdEMfzJNgTVkRsqDRt+LRN0CeSg=; b=HyBBJ0DOT6cCerzZEP9Ug9xfOrXUf3bxJDKwI1hfupqzFABYJ1huQguZ4zwGpC51cR n9uRwhqUZGroTTbg7RB8EfiQxhSD4KEzG6c7pJKI0m0Z6bltF2yxy5GzRvESk8vVzvPZ HWFKmd8cHNWFU9qiNGuaa0+Pd3bcrEO9+Q00Ihh4yV+j4Iq4qzUzujV0xsNogjNDshoO iHEywdPH9sOMQT+L9AxyjlTYFjQIahTt2PgKngilWmbkbc/ErpBQRNLRjx/Bvuwro2iz tCaGd8MR84REs4XF1crYkkUwYtLv3gtreQOgnEHgYwzU6knNkxiYLDywspJ1S/Peptek fSVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Q6HJWnFn; 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=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a17090abb9300b0025de453ee4csi1781341pjr.168.2023.08.09.10.23.08; Wed, 09 Aug 2023 10:23:25 -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=@cirrus.com header.s=PODMain02222019 header.b=Q6HJWnFn; 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=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233714AbjHIPy6 (ORCPT + 99 others); Wed, 9 Aug 2023 11:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjHIPy5 (ORCPT ); Wed, 9 Aug 2023 11:54:57 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8A01729; Wed, 9 Aug 2023 08:54:56 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 379EvsGJ002928; Wed, 9 Aug 2023 10:54:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PODMain02222019; bh=Z kHLOZxL/zUPQBtzRZ/2aFe1CQ5Jd2Dy1yhV/zJ7Hmc=; b=Q6HJWnFnruMMnKLJR yKwQKMR8mw+7hlCHMyfisCNTz3Ixfrfx2DRbqbrNx9pP96OzPK2GCZ41D3HhKF1J SY0yjnrBH4xXH7PPikPOltTqfxMM/3VWjLC8Vitsxwf42+Iz0spOaDT96GOLkELp 19C0kXeHQiDr8RNz5ihtRWKuNcxi+a/LWRrqr6p2Ej4Qrssvh1/zzeGm3WOzY+me P83ocp8eoMHXstRzox2sJzPOC76+1KgwP9SmXT6hep9YR+nwkMyeY6uyvWC+sPzG WoJRz8WvBCwMmyOfzoBy377zf8YH36glV6vsycjL2vbrk9l7bqThgcweFOtiQCNZ WPlDw== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3s9juhuvg6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 09 Aug 2023 10:54:47 -0500 (CDT) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 9 Aug 2023 16:54:45 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.30 via Frontend Transport; Wed, 9 Aug 2023 16:54:45 +0100 Received: from EDIN4L06LR3.ad.cirrus.com (EDIN4L06LR3.ad.cirrus.com [198.61.64.220]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 2DFEA45D; Wed, 9 Aug 2023 15:54:45 +0000 (UTC) From: Richard Fitzgerald To: , , CC: , , , , Richard Fitzgerald Subject: [PATCH v3 0/7] kunit: Add dynamically-extending log Date: Wed, 9 Aug 2023 16:54:31 +0100 Message-ID: <20230809155438.22470-1-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Proofpoint-GUID: UHPPCzpg6K0WlTYlIn4MYqd5wjRRPUcl X-Proofpoint-ORIG-GUID: UHPPCzpg6K0WlTYlIn4MYqd5wjRRPUcl X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773773054150267957 X-GMAIL-MSGID: 1773773054150267957 Replace the original fixed-size log buffer with a dynamically- extending log. Patch 1 provides the basic implementation. The following patches add test cases, support for logging long strings, and an optimization to the string formatting that is now more thoroughly testable. Changes since v2: - Fixed uninitialized string bug in get_concatenated_log(). - Moved get_concatenated_log() into first patch so that kunit_log_newline_test() dumps the entire log on error. - Moved kunit_log_frag_sized_line_test() to the correct point in the chain, after the change that it depends on. Also log another line after the long line to test that the log extends correctly. - Added kunit_log_init_frag_test() to test kunit_init_log_frag() instead of testing it as part of every other test. Richard Fitzgerald (7): kunit: Replace fixed-size log with dynamically-extending buffer kunit: kunit-test: Add test cases for extending log buffer kunit: Handle logging of lines longer than the fragment buffer size kunit: kunit-test: Test logging a line that exactly fills a fragment kunit: kunit-test: Add test cases for logging very long lines kunit: kunit-test: Add test of logging only a newline kunit: Don't waste first attempt to format string in kunit_log_append() include/kunit/test.h | 25 ++- lib/kunit/debugfs.c | 65 ++++++-- lib/kunit/kunit-test.c | 339 ++++++++++++++++++++++++++++++++++++++++- lib/kunit/test.c | 127 ++++++++++++--- 4 files changed, 507 insertions(+), 49 deletions(-)