Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lCw1X-00069q-GL for mharc-grub-devel@gnu.org; Thu, 18 Feb 2021 22:00:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCw1V-000668-NF for grub-devel@gnu.org; Thu, 18 Feb 2021 22:00:05 -0500 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:44025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCw1T-0005VG-Dq for grub-devel@gnu.org; Thu, 18 Feb 2021 22:00:05 -0500 Received: by mail-qv1-xf2e.google.com with SMTP id gi9so2000098qvb.10 for ; Thu, 18 Feb 2021 19:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T6zrogphfmIDzIdQqdRE3fP5VoIixFIOuvuOhxpAzeQ=; b=FF/EmJrcWS/h7keTslIWw9Z202yeYBRhVmbrdnDDjnbFOE5q+eKsU7emq0dRC3XfZJ 3gyLfu6ir+MtNkskbWr4mhlxUM478yIFpaMGvwM8rfWqgDagecTDLu0i//pE+E9m3pz0 PNvu/Nv3j4PKGOXA18hhuEhaihXtOM2p0nxnuRcOplbjdw+FKB7uCceEYdvcJ8C147dL euytw0M8lKnJP+5htV+ACWtYrOya6srBGo8oX1bhbzDDM64U0dCGnyoJ/eYzJQQLWzme tZ3EsiNp9k3ku/+xcRMc6/Nh+dk4mesDwE9znbIzCi2GeWUYJ+qZzkEmhCutTJbMnQE1 esnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T6zrogphfmIDzIdQqdRE3fP5VoIixFIOuvuOhxpAzeQ=; b=dptKz5BHLJj/bwqZ8MbRG7L8uhb//K6+229M6abIZwZvIV41zVKzSY19KZiPNsv66e YbK6RRosydG/3b/Zzx0co7HCH5KGZScodn0ixcer8U51qJILg8tYNstzLz4J/fS4y+Me A8vHqc3zrNtCx22AJ58BFaW5ljasGUoQqak3aSyIjrBKoo1d0VkO1MlaouaUeRGvbQzk u5i5Xc0VDx2zTRbw8etYXj9xHsh7bmAArc/d08a92ME2utGZTkAm0Shds2vRtmcGotG0 XvbNiZd9Brfk3j2IbVeBYmrQlEo4YBblHsznPFPcrxR1rbSFfcjU2HD074VebTueAKhB 1pcQ== X-Gm-Message-State: AOAM530AF88b1bMjmOjdE8hwqPk8FgDC+Oqn3BB28zbRDDvhjM/yngOJ bXUF7DGwKeCoFIgXtCOoM+TTn6znw4XhTg== X-Google-Smtp-Source: ABdhPJx5hooN+6S++qljpEJPhUFjvdrlFwJNCMjmJe8Q+yimBf92tb0U0sHtBCciHrgjWVyMQlgIMQ== X-Received: by 2002:a0c:f589:: with SMTP id k9mr7397027qvm.0.1613703601970; Thu, 18 Feb 2021 19:00:01 -0800 (PST) Received: from localhost.localdomain ([2605:a601:aac5:3700:c323:c101:d96b:34f1]) by smtp.gmail.com with ESMTPSA id b17sm2468294qtq.56.2021.02.18.19.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Feb 2021 19:00:01 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org Cc: Daniel Kiper , Glenn Washburn Subject: [CI 07/17] grub-shell: Only show grub-mkrescue output if it returns an error Date: Thu, 18 Feb 2021 20:59:26 -0600 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f2e; envelope-from=development@efficientek.com; helo=mail-qv1-xf2e.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.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 03:00:06 -0000 The previous behavior ignored an error and the output from grub-mkrescue. This made it a pain to discover that grub-mkrescue was the reason that tests which rely on grub-shell were failing. Even after discovering grub-mkrescue was the culprit, there was no output to indicate why it was failing. It turns out that grub-mkrescue is a thin wrapper around xorriso. So if you do not have xorriso installed it will fail with an error message about not being able to find xorriso. This change will allow grub-mkrescue output to be written to stderr, only if grub-mkrescue fails. If grub-mkrescue succeeds, there will be no output from grub-mkrescue so as not to interfere with the functioning of tests. This change should have no effect on the running of tests or other uses of grub-shell as it only modifies the error path. Also, if grub-mkrescue fails, the script exits early. Since grub-shell needs the iso image created by grub-mkresue to boot the qemu instance, a failure here should be considered fatal. Signed-off-by: Glenn Washburn --- tests/util/grub-shell.in | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 602b16f3e..9d8c417da 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -60,6 +60,17 @@ Report bugs to . EOF } +# Exec given argv and only show its output on STDERR if it returns an +# error status. +exec_show_error () { + v=`$@ 2>&1` + ret=$? + if [ "$ret" != 0 ]; then + echo "$v" >&2 + exit $ret + fi +} + . "${builddir}/grub-core/modinfo.sh" qemuopts="${GRUB_QEMU_OPTS}" serial_port=com0 @@ -383,13 +394,15 @@ if test -z "$debug"; then fi if [ x$boot != xnet ] && [ x$boot != xemu ]; then - pkgdatadir="@builddir@" "@builddir@/grub-mkrescue" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \ + pkgdatadir="@builddir@" \ + exec_show_error "@builddir@/grub-mkrescue" "--output=${isofile}" \ + "--override-directory=${builddir}/grub-core" \ --rom-directory="${rom_directory}" \ --locale-directory="@srcdir@/po" \ --themes-directory="@srcdir@/themes" \ $mkimage_extra_arg ${mkrescue_args} \ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \ - ${files} >/dev/null 2>&1 + ${files} || exit $? fi if [ x$boot = xhd ]; then if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = arm64-efi ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = arm-efi ]; then -- 2.27.0