From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pFMo5-0005Mo-QS for mharc-grub-devel@gnu.org; Tue, 10 Jan 2023 17:09:21 -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 1pFMo3-0005MM-Ur for grub-devel@gnu.org; Tue, 10 Jan 2023 17:09:19 -0500 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFMo2-0005ZK-8k for grub-devel@gnu.org; Tue, 10 Jan 2023 17:09:19 -0500 Received: by mail-il1-x129.google.com with SMTP id m15so7128462ilq.2 for ; Tue, 10 Jan 2023 14:09:17 -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=Gf7y8TUEZDSLfOQCVOq5FtzPXZYQzsEFa/XSaCs0JY4=; b=PlBfVX1wtUEs4J5rDdRqzYH6+SeprfbGBWBAOFenJlHB/Yfxi63kqMIsnPPZrCsI8o GizI/18KzUL1nnMH4l999LWcgcUCijwTaXek5RSJbgc4rCPlukK9EEHU0fxe/7P+YluA SmqyDmWcpMW6oK6/Q8OIvABhMwSwuZbuDKzFPtgsC+/Byoks/ZwjfzVuXx6juxl/v2XT TAUz9kawmvHseBvfzPqUaNQELh3VhhOuXxL8gxzO0n1+sgW9XKhA7TxFCkd5a0xVLaV7 jB2UOmTCe/Q6QeDxAPPLBObHC/2DYUa4G+pf/ed2TL68PQ8/y5C4JHmactmnV68Qe02w WWmA== 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=Gf7y8TUEZDSLfOQCVOq5FtzPXZYQzsEFa/XSaCs0JY4=; b=7wUCh95b8OOSyOks8bM5HMH3oeNYL4fMIjuiZeUYW9fKX2MXN8EpeEn/ZbDKmwGjmU RT4xMHz99UjOxV/TX3LhaPfns8jycmu/2k/nYZ5AOdtHeV0ahmeNZJvh1yBA8TppGqCY 6p2NMchhG0bdZw6RixqLVczIuCvzo5TOiX3WtvJwE+daCUGZ9jeqMbTKDviAK0VQ8Tev p22mfLfLebqCw2ySG4hebXbj+MzZ5JoalJx1Fk9vuKQq+e4nb9NRM8ZpMxI+sFhmuulc Waq++x6Izsp4RVzba2tf/nlofLZVYsh/9MeTG7EzjrraZkO8b61X99EeI63mT7MjiO6K St0A== X-Gm-Message-State: AFqh2kqsKQiHeY4BNzBwGfKlX0LCjdh/DLxui+rGkTKylXTHx6TK0hjv Pr7GIvL6rzX0Q6mrwzrgbWbUvA4akpITR3Fr X-Google-Smtp-Source: AMrXdXvb+Wbk7Adux+n1NK/ETtEdWcIA1Tk9UyDzUnZ4BWurm8cYzLfmdVA14N9eAI+DkgJTkiEZLA== X-Received: by 2002:a92:ce92:0:b0:303:5d88:ec3c with SMTP id r18-20020a92ce92000000b003035d88ec3cmr34803ilo.3.1673388556469; Tue, 10 Jan 2023 14:09:16 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 14:09:15 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Patrick Steinhardt , Glenn Washburn Subject: [PATCH 1/6] grub-shell: Set exit status to qemu exit status Date: Tue, 10 Jan 2023 16:08:55 -0600 Message-Id: <20230110220900.1248367-2-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::129; envelope-from=development@efficientek.com; helo=mail-il1-x129.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:20 -0000 This allows us to test if unexpected output in test scripts is because of a bug in grub, because there was an error in qemu, or qemu was killed due to a timeout. Signed-off-by: Glenn Washburn --- tests/util/grub-shell.in | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 43672e0804..2c0e654c1f 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -502,6 +502,12 @@ copy_extra_files() { done } +setup_qemu_logger() { + cat < "$work_directory/qemu-pipe" | tr -d "\r" | tee "${goutfile}" | do_trim & +} + +ret=0 +mkfifo "$work_directory/qemu-pipe" if [ x$boot = xnet ]; then netdir="$work_directory/netdir" mkdir -p "$netdir" @@ -509,7 +515,8 @@ if [ x$boot = xnet ]; then cp "${cfgfile}" "$netdir/boot/grub/grub.cfg" cp "${source}" "$netdir/boot/grub/testcase.cfg" [ -z "$files" ] || copy_extra_files "$netdir" $files - timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | tee "${goutfile}" | do_trim + setup_qemu_logger + timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic > "$work_directory/qemu-pipe" || ret=$? elif [ x$boot = xemu ]; then rootdir="$work_directory/rootdir" grubdir="$rootdir/boot/grub" @@ -528,12 +535,18 @@ elif [ x$boot = xemu ]; then [ -z "$files" ] || copy_extra_files "$rootdir" $files roottar="$work_directory/root.tar" (cd "$rootdir"; tar cf "$roottar" .) - "${builddir}/grub-core/grub-emu" -m "$device_map" --memdisk "$roottar" -r memdisk -d "/boot/grub" | tr -d "\r" | tee "${goutfile}" | do_trim + 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 - timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} | cat | tr -d "\r" | tee "${goutfile}" | do_trim + setup_qemu_logger + timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} > "$work_directory/qemu-pipe" || ret=$? fi + +wait +rm -f "$work_directory/qemu-pipe" + if [ x$boot = xcoreboot ]; then test -n "$debug" || rm -f "${imgfile}" fi @@ -541,6 +554,6 @@ test -n "$debug" || rm -f "${isofile}" test -n "$debug" || rm -rf "${rom_directory}" test -n "$debug" || rm -f "${tmpfile}" "${cfgfile}" "${goutfile}" -exit 0 +exit $ret -- 2.34.1