From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pFMo8-0005NU-Vg for mharc-grub-devel@gnu.org; Tue, 10 Jan 2023 17:09:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFMo6-0005Mr-1w for grub-devel@gnu.org; Tue, 10 Jan 2023 17:09:22 -0500 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFMo4-0005co-Kg for grub-devel@gnu.org; Tue, 10 Jan 2023 17:09:21 -0500 Received: by mail-il1-x12c.google.com with SMTP id o13so7100188ilc.7 for ; Tue, 10 Jan 2023 14:09:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; 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=NPlG411n4itwSy5b7SuRiLJdt0mIOJ9IDFZiUQsW3E0=; b=tvpNmkVwkrHpHTrrR1CYtBwSazaR853e/gg291EWmd5I2Zw0Wkkse1AjEjdr4bIPXb 5zHxKaf5vytI7hMfKZop3lWIeygFF+MeadVFbYVTZ7T/4QxyEVrpVVYseUmARyMwQ+m+ FLxdgKV0TtvNyoSXCFqMvVTmQBOnBi5BpqBRUEf+t/P5H4Zofctuxrf9uqKJ/OHjXgIO tzazaBaHS0STZW7qLCjXlFiMXkqPO9kxXiaHXXDFSDHhr3A5YYQn7W9VdjVBljl6o4+H x2wo5GqpZAILGo6PNz6L9iHkTh1UwmYUItvKHJfwdBjhZlY5Is/aoGI8eBppDfK3whVy cU1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=NPlG411n4itwSy5b7SuRiLJdt0mIOJ9IDFZiUQsW3E0=; b=ax3+bG+dSxylz323QuTdQ0CY1L5G0sajWDgzS0rhmkHTSzQSJZd5OKiuaIWuqxt9tG aI3p6nVHfrOOV83rMpLy0tYM5EuLpYzzK5BAcalMm6znlAgbt6iJLUe+mdhs7B8reOwY AfVqegZMcphl8X3f75GzkeBMktYL/92915AI05aoTaDcy/VCLh0eWyMgcxnSy0F+WaIh UntHNvTtS9cd6Oqd0VCQXbpCfapp6RIAshJSbL54vCrwCdOaW/q/papSSuq9/KAiqHzF 6tEiqqLOX2dZzvT6eAU4AD/O1vnmpp3jTCdLIvSRoa6NS7zcKjbkWP9agZzNPy8XtAev 3wYQ== X-Gm-Message-State: AFqh2kol86Iz4xJERihwYUXxigS1uDUt1gFiq84d6XniL2VcRVn8xXWd 6kPH9K+RwecdQr608BumAUU7E38ZqHbGcxRn X-Google-Smtp-Source: AMrXdXsPSR4Dzhxr/La9NFpQGgZmrP4Fg+f4wV5DLfSbDS5ux9HqLyPoejDmSLU/+nYiTenRgNw75Q== X-Received: by 2002:a92:da12:0:b0:30c:4558:1376 with SMTP id z18-20020a92da12000000b0030c45581376mr23944094ilm.3.1673388559021; Tue, 10 Jan 2023 14:09:19 -0800 (PST) Received: from crass-HP-ZBook-15-G2.lan ([199.254.238.56]) by smtp.gmail.com with ESMTPSA id c3-20020a029603000000b0038ac01fb3bcsm3980811jai.14.2023.01.10.14.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 14:09:18 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Patrick Steinhardt , Glenn Washburn Subject: [PATCH 2/6] grub-shell: Only cleanup working directory file if QEMU does not fail or timeout Date: Tue, 10 Jan 2023 16:08:56 -0600 Message-Id: <20230110220900.1248367-3-development@efficientek.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110220900.1248367-1-development@efficientek.com> References: <20230110220900.1248367-1-development@efficientek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::12c; envelope-from=development@efficientek.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2023 22:09:22 -0000 This keeps the generated files to aid in diagnosing the source of the failure. Signed-off-by: Glenn Washburn --- tests/util/grub-shell.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 2c0e654c1f..e5d34d1d35 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -537,8 +537,6 @@ elif [ x$boot = xemu ]; then (cd "$rootdir"; tar cf "$roottar" .) setup_qemu_logger "${builddir}/grub-core/grub-emu" -m "$device_map" --memdisk "$roottar" -r memdisk -d "/boot/grub" > "$work_directory/qemu-pipe" || ret=$? - test -n "$debug" || rm -rf "$rootdir" - test -n "$debug" || rm -f "$roottar" else setup_qemu_logger timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} > "$work_directory/qemu-pipe" || ret=$? @@ -547,8 +545,16 @@ fi wait rm -f "$work_directory/qemu-pipe" +if [ "$ret" -ne 0 ]; then + # If QEMU failure, keep generated files to reproduce + exit $ret +fi + if [ x$boot = xcoreboot ]; then test -n "$debug" || rm -f "${imgfile}" +elif [ x$boot = xemu ]; then + test -n "$debug" || rm -rf "$rootdir" + test -n "$debug" || rm -f "$roottar" fi test -n "$debug" || rm -f "${isofile}" test -n "$debug" || rm -rf "${rom_directory}" -- 2.34.1