From patchwork Wed Feb 21 03:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1901818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EfeVuGTW; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=jgklnyTZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TfhZK6sCPz20Qg for ; Wed, 21 Feb 2024 14:28:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ga1Oh8xaskIzii3bn+mG+fetbQ8x0qGOj2UP09uTxTs=; b=EfeVuGTWANkMrS p8V9CURTCgNXtFDQw/M+Npqdow8GJw9E10fsBtheMFCl6iZXBmsczjTpcTMfDK8+ztxWPLMaoNE0D +2wbJZLoBITH+B1wLeboxtvI8YIcFvuTXmoGg972OL731OM881fLUe1DdI1Xtly0o8D5E8W/yaKoZ UpkO6CfinLnABbVtZd3+zw+hSrLNAplmyT2BxKJLxeIWW+FwEPhQCCCe/Xm1BzZoIhTZUHIQrzaZN Kt96vMbTwQxYTIALFI1CiCM/yGpnGbQiNe9OPKDGKC+XrnFbRQSWVbDcDcrXuvMryo1BPEuujcYn6 7alTZna4CUle4AwzlkLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcdHk-0000000GylS-2Wbi; Wed, 21 Feb 2024 03:28:40 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcdHi-0000000Gyji-1MuL for kvm-riscv@lists.infradead.org; Wed, 21 Feb 2024 03:28:39 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso104007a12.3 for ; Tue, 20 Feb 2024 19:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708486115; x=1709090915; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5FLaKcAirk3CTYgyOfE+aKJ+UIKz3IbgFgbToFNpwyg=; b=jgklnyTZNeHq/gpKri58FY4fXmW4fIqTv4LNoQVU8Z6/tizJzHGPHBrFMWjhB7x41p +aouSoN10Yu2F91spE+ehKPRtX6swUxJ4ifKgWHRAmJXMTXgz19cW2QVdGzTVN0JK+JL FElV0JlzcqNDWy9t//JUOAVaBXSMhc1pYWWFYL0FK0cDcRIAHhbGzZjevHnrlx93P0GJ /2+Ltqrmh9sSr95H4rG9mYCTGhb7p3117E0L3MrxWkh6KO8QG2XfMv0OKz9oLlcVnq5D 0oF6DbBWLAq/kth2tybO56NlcGZ86ROkVqFQOWLcsqC122NJqQMzU96RpNYcAVqIqks2 50lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708486115; x=1709090915; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5FLaKcAirk3CTYgyOfE+aKJ+UIKz3IbgFgbToFNpwyg=; b=drMcziacFYnPawqRDsVTvEjr6hKyBj61aqb+R9/YDvwUO56CyznBEI6ufZYYrnB8lt RVSiTbANacmUCaBFoTmJEWY1cRXxd9cWJ/2PanbMbugA1dZHmeYxtdz9SMpeMvQJhsnd 7iDJwlpVjBVxyQcdY4BwBq0l52td6wJDg3F0b+pgoe7Jjp4KeCkaapxeUJkbbC0LDKM2 xk434UbypCZ3kTQuOLyQO0p/A3M8+lJAdXvYRJFGAgvWxFqbLEFx08qCUSzu6UxNFhkC H0LrWYmLt10xo/yb50XPEBQ3Pwtgg5MzVnzt0htCzz7vfn9OokCvrS3sz7CBklszC+sx gZRQ== X-Forwarded-Encrypted: i=1; AJvYcCW3y5kns6pvTYusv/FVhSFHbj8kfABTX1uqXwuDtKxAaug41CToR/x1pqz2VZVtd0SlntcImyL2hwn27DnzAdMb/sbfGRcSnwrUf6pMzg== X-Gm-Message-State: AOJu0YyhduMD1odnG1nl/JJVapAfib/v5hzaG92/uGkorKtRTTIoqsjc Ry4CM/+6sgxQWfiQutfpfdsgcxze3i3qujlKt1QORYuiauFsqWHZ X-Google-Smtp-Source: AGHT+IG+5kUDxEEdP+IqiK5SZK+gSM7uxbwCRRCoyT5fAJOZNRoAtH8MrNNdmRsQBrctGqSWy5fX0Q== X-Received: by 2002:a05:6a20:d498:b0:1a0:7e2f:ad44 with SMTP id im24-20020a056a20d49800b001a07e2fad44mr19469432pzb.31.1708486114991; Tue, 20 Feb 2024 19:28:34 -0800 (PST) Received: from wheely.local0.net (220-235-194-103.tpgi.com.au. [220.235.194.103]) by smtp.gmail.com with ESMTPSA id q7-20020a170902b10700b001dc214f7353sm1246457plr.249.2024.02.20.19.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 19:28:34 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Cc: Nicholas Piggin , kvm@vger.kernel.org, Laurent Vivier , "Shaoqin Huang" , Andrew Jones , Nico Boehr , Paolo Bonzini , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Marc Hartmayer , linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org Subject: [kvm-unit-tests PATCH v5 2/8] arch-run: Clean up initrd cleanup Date: Wed, 21 Feb 2024 13:27:51 +1000 Message-ID: <20240221032757.454524-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240221032757.454524-1-npiggin@gmail.com> References: <20240221032757.454524-1-npiggin@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_192838_393623_1F657FBC X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Rather than put a big script into the trap handler, have it call a function. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:52a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [npiggin(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Rather than put a big script into the trap handler, have it call a function. Reviewed-by: Thomas Huth Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 11d47a85c..c1dd67abe 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -269,10 +269,21 @@ search_qemu_binary () export PATH=$save_path } +initrd_cleanup () +{ + rm -f $KVM_UNIT_TESTS_ENV + if [ "$KVM_UNIT_TESTS_ENV_OLD" ]; then + export KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD" + else + unset KVM_UNIT_TESTS_ENV + fi + unset KVM_UNIT_TESTS_ENV_OLD +} + initrd_create () { if [ "$ENVIRON_DEFAULT" = "yes" ]; then - trap_exit_push 'rm -f $KVM_UNIT_TESTS_ENV; [ "$KVM_UNIT_TESTS_ENV_OLD" ] && export KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD" || unset KVM_UNIT_TESTS_ENV; unset KVM_UNIT_TESTS_ENV_OLD' + trap_exit_push 'initrd_cleanup' [ -f "$KVM_UNIT_TESTS_ENV" ] && export KVM_UNIT_TESTS_ENV_OLD="$KVM_UNIT_TESTS_ENV" export KVM_UNIT_TESTS_ENV=$(mktemp) env_params