From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mYa5d-0000Z5-TS for mharc-grub-devel@gnu.org; Thu, 07 Oct 2021 16:34:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYa5c-0000Uz-Do for grub-devel@gnu.org; Thu, 07 Oct 2021 16:34:04 -0400 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:38591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYa5Z-0003BQ-N2 for grub-devel@gnu.org; Thu, 07 Oct 2021 16:34:04 -0400 Received: by mail-qt1-x82c.google.com with SMTP id d8so7535259qtd.5 for ; Thu, 07 Oct 2021 13:34:00 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=NUEnxioyr36QOlT6fnvQxLjP/JIbCUAcIZN7Rn49S7k=; b=oZJDAv012kR2OBftnMEgOt59G3wCLRMf5MP7xuebhFqskF7N0i9gpPu2UW4kOTGr41 4Nzp198yPiMfUFogXNDXnTw2o3UjSgEp3cy86VmXnKH+MFvfIkYJ/6JrW9yxl2/GUgRb 00uIwuAKIV6fQcsEWpi9/w/2x0aXuILhJiGuqAmaHhBy4/zHXtlRpm1bnaXlxfNq+Qnv 9zR67UxBJsxUhxhTPy1y57XyQ8Yc2OtT7MG2R7Qvyu/nFmhrA0sHcMjIATQru6sffRjh +qnHFDo/TgO75Xc2NEMeZnh+nSknjn6spak28rTUzT7ZS1HR/sPKqjk50jmC4N7Fw4HQ FGkQ== 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:mime-version :content-transfer-encoding; bh=NUEnxioyr36QOlT6fnvQxLjP/JIbCUAcIZN7Rn49S7k=; b=VlQ3JVx7iErghVBsvLQ7anqKvQhd+PJWIHkWUtRvnzhxlzN65KK5bEItuPzBEqkHTd 64/zi2Y7bGX3+DfEQ01xqakBPYZoNrV5k8T827llEiNLEsVuijiebiXkpuOSqMCijnhL x1oY2u19sitPA8QIJy5m5Rr+Jo8VG+95Q4JI3F0BIxdhPoSE+cqtkJL6Z6Lh9t0KaiPD OZl6+lOl2vZy9qRHEZ7JeisPasQ2WWESbAeEWNDfdSvN0zuO03/TotBfr9bm2vVI1Gmd ewYAbEcMKJMt2tQ4k5qUB0urNMXm1xalXfgBzqTUtWbQkVVV55VvV+ZO3y2yXKRBIT0D I3+g== X-Gm-Message-State: AOAM533in0rKF9uy5V3vmdRx7wBbbiJxnu16WgeEGpzgqrneJlaBLxJW wpzFSPGvm0rUAnIQEWW/Xdlv6QOcPVxBnQ== X-Google-Smtp-Source: ABdhPJyrEEgxONkpU7BwLGEOtw38mRnKXL7G2lPTHZFW6ioP3OZaC1XpzqeHoVu7ZvpOAO3pVt1w4g== X-Received: by 2002:ac8:60c5:: with SMTP id i5mr3844377qtm.413.1633638839957; Thu, 07 Oct 2021 13:33:59 -0700 (PDT) Received: from localhost.localdomain ([37.218.244.251]) by smtp.gmail.com with ESMTPSA id p187sm374106qkd.101.2021.10.07.13.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 13:33:59 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH v3 0/4] Various fixes/improvements for tests Date: Thu, 7 Oct 2021 15:33:23 -0500 Message-Id: <20211007203327.159098-1-development@efficientek.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::82c; envelope-from=development@efficientek.com; helo=mail-qt1-x82c.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: Thu, 07 Oct 2021 20:34:04 -0000 In this update from the previous patch series, I've only included the patches which required changes, which were the previous patches 4 and 7. Patch 4 was broken up at the Daniel's request, also a little differently than requested. It is now the first 3 patches. I've also changed the patch slightly as can be seen in the interdiff, but its functionally equivalent to the previous patch. The first is just adding missing 'set -e' commands to turn on shell's errexit. The second move subshells containing grub-shell such that the output goes to a shell variable as opposed to input of another command, which occludes the exit code. The third fixes a different error code occlusion issue, where if grub-shell is not the last command in a pipeline its exit code will be ignored. Another way of preventing this is to use 'set -o pipefail' in bash, but this is not recognized in dash and perhaps other shells. The fourth patch is the same as the previous patch #7, except that a missing skip exit code for the test grub_cmd_sleep was added. Glenn Glenn Washburn (4): tests: Add set -e to missing tests tests: Do not occlude subshell error codes tests: Do not occlude grub-shell return code tests: Exit with skipped exit code when test not performed tests/ahci_test.in | 15 ++++++++++----- tests/cdboot_test.in | 11 ++++++----- tests/core_compress_test.in | 8 +++++--- tests/ehci_test.in | 15 ++++++++++----- tests/fddboot_test.in | 19 ++++++++++--------- tests/grub_cmd_date.in | 5 +++-- tests/grub_cmd_set_date.in | 6 +++--- tests/grub_cmd_sleep.in | 2 +- tests/grub_cmd_test.in | 1 + tests/grub_script_blockarg.in | 1 + tests/grub_script_expansion.in | 3 ++- tests/gzcompress_test.in | 3 ++- tests/hddboot_test.in | 9 +++++---- tests/lzocompress_test.in | 3 ++- tests/netboot_test.in | 15 ++++++++------- tests/ohci_test.in | 15 ++++++++++----- tests/partmap_test.in | 12 ++++++------ tests/pata_test.in | 9 +++++---- tests/pseries_test.in | 2 +- tests/test_sha512sum.in | 1 + tests/uhci_test.in | 15 ++++++++++----- tests/xzcompress_test.in | 3 ++- 22 files changed, 104 insertions(+), 69 deletions(-) Interdiff against v2: diff --git a/tests/ahci_test.in b/tests/ahci_test.in index 0e1c3679b..6d2e61d4e 100644 --- a/tests/ahci_test.in +++ b/tests/ahci_test.in @@ -41,11 +41,12 @@ echo "hello" > "$outfile" tar cf "$imgfile" "$outfile" -echo "nativedisk; source '(ahci0)/$outfile';" | +v=$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci - -device ide-hd,drive=disk,bus=ahci.0" >$outfile -if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then + -device ide-hd,drive=disk,bus=ahci.0") +v=$(echo "$v" | tail -n 1) +if [ "$v" != "Hello World" ]; then rm "$imgfile" rm "$outfile" exit 1 diff --git a/tests/ehci_test.in b/tests/ehci_test.in index bd80f93d4..df671b4b6 100644 --- a/tests/ehci_test.in +++ b/tests/ehci_test.in @@ -41,11 +41,12 @@ echo "hello" > "$outfile" tar cf "$imgfile" "$outfile" -echo "nativedisk; source '(usb0)/$outfile';" | +v=$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device ich9-usb-ehci1 -drive id=my_usb_disk,file=$imgfile,if=none - -device usb-storage,drive=my_usb_disk" >$outfile -if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then + -device usb-storage,drive=my_usb_disk") +v=$(echo "$v" | tail -n 1) +if [ "$v" != "Hello World" ]; then rm "$imgfile" rm "$outfile" exit 1 diff --git a/tests/grub_cmd_sleep.in b/tests/grub_cmd_sleep.in index 8797f6632..1a57fb388 100644 --- a/tests/grub_cmd_sleep.in +++ b/tests/grub_cmd_sleep.in @@ -5,7 +5,7 @@ set -e # FIXME: OpenBIOS on sparc64 doesn't implement RTC if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then - exit 0 + exit 77 fi # Compare RTC with interval timer. diff --git a/tests/grub_script_blockarg.in b/tests/grub_script_blockarg.in index 6d63a345a..a91c7ca82 100644 --- a/tests/grub_script_blockarg.in +++ b/tests/grub_script_blockarg.in @@ -1,4 +1,5 @@ -#! @BUILD_SHEBANG@ -e +#! @BUILD_SHEBANG@ +set -e # Run GRUB script in a Qemu instance # Copyright (C) 2010 Free Software Foundation, Inc. diff --git a/tests/ohci_test.in b/tests/ohci_test.in index 105220856..741ad881f 100644 --- a/tests/ohci_test.in +++ b/tests/ohci_test.in @@ -41,11 +41,12 @@ echo "hello" > "$outfile" tar cf "$imgfile" "$outfile" -echo "nativedisk; source '(usb0)/$outfile';" | +v=$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device pci-ohci -drive id=my_usb_disk,file=$imgfile,if=none - -device usb-storage,drive=my_usb_disk" >$outfile -if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then + -device usb-storage,drive=my_usb_disk") +v=$(echo "$v" | tail -n 1) +if [ "$v" != "Hello World" ]; then rm "$imgfile" rm "$outfile" exit 1 diff --git a/tests/uhci_test.in b/tests/uhci_test.in index 2984283c0..5aa5eb726 100644 --- a/tests/uhci_test.in +++ b/tests/uhci_test.in @@ -41,11 +41,12 @@ echo "hello" > "$outfile" tar cf "$imgfile" "$outfile" -echo "nativedisk; source '(usb0)/$outfile';" | +v=$(echo "nativedisk; source '(usb0)/$outfile';" | "${grubshell}" --qemu-opts="-device ich9-usb-uhci1 -drive id=my_usb_disk,file=$imgfile,if=none - -device usb-storage,drive=my_usb_disk" >$outfile -if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then + -device usb-storage,drive=my_usb_disk") +v=$(echo "$v" | tail -n 1) +if [ "$v" != "Hello World" ]; then rm "$imgfile" rm "$outfile" exit 1 -- 2.27.0