Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp725lqh; Mon, 6 May 2024 09:22:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqdJb3GYRh6e5oPrgNAYhhoBOeGwb8PQzx8rjUwH9vLX8KdWtoGjkh2PlzfngKuN0eiM9jxTnFJ0/fE5DHE3y7BPIpvUD35AT/NLNcWQ== X-Google-Smtp-Source: AGHT+IF6rY2rXup/Kn9zzdkjn6VAmCMOzwTx8noQCvkAepmb8nqdWZpXn4jyrbKvgGQEtuKaHj7/ X-Received: by 2002:ad4:4ea7:0:b0:6a0:af07:1141 with SMTP id ed7-20020ad44ea7000000b006a0af071141mr11288663qvb.65.1715012573057; Mon, 06 May 2024 09:22:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715012573; cv=pass; d=google.com; s=arc-20160816; b=jblwPL3mtcR/VOvUUIg0KhlH7yGXSNNVokS2/2Ldjp/Azr5EP3iMGn1KxQcrdm4xBY DE49CfGliXaOjM+Y1Jxywt5LviyuBU5UBIFp0fEPfiyqIYuYJ1kafqp/E8pSAwdo7f9h iuVlXUBVDhOxZ9r+ol+dfYAys6uFBVUuVTqdU0BNU4Qr/dBXIMuAmTvh5QVtXjIYju13 L1eB8lx68+HqYfobM+Sub7Nm9+Z7XWpXkphsB9Mm7U1oAxVIn0Ski0Qls71l0/AJEUGG oOteaTk427eH7gqv5zjmH8IUTnuJCaO7qsSgh49GxA8TpXO6dGa8U43fT4zJIqNAkQi4 FkrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pcfPczVktOLehYGwTidOXpCmzOd/aKRMTjbfwyFVHuA=; fh=CuvhR1vVRp/9wpon5qKfeMx0QAu77PxhdxIUqEZabJI=; b=JpdYGBJkRyLf34pXbqv4mvpgiXroI7P1GXzdIlsZL5+b8g42NwcUaYk+ok1ubllMPU JZOYvs4Ir6MkW3gDI1InVZkzKid9CE2m3mDb+UR0lORppRrHhNX2gugM/iwwGhGbKWFW krLvuDZwDffFED8FjrEgkXQr6Pe3HQk+u0AF454hzuW5B3TWwElV+PnbwAGmg1Fdbs+9 sF3r5T3jMZAfSF9+URruPG4eTYSDFSglTCg0DI8h3NhgSRXJ6ScuW3nugEbd1jyvz9lq eEZHWwQIgWX+TtC1dFEwfy1BdLqCjuWwDoR/ZMk1l4vMqigZN+q4itlMhnHh6rrReu9g kThw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=QVGJW07x; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-170156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170156-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z1-20020a056214040100b006a0ccebd224si9683236qvx.239.2024.05.06.09.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:22:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=QVGJW07x; arc=pass (i=1 spf=pass spfdomain=digikod.net dkim=pass dkdomain=digikod.net); spf=pass (google.com: domain of linux-kernel+bounces-170156-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170156-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BFCDA1C2230F for ; Mon, 6 May 2024 16:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A73AD15665C; Mon, 6 May 2024 16:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b="QVGJW07x" Received: from smtp-bc0a.mail.infomaniak.ch (smtp-bc0a.mail.infomaniak.ch [45.157.188.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AC9E155A55 for ; Mon, 6 May 2024 16:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.157.188.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012560; cv=none; b=Dfdw8fa5HIqzbslV6skpggxo98KGzW+b1V1VEPswCW9/aZzy065318NtLDtuH3L8EfHV5GLIzepxdEgs8G6Qn4G7d6matgwRZfrO43Vsb+y61zIPhKPUlo7ZMEL2ZhR4RIC+yCeEbm0RNg5JTXqRRhXKd275GJlb+qRYMXdFtKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715012560; c=relaxed/simple; bh=frTG5OBPlS3cpKFuLzpv3nMYxGsgU18EpPK6RPYW230=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Onkg2oQVT8hmRziGgQayIhuV8SK8LQh1J481d4JSo2wEN+qh9+LXwWABosCBEqgvJqXkqhqA5m94+3eDypMlruPWvVsjSWg6JNNX51VHYBcNj7eDKxUtYfO6rWr2W6lGvYgNNJReZ6rSr9Y/JSduJnlNpT11IPHASCEzQokWc5w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=QVGJW07x; arc=none smtp.client-ip=45.157.188.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Received: from smtp-3-0001.mail.infomaniak.ch (smtp-3-0001.mail.infomaniak.ch [10.4.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4VY6BX035Yzv5F; Mon, 6 May 2024 18:22:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1715012547; bh=frTG5OBPlS3cpKFuLzpv3nMYxGsgU18EpPK6RPYW230=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QVGJW07xk8eHL6UpWADM18ljmNpCsUZFZ/y+hnujvAG4wypA725OzVnlFCVIrzeIC hLijnFYam4uOXYA7uIhnwTtwavFoEY7K9tQ4KEDq+PhS9u4z/2SnXX09JSBL1tqE1e POk3pm5g+TTYR6xyTDIy65DL078axdOiRswSeqfc= Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4VY6BV5nyRzpxL; Mon, 6 May 2024 18:22:26 +0200 (CEST) Date: Mon, 6 May 2024 18:22:25 +0200 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: Sean Christopherson Cc: Christian Brauner , Jakub Kicinski , Kees Cook , Mark Brown , Shengyu Li , Shuah Khan , "David S . Miller" , =?utf-8?Q?G=C3=BCnther?= Noack , Will Drewry , kernel test robot , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v5 10/10] selftests/harness: Handle TEST_F()'s explicit exit codes Message-ID: <20240506.Ceeche0coolu@digikod.net> References: <20240503105820.300927-1-mic@digikod.net> <20240503105820.300927-11-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Infomaniak-Routing: alpha On Fri, May 03, 2024 at 07:17:16AM GMT, Sean Christopherson wrote: > On Fri, May 03, 2024, Mickaël Salaün wrote: > > If TEST_F() explicitly calls exit(code) with code different than 0, then > > _metadata->exit_code is set to this code (e.g. KVM_ONE_VCPU_TEST()). We > > need to keep in mind that _metadata->exit_code can be KSFT_SKIP while > > the process exit code is 0. > > > > Initial patch written by Sean Christopherson [1]. > > Heh, my pseudo patch barely has any relevance at this point. How about replacing > that with: > > Reported-by: Sean Christopherson > Closes: https://lore.kernel.org/r/ZjPelW6-AbtYvslu@google.com > > > Cc: Jakub Kicinski > > Cc: Kees Cook > > Cc: Mark Brown > > Cc: Sean Christopherson > > Cc: Shuah Khan > > Cc: Will Drewry > > Link: https://lore.kernel.org/r/ZjPelW6-AbtYvslu@google.com [1] > > Fixes: 0710a1a73fb4 ("selftests/harness: Merge TEST_F_FORK() into TEST_F()") > > Signed-off-by: Mickaël Salaün > > Link: https://lore.kernel.org/r/20240503105820.300927-11-mic@digikod.net > > --- > > > > Changes since v4: > > * Check abort status when the grandchild exited. > > * Keep the _exit(0) calls because _metadata->exit_code is always > > checked. > > * Only set _metadata->exit_code to WEXITSTATUS() if it is not zero. > > > > Changes since v3: > > * New patch mainly from Sean Christopherson. > > --- > > tools/testing/selftests/kselftest_harness.h | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h > > index eb25f7c11949..7612bf09c5f8 100644 > > --- a/tools/testing/selftests/kselftest_harness.h > > +++ b/tools/testing/selftests/kselftest_harness.h > > @@ -462,9 +462,13 @@ static inline pid_t clone3_vfork(void) > > munmap(teardown, sizeof(*teardown)); \ > > if (self && fixture_name##_teardown_parent) \ > > munmap(self, sizeof(*self)); \ > > - if (!WIFEXITED(status) && WIFSIGNALED(status)) \ > > + if (WIFEXITED(status)) { \ > > + if (WEXITSTATUS(status)) \ > > + _metadata->exit_code = WEXITSTATUS(status); \ > > Ah, IIUC, this works because __run_test() effectively forwards the exit_code? > > } else if (t->pid == 0) { > setpgrp(); > t->fn(t, variant); > _exit(t->exit_code); > } Yes > > Tested-by: Sean Christopherson OK, I'll send a v6. We really need to get this into -next. > > > + } else if (WIFSIGNALED(status)) { \ > > /* Forward signal to __wait_for_test(). */ \ > > kill(getpid(), WTERMSIG(status)); \ > > + } \ > > __test_check_assert(_metadata); \ > > } \ > > static void __attribute__((constructor)) \ > > -- > > 2.45.0 > > >