Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp285227rwd; Tue, 6 Jun 2023 23:13:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LkpD2z0yt+HW6bqOOUUZZ0NKCdvxEr1IoSIIk7ocITfEJ0xXi2MqUG30JNB4GhhlFiwkk X-Received: by 2002:a92:d0c3:0:b0:33a:56d6:d9a4 with SMTP id y3-20020a92d0c3000000b0033a56d6d9a4mr6851931ila.10.1686118380136; Tue, 06 Jun 2023 23:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686118380; cv=none; d=google.com; s=arc-20160816; b=t52NR3rvTCHtYW6hZJ6h2l9TizroUxDQMfTviu/TmvxLBNqFEGwhC9Vu3McGm3FC7L SrJMkh9Stqxg0H64kDfjD6UODBF/0HkSR8Nzv2fhULsvF96mY1lrHZ1vWaZzhUHQdgqy FD4LUnuZcHQp45M9+uNZvQHq52iPkSJDmg+TXOz9I1GQr3jC9K+9cvh3p3kd+sfjFNtT xWRDr3WTqDOuuqIPQw3chs5PNKoyIq8YpQZD8GMIB5IlBV/1zkD7agvSg28tO2IqOA/3 9+ITqZkZ9YLV4Ql7ng++VkZQDkDdfTbVq4E0WZlCQ4wI1UhnQTvD4qhHy/yJql4vQQ7D T4cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=18f0cYxsK5Dm3k9m4CwMDRu5wcwoAISghdVtZeI4UOY=; b=izXB3jzWecvbyqpPIgcv656DDHH3Rb/bt4K3T2Fcrr7fgRBY/pKhI0rWu9fLNzyBC+ DYwyY1LB3WbfCe/g3Eu7ojI0jEgSfxyk/dQqkjtusuDZ/PhOlXDM7TiQV5AG7jFPLvCg 6q9XXVuCH2sboRduQLEOTFs4ypzfZ81UF2WfgFfOA7zdZHIfpmc0bkchFBtwKXd0UfXq wYcrWXJpE4tX3chZni1kQWHuQSCZSYP1n9LRlwX45vqOfTi5xP3FUHO1AVWKB4D9EYTA ra0HtAOlNWEYlgzelJ5ogTtxQI8eGgEEdIFlGmQzhX95P8f1eH+37OmRAgPWuZ9NoD4u ABsg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a633717000000b00543cbd602b5si3475232pga.341.2023.06.06.23.12.48; Tue, 06 Jun 2023 23:13:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234256AbjFGFwS (ORCPT + 99 others); Wed, 7 Jun 2023 01:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233780AbjFGFwQ (ORCPT ); Wed, 7 Jun 2023 01:52:16 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A60C483; Tue, 6 Jun 2023 22:52:13 -0700 (PDT) X-QQ-mid: bizesmtp70t1686117122tlw2aohn Received: from linux-lab-host.localdomain ( [61.141.77.49]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 07 Jun 2023 13:52:00 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: 7L1V3dHhUFNwsCYRlWfHiijmi2tXCINUn3YioqGbuOxs/CPWofUR/InpqT49J 9b0cchLC0VK3ORkZ/8q/onk4NKY4mNzZCJaxDJu+EyFMxF5re0ekuIoPMp5wFYl6tYBVEj8 X+myOvogX1rqOB7aF76W6Mzr6O6jCfib+BpInN/83g+1nYuplhKIlCAzTuIphJG7c2RBfZq 12wdO26wIO08Y5LDCswdjH0U/5OKBpmqob3d6XTTI4dW1JtPmxwC96SQ20EdkaxHaVXruKx nbF3H8KOyLwDs0GnIMlOFRpgQCNHFYDVt3wftQILgXQzRAHpOwlzSayojXwFnaYeVo9xapm 78TRVoBIoJKAKQHPl7ejgG6RYWjp66ZUDiOvSCPrese08cpbFHlp1Yt+mOqVAV1qfC7P8Ye F+VzuWsvtfA= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 18357036349121096708 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, thomas@t-8ch.de Subject: Re: [PATCH 1/4] selftests/nolibc: add a test-report target Date: Wed, 7 Jun 2023 13:52:00 +0800 Message-Id: <20230607055200.667447-1-falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230605065459.153001-1-falcon@tinylab.org> References: <20230605065459.153001-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,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 Hi, Willy > > On Mon, Jun 05, 2023 at 11:48:52AM +0800, Zhangjin Wu wrote: > > > A standalone test-report target is added to let the run, run-user and > > > rerun targets share them. > > > > > > Signed-off-by: Zhangjin Wu > > > --- > > > tools/testing/selftests/nolibc/Makefile | 26 ++++++++++++------------- > > > 1 file changed, 13 insertions(+), 13 deletions(-) > > > > > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > > index be4159837494..8149ace2938a 100644 > > > --- a/tools/testing/selftests/nolibc/Makefile > > > +++ b/tools/testing/selftests/nolibc/Makefile > > > @@ -127,14 +127,18 @@ nolibc-test: nolibc-test.c sysroot/$(ARCH)/include > > > libc-test: nolibc-test.c > > > $(QUIET_CC)$(CC) -o $@ $< > > > > > > -# qemu user-land test > > > -run-user: nolibc-test > > > - $(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(CURDIR)/run.out" || : > > > +test-report: > > > $(Q)awk '/\[OK\]$$/{p++} /\[FAIL\]$$/{f++} /\[SKIPPED\]$$/{s++} \ > > > END{ printf("%d test(s) passed, %d skipped, %d failed.", p, s, f); \ > > > if (s+f > 0) printf(" See all results in %s\n", ARGV[1]); else print; }' \ > > > $(CURDIR)/run.out > > > > > > +# qemu user-land test > > > +_run-user: nolibc-test > > > + $(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(CURDIR)/run.out" || : > > > + > > > +run-user: _run-user test-report > > > + > > > > This will not reliably work, there's no ordering here, nothing guarantees > > that test-report will run *after* _run-user (e.g. make -j). Another > > approach is needed if you want to factor this, but in general creating > > sequences in makefiles is difficult and often more painful than having > > 3 times the same 3 lines. > > > > Ok, thanks, what about this? > > # LOG_REPORT: report the test results > LOG_REPORT := awk '/\[OK\][\r]*$$/{p++} /\[FAIL\][\r]*$$/{f++} /\[SKIPPED\][\r]*$$/{s++} \ > END{ printf("%d test(s) passed, %d skipped, %d failed.", p, s, f); \ > printf(" See all results in %s\n", ARGV[1]); }' > > run-user: nolibc-test > $(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(CURDIR)/run.out" || : > $(Q)$(LOG_REPORT) $(CURDIR)/run.out > > run: kernel > $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" > $(Q)$(LOG_REPORT) $(CURDIR)/run.out > > rerun: > $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" > $(Q)$(LOG_REPORT) $(CURDIR)/run.out > > Or we directly add a standalone test report script? something like > tools/testing/selftests/nolibc/report.sh > > #!/bin/sh > # > # report.sh -- report the test results of nolibc-test > # > > LOG_FILE=$1 > [ ! -f "$LOG_FILE" ] && echo "Usage: $0 /path/to/run.out" > > awk ' > /\[OK\][\r]*$$/{ p++ } > /\[FAIL\][\r]*$$/{ f++ } > /\[SKIPPED\][\r]*$$/{ s++ } > > END { > printf("%d test(s) passed, %d skipped, %d failed.", p, s, f); > printf(" See all results in %s\n", ARGV[1]); > }' $LOG_FILE > > And use it like this: > > LOG_REPORT = $(CURDIR)/report.sh > I plan to renew this patchset, which one of the above methods do you prefer? For the always print statement: printf(" See all results in %s\n", ARGV[1]); }' I will paste the reason why I need it, as mentioned in [1], if you still need a clean test report, I will give up this change ;-) Thanks, Zhangjin --- [1]: https://lore.kernel.org/linux-riscv/20230605070508.153407-1-falcon@tinylab.org/ > Best regards, > Zhangjin > > > Willy