From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1k7Seg-0007eK-C5 for mharc-grub-devel@gnu.org; Sun, 16 Aug 2020 20:05:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7See-0007bc-Q9 for grub-devel@gnu.org; Sun, 16 Aug 2020 20:05:36 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:33402) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k7Sed-00064U-24 for grub-devel@gnu.org; Sun, 16 Aug 2020 20:05:36 -0400 Received: by mail-pj1-x1031.google.com with SMTP id i92so7156662pje.0 for ; Sun, 16 Aug 2020 17:05:34 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=baGN47dY5b5+2cJ/GbjOkAQ7MQdimn5tx5FCXkjcZQ0=; b=ahwOfPQDoxWc2wYfj/4OdPXnG5eNSlabgKHtM1jRZsDBTU4zHKj80AQ1wHdai2lABG FmWeCCJ6185Kc9isEoGBL+Cx6fzRALZYeP718d9FqKq/VSFKIJr1NPOv1lDd+UiDafsG VN4BkxDaEQTxsZCjlVW2t4tkVnR6nq6FnJG6L4F13uCxGwTwv10Cbdq05KhwDvdBrm6p zXa9h4NDpO8gSRFaW268g+Q62+fa6RuJDhCL4yknjlNFbgoSoKjEzmzFnOk+GrhjuScZ wOUJAi4G8ZG5UpH1hvhq4S0LxohPbMqCAxxr1pqAB7zRmiCMZmoafjgYuasKIPHVqRt8 Yeow== 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:mime-version :content-transfer-encoding; bh=baGN47dY5b5+2cJ/GbjOkAQ7MQdimn5tx5FCXkjcZQ0=; b=orh8ZXCrtf6xm/rSBJ+jiOZM5yfRZMpKXNLceXGfrfHnWTJtctuJenVx8rU+jACfFI aq4pJBzVyF1PYitB7E7vWx/NYCRahaXwOKBREx+ios/baegTSP3++x6oCfcJ8NHJOKKp otoIfVYsK8mIpuvFlp/T5UCDG/YVM6EY4akyfLJPqN9BvKSp7e2ChFFqqCyc4fYTcfvV W5XJQZ/tKSRjhDwDmzFSKTodPeKKN5f5dNY98/JKNGKjaBGBKcT6e12Mku4/zpj+DlaJ TSrhRaJxRdFNZrbj7xX/maPMSs1GLApRgnUvkWIkGe2uAHVOwFEQG+pofWK4XT+AZFqB pHbw== X-Gm-Message-State: AOAM5319O/1ClUMk3UsfiCHz/gOMSrKy7XBmBdQlxIgHY1xgF+i7ABW8 gs2qOe1DrnB0wJ9q9W2k6CMVkneAzMqXaw== X-Google-Smtp-Source: ABdhPJxubS7yfshBIC+84VPXtbqeISnYxyBjhb6mSwf/FvOYnoeuQDcjqIRMATZl+Wh63MYD+YaEXg== X-Received: by 2002:a17:902:bf0a:: with SMTP id bi10mr9478342plb.80.1597622733523; Sun, 16 Aug 2020 17:05:33 -0700 (PDT) Received: from crass-HP-ZBook-15-G2.lan ([136.49.44.103]) by smtp.gmail.com with ESMTPSA id h19sm14967000pjv.41.2020.08.16.17.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2020 17:05:33 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Glenn Washburn Subject: [CRYPTOMOUNT-TEST 5/7] grub-shell: Only show grub-mkrescue output if it returns an error. Date: Sun, 16 Aug 2020 19:05:16 -0500 Message-Id: <20200817000518.4006518-6-development@efficientek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=development@efficientek.com; helo=mail-pj1-x1031.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, URIBL_BLOCKED=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: Mon, 17 Aug 2020 00:05:37 -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.25.1