From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Piggin Date: Fri, 9 Feb 2024 17:01:35 +1000 Subject: [kvm-unit-tests PATCH v3 2/8] arch-run: Clean up initrd cleanup In-Reply-To: <20240209070141.421569-1-npiggin@gmail.com> References: <20240209070141.421569-1-npiggin@gmail.com> Message-ID: <20240209070141.421569-3-npiggin@gmail.com> List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Rather than put a big script into the trap handler, have it call a function. 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 11d47a85..1e903e83 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 + unset KVM_UNIT_TESTS_ENV_OLD + fi +} + 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 -- 2.42.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37030657A8 for ; Fri, 9 Feb 2024 07:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707462134; cv=none; b=ZCk4l+PKP8lzSb3wnM6srSnKE6yApztL4wqzKYI9BNt6MWKpCmJXu759Wpe/7YjDkgyVw/4dsAvJAH80hjmkDGyeT28YIBYppKKGQQELTVR078eO7Yootm77yzHm4yAg2EoCD5yDfufFtK/fIawR1YMhWEG+X+Z4fOCXyz1yR1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707462134; c=relaxed/simple; bh=59F2uXNROyyrYFD80n4UUCXU0uos2PlTu+KS2KayEdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qvsvpk1/jv87/p7ZCsDSguLU0N1rkVJGUnFhIt61uJ1Og3OPnUjZsL56DKvvfKZic/CaPDbD3saQyoxpTGjuI5MIxjibMjiYQhx+txsyJp17RlA6cMWR2Is/3OG1nfiQjhpcPwU2zUSZqlSstSkU5t37kJ4yKZXeJbGK/T8PmIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WMetoAD7; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WMetoAD7" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d9b2400910so4791945ad.0 for ; Thu, 08 Feb 2024 23:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707462132; x=1708066932; darn=lists.linux.dev; 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=PZWJe/FfY+0lZ+B78melC7fte3uc1Gnzj5kPj86WV+c=; b=WMetoAD7SR6eAVPdr4dqmd4yTcLO5gxumCzMUXR0QtuU/QkNorKN/5G3so/w0vd1/a U8+bzfmMdeoRNZxzskSPWeYJuEoUBed7/U6gxC/s/IuSPCBIbJvA29FDLXXDd8W9Us2o hmX5ZYKg2lQE5PPpKtLA0hxGVVRiYGwgYXWWRA7Pl71r/TQ7y7qWWE4vzGz2tvUc/nDI 6o+6oqWIaX/BFTATKABxTLOIhJY+3dMEA4glIgpj/iXVmQVD2nCh3U5x8lVsv7jFpQqH BVGky3y7UIuZHdyvGCuEa/FbLz6KfZZL8+/+GHN863quc68SjWXIsIOidt/FqFA6yVBn DEYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707462132; x=1708066932; 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=PZWJe/FfY+0lZ+B78melC7fte3uc1Gnzj5kPj86WV+c=; b=Y0kmsxgTasKzdOLDq66OyAUgLvq+5d48jKFk+2r9O9XpJ3jNTlkRZEtQSIDLDAXcXB 1U3OfSwOC8OLO11vCGT+9dOsZI037A09DROsFsSWdUqpDMAxu1WDurwfmKHUsEIxP0g4 VLa7W3TZWNmruU89wBX0aWkWYAKarzfN7oNVO0i/ipLAmFX8/YM+C9nB4FjtJcS++bVH 9gGP9Qp+dMbWX41TBx4rIYMZuNbRwuIAUdTVok/gDgozaJrgcIZSo6V+s7LCy6IuBNdE pAyvEfogg3LpGIhOx5IDr9I2TzJsqKJMEZRQxEVczW8qSwQMZ+5rwKs5FfcBDoivugGj Mi7w== X-Gm-Message-State: AOJu0YwGTfrGyjA/JttC7uyZXvAYOPp2bbLoPZmfKO0GT52GlBHAjRQ3 q90NyejrDsjZgmEcX4QumxoN7bn0nOdwHwqpZQrJPQ90ctpSHiai X-Google-Smtp-Source: AGHT+IHOeahmko/f+RwAZAHEJWia2rOHYMfGMz4gCsHP+DywjdnF57Ty4tjhGRk1+lg6vAvd2PgMDA== X-Received: by 2002:a17:903:22cb:b0:1d9:efc7:1c4e with SMTP id y11-20020a17090322cb00b001d9efc71c4emr251590plg.6.1707462132399; Thu, 08 Feb 2024 23:02:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUjW0aiDCaCLLFfVUVr5+bjGqa7mzeF+p3ViNkQqbgtcj0Il6d+i/6lELOrZwAv2VLO/QuGkDOmTrZv2VMUIMsKQgyI4X6EJsrbFOqX3EwTBCt77J+G785rbh7UEFgzoGo0MeZTvVYFPZD7/1PJ01abi+YorczJW6k6akDxzxMXt9g2gLdOpy3QIpkuiqBIzAePfI7P128W0t4bkitbTsDbBr98gnEpsMuMgQjuH3Si8ur0dF4cnkyVF7dvAjGhMkLgFQmtXBD6lNkbOeef8ggdt/eBtk2c1xZjUn0zCW6G0TMxpZ+4JWMsZF63nPB1q8lKpmVddNx821u3QU0boOD2tlS8wYCQA3O9JUIEQCCb6Qnpm08pHAbnTmgBswHd5imYUiTh9O2eDynpgwF0mNiaOsqavbRC6Jul2MLacr+aprWRyUDanMygM30mw97u0KHVMszGF2zkWJ9/DGlFbxg4mH+LAJXvpwXsmpY+KkbPjxFdxOPeMt3Fc2yK1BQrEDsG6HaRcQ++jE20RCJF/GmJiLzdCsPsWr8F+BeQeiIe7Yj2y2RZ956a Received: from wheely.local0.net ([1.146.102.26]) by smtp.gmail.com with ESMTPSA id r10-20020a170903410a00b001d7284b9461sm839285pld.128.2024.02.08.23.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 23:02:11 -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 v3 2/8] arch-run: Clean up initrd cleanup Date: Fri, 9 Feb 2024 17:01:35 +1000 Message-ID: <20240209070141.421569-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240209070141.421569-1-npiggin@gmail.com> References: <20240209070141.421569-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Rather than put a big script into the trap handler, have it call a function. 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 11d47a85..1e903e83 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 + unset KVM_UNIT_TESTS_ENV_OLD + fi +} + 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 -- 2.42.0 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDA4DC48297 for ; Fri, 9 Feb 2024 07:04:10 +0000 (UTC) Authentication-Results: lists.ozlabs.org; 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=VoP2ytoP; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TWPwT2BGqz3dT2 for ; Fri, 9 Feb 2024 18:04:09 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VoP2ytoP; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::62a; helo=mail-pl1-x62a.google.com; envelope-from=npiggin@gmail.com; receiver=lists.ozlabs.org) Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TWPtH0bX0z3cQT for ; Fri, 9 Feb 2024 18:02:14 +1100 (AEDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1da0cd9c0e5so5128585ad.0 for ; Thu, 08 Feb 2024 23:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707462132; x=1708066932; darn=lists.ozlabs.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=PZWJe/FfY+0lZ+B78melC7fte3uc1Gnzj5kPj86WV+c=; b=VoP2ytoPOk1XNZb/bG4pN1OxlzpDiZO/rnrdV9dDE1r/H6cfPDt6NoBgZGxEpdi0Kz QQMstRbXjGoptICCYf5d9m8AZBAts9+tC/KNpvn6FHQC4dXyrjYgpjHmf4VewEQkGkBX 4sGxd/LPzG75QiTYcjr1vKqE4iBdVB5jZh37xmRzN5DE1VBdvz6gTmNDcjV19UF9nb7N hK1bdfHGKb0CPzgSfDJIQm1KYuxLTr2AdT3i0H1o0v0kVTopAGP3QrZ7bP3A7dG0She3 CoiWxb9Btz27TkZz5LToCINMdbgZdHqC8YRdjTYXwK6jVnAqSaAINUXI08nRrJViLUv7 MVSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707462132; x=1708066932; 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=PZWJe/FfY+0lZ+B78melC7fte3uc1Gnzj5kPj86WV+c=; b=D3zZksRofEeKBRO+pyMpU13uUcGyL/+ur35lShbF8zFevyh63OYJttimiK186ImWso cEjCF7BCiem/sINQio+LiPQ12NpsfuPyEQCLun2KpauoKhVVnSa27zKC07JyLeoabAkY qpnTlAyJJXwRO4DZj2RflrOErE1Z6uAEkwGlj73Xx8cmAxj+OrkGHK9xeGS+QPy6ucCv tyhtnCXm41v73DK8FSHWDQvKu2ByT5urjA+9WdpLpdJFPLuViBbx008Ua0yONyZqktrF 2r23rj3xDK3ibYfO6OJ0WbD2GmMS3nx0tXAqsRep3pu9LbYXMezVKYH3riT9oJg+Ncpx pOSw== X-Gm-Message-State: AOJu0YzRRdTdVnFcnjk8To9qbkDNn1lKfGZYmzbyUFte4r6LLHpxw4nS HbZVL0Wdv9rOS/WILT1D//UInevEF3wqOLamPX6q4Z+GUycJ/HmL X-Google-Smtp-Source: AGHT+IHOeahmko/f+RwAZAHEJWia2rOHYMfGMz4gCsHP+DywjdnF57Ty4tjhGRk1+lg6vAvd2PgMDA== X-Received: by 2002:a17:903:22cb:b0:1d9:efc7:1c4e with SMTP id y11-20020a17090322cb00b001d9efc71c4emr251590plg.6.1707462132399; Thu, 08 Feb 2024 23:02:12 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUjW0aiDCaCLLFfVUVr5+bjGqa7mzeF+p3ViNkQqbgtcj0Il6d+i/6lELOrZwAv2VLO/QuGkDOmTrZv2VMUIMsKQgyI4X6EJsrbFOqX3EwTBCt77J+G785rbh7UEFgzoGo0MeZTvVYFPZD7/1PJ01abi+YorczJW6k6akDxzxMXt9g2gLdOpy3QIpkuiqBIzAePfI7P128W0t4bkitbTsDbBr98gnEpsMuMgQjuH3Si8ur0dF4cnkyVF7dvAjGhMkLgFQmtXBD6lNkbOeef8ggdt/eBtk2c1xZjUn0zCW6G0TMxpZ+4JWMsZF63nPB1q8lKpmVddNx821u3QU0boOD2tlS8wYCQA3O9JUIEQCCb6Qnpm08pHAbnTmgBswHd5imYUiTh9O2eDynpgwF0mNiaOsqavbRC6Jul2MLacr+aprWRyUDanMygM30mw97u0KHVMszGF2zkWJ9/DGlFbxg4mH+LAJXvpwXsmpY+KkbPjxFdxOPeMt3Fc2yK1BQrEDsG6HaRcQ++jE20RCJF/GmJiLzdCsPsWr8F+BeQeiIe7Yj2y2RZ956a Received: from wheely.local0.net ([1.146.102.26]) by smtp.gmail.com with ESMTPSA id r10-20020a170903410a00b001d7284b9461sm839285pld.128.2024.02.08.23.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 23:02:11 -0800 (PST) From: Nicholas Piggin To: Thomas Huth Subject: [kvm-unit-tests PATCH v3 2/8] arch-run: Clean up initrd cleanup Date: Fri, 9 Feb 2024 17:01:35 +1000 Message-ID: <20240209070141.421569-3-npiggin@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240209070141.421569-1-npiggin@gmail.com> References: <20240209070141.421569-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , linux-s390@vger.kernel.org, Nico Boehr , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , linuxppc-dev@lists.ozlabs.org, Shaoqin Huang , Nicholas Piggin , Andrew Jones , Eric Auger , Marc Hartmayer , kvm-riscv@lists.infradead.org, kvmarm@lists.linux.dev, Paolo Bonzini , Claudio Imbrenda , Alexandru Elisei Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Rather than put a big script into the trap handler, have it call a function. 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 11d47a85..1e903e83 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 + unset KVM_UNIT_TESTS_ENV_OLD + fi +} + 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 -- 2.42.0