From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F86AC7EE24 for ; Mon, 5 Jun 2023 04:18:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232807AbjFEESl (ORCPT ); Mon, 5 Jun 2023 00:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbjFEESk (ORCPT ); Mon, 5 Jun 2023 00:18:40 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 553D5CA; Sun, 4 Jun 2023 21:18:38 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 3554IMKL005432; Mon, 5 Jun 2023 06:18:22 +0200 Date: Mon, 5 Jun 2023 06:18:22 +0200 From: Willy Tarreau To: Zhangjin Wu Cc: 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 Message-ID: References: <291c5437db94057a3b045a6f036b02658380b05b.1685936428.git.falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <291c5437db94057a3b045a6f036b02658380b05b.1685936428.git.falcon@tinylab.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Willy