Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nIHNH-0003M2-I6 for mharc-grub-devel@gnu.org; Thu, 10 Feb 2022 16:53:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIHNF-0003Fx-MS for grub-devel@gnu.org; Thu, 10 Feb 2022 16:53:09 -0500 Received: from [2607:f8b0:4864:20::834] (port=34330 helo=mail-qt1-x834.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nIHND-0008Gw-Kc for grub-devel@gnu.org; Thu, 10 Feb 2022 16:53:09 -0500 Received: by mail-qt1-x834.google.com with SMTP id g4so6317733qto.1 for ; Thu, 10 Feb 2022 13:53:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=93mJC6Xl2/sfk/o891czwh4i/O3GRgRqcES/G21wYog=; b=CKphy6aocdIUEc4v881IjXDNiyz1vrhttAW0DPu+pARSVVW5RW1zuaqDCZsKrGOWyS NUAONcbidrkUYRqPMkvzGEedYedKNLyr/tEJ+TZwsBkVMEql6FlWFJleSwq2Hl9NLv6s 2TLYuU3wGfdQCQHkh+q0NLI/8cWFJXtGCqHdvUWYTwTFsMq/R1RyqSeMcTq/Rqnnj18U 2oJSPsHLA3HTgDE2aloV52NlQJaD6TcNuyIj7nSNR9QchLC+tAXhytTuCutCXRtSfskh VNOYPxdvtV+ZZRwFhWNpDe/ePl9gJnskieorQt1YdPFNNSAYkGZ1Afej8aJP7PrdBtgC R5sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=93mJC6Xl2/sfk/o891czwh4i/O3GRgRqcES/G21wYog=; b=J+G6B7W5zE6ctx83zL21e1EjHMiY3QFp+iKz5IFpXuIbzNsKXCOioZieGqTBVTg9Ku vaLx8YHKn81X6YMHiTS010qfM7IsWk0ITq24UjSu1eEL8QIQslaY0whcCihN+/fJpunt btDil1LYmc/QCrP+Fvm1TU+VFGcQir2SG147pVkKkIfIfJvwARObaCSGPbyM9iVLV+9e UAjH2Km4lj3/NJE7rMtYUpSMrfrYXod8/6Bv2gwNdjV1fcTTrF5ZrasemcJIy46a9TLC ADHb5z77MfcOM9us8SikIKMqwe3QSUAIVac7mkHWlwMzJosPk0ywjojDJSbBSUnMeeHB IrNw== X-Gm-Message-State: AOAM533iZ8hIzXjOsNSy2VonaEefR3fb+cBolm+UnbWsTujE0BY/Kld1 v/gCG2a851tXu7Glknfq6kVbnw== X-Google-Smtp-Source: ABdhPJyA8RJoP/mBfgMhLb/QE/6mEiBQ3jq0kvHDvYSv5D8sLVK7w6mEJNZIN8S1JbliZNj4uK/6TQ== X-Received: by 2002:ac8:5dd0:: with SMTP id e16mr6392378qtx.521.1644529986863; Thu, 10 Feb 2022 13:53:06 -0800 (PST) Received: from localhost.localdomain (garza.riseup.net. [198.252.153.109]) by smtp.gmail.com with ESMTPSA id j15sm11740363qta.83.2022.02.10.13.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 13:53:06 -0800 (PST) From: Glenn Washburn To: Daniel Kiper , grub-devel@gnu.org Cc: Glenn Washburn Subject: [PATCH v3 07/15] grub-shell: Set exit status to qemu exit status Date: Thu, 10 Feb 2022 15:51:24 -0600 Message-Id: <65e3da9c18995ba0247f4923b578f982fa200c3a.1644528774.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::834 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=development@efficientek.com; helo=mail-qt1-x834.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Thu, 10 Feb 2022 21:53:10 -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 f52aeb068..3ba539c70 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -498,6 +498,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" @@ -505,7 +511,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" @@ -524,12 +531,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 @@ -537,6 +550,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.27.0