Skip to contentSkip to conversation

Gitlab CI and test framework improvements

PATCH New Glenn Washburn 1 participant 18 messages Feb 19, 2021

lore
Share & tools
lore
#0 lore raw

cover Gitlab CI and test framework improvements

This patch series is divided into roughly three sections: modifications of tests, improvements to grub-shell, and the CI patch itself. I have other improvements to testing coming, but I consider these more essential to the quality of the CI tests, or highly desirable. Aside from modification of qemu firmware paths to make them more generic, the changes should not be visible to current testers.

The CI change is the addition of a .gitlab-ci.yml file which is the GitLab specific CI config file and a .ci directory with scripts used by the CI config. The scripts in the .ci dir are meant to be generic and thus usable by other CI platforms. There is probably more that can be pulled out of the .gitlab-ci.yml file for use in common with other CI configs, but I decided those can be pulled out as needed.

The successful CI run can be viewed here:
https://gitlab.com/gnu-grub/grub/-/pipelines/258485608

Glenn

Glenn Washburn (17):
tests: Make sure LANG is set properly for iso9660_test
tests: Fix partmap_test for arm*-efi, disk numbering has changed
tests: When checking squashfs fstime, use superblock last modified
time
tests: Fail immediately when grub-shell fails and do not occlude the
error code
grub-shell: Allow specifying non-default trim line contents
grub-shell: Trim line should always be matched from the beginning of
the line
grub-shell: Only show grub-mkrescue output if it returns an error
grub-shell: Allow setting default timeout via
GRUB_SHELL_DEFAULT_TIMEOUT envvar
grub-shell: Put all generated files into working dir and use better
file names
grub-shell: Add grub output logfile with grub-shell --debug
grub-shell: Set exit status to qemu exit status
tests: Allow turning on shell tracing from environment variables
grub-shell: Add --verbose to mkrescue when $debug is greater than 2
grub-shell: Use malta qemu-mips machine type instead off non-existant
indy
grub-shell: Update qemu UEFI firmware names to be more generic
ci: Add .gitlab-ci.yml for continuous integration with Gitlab CI
keep: remove a lot of cruft that we probably want to reuse at some
point

 .ci/build.sh                   |  56 +++
 .ci/functions.gitlab.sh        |  30 ++
 .ci/functions.sh               |  30 ++
 .ci/make-images.sh             |  71 ++++
 .ci/process-tests.sh           |  97 +++++
 .ci/test.sh                    |  98 +++++
 .gitlab-ci.yml                 | 632 +++++++++++++++++++++++++++++++++
 tests/ahci_test.in             |   6 +-
 tests/cdboot_test.in           |   3 +-
 tests/core_compress_test.in    |   6 +-
 tests/ehci_test.in             |   6 +-
 tests/fddboot_test.in          |   3 +-
 tests/grub_cmd_date.in         |   3 +-
 tests/grub_cmd_test.in         |   1 +
 tests/grub_script_blockarg.in  |   2 +-
 tests/grub_script_expansion.in |   3 +-
 tests/gzcompress_test.in       |   3 +-
 tests/hddboot_test.in          |   3 +-
 tests/iso9660_test.in          |   6 +
 tests/lzocompress_test.in      |   3 +-
 tests/netboot_test.in          |   3 +-
 tests/ohci_test.in             |   6 +-
 tests/partmap_test.in          |   6 +-
 tests/pata_test.in             |   3 +-
 tests/test_sha512sum.in        |   1 +
 tests/uhci_test.in             |   6 +-
 tests/util/grub-fs-tester.in   |   8 +
 tests/util/grub-shell.in       |  87 +++--
 tests/xzcompress_test.in       |   3 +-
 29 files changed, 1138 insertions(+), 47 deletions(-)
 create mode 100755 .ci/build.sh
 create mode 100644 .ci/functions.gitlab.sh
 create mode 100644 .ci/functions.sh
 create mode 100755 .ci/make-images.sh
 create mode 100755 .ci/process-tests.sh
 create mode 100755 .ci/test.sh
 create mode 100644 .gitlab-ci.yml
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/17 tests: Make sure LANG is set properly for iso9660_test

LANG must be set to something that supports international characters, otherwise xorriso will refuse to include the file with name having international characters, causing the test to fail. So if LANG is not set, set it to en_US.UTF-8, a very common UTF-8 locale. And if it is set, but does not look like a UTF-8 locale, print a warning so the user will have a clue as to why the iso9660_test might be failing.

---
 tests/iso9660_test.in | 6 ++++++
 1 file changed, 6 insertions(+)
tests/iso9660_test.in +6 -0
index 571b938d7..37b1d30af 100644
@@ -7,6 +7,12 @@ if ! which xorriso >/dev/null 2>&1; then
    exit 77
 fi
 
+if [ -z "$LANG" ]; then
+   export LANG=en_US.UTF-8
+elif [ -n "${LANG##*UTF*}" ]; then
+   echo "WARNING: LANG=$LANG appears to not be unicode, international file test may fail."
+fi
+
 "@builddir@/grub-fs-tester" joliet
 "@builddir@/grub-fs-tester" rockridge
 "@builddir@/grub-fs-tester" rockridge_joliet
Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/17 tests: Fix partmap_test for arm*-efi, disk numbering has changed

In reply to Glenn Washburn

Perhaps using a newer UEFI firmware is the reason for the created test disk showing up as hd2 instead of hd3.

---
 tests/partmap_test.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/partmap_test.in +1 -1
index 6ef518b0a..7353dc70e 100644
@@ -89,7 +89,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	disk=arc/scsi0/disk0/rdisk0
 	;;
     arm*-efi)
-	disk=hd3
+	disk=hd2
 	;;
     *)
 	disk=hd0
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/17 tests: When checking squashfs fstime, use superblock last modified time

In reply to Glenn Washburn

Currently, the filesystem timestamp check in grub-fs-tester uses the squashfs image file's last modified timestamp and checks to see if that time stamp is within 3 seconds of the superblock timestamp as determined by grub. The image file's timestamp could be more than 3 seconds off if mksquashfs takes more than 3 seconds to generate the image, as is the case on a low power machine. Instead use squashfs tools to get the filesystem timestamp directly.

---
 tests/util/grub-fs-tester.in | 6 ++++++
 1 file changed, 6 insertions(+)
tests/util/grub-fs-tester.in +6 -0
index bfc425e1f..4213b7bfc 100644
@@ -1351,6 +1351,12 @@ for LOGSECSIZE in $(range "$MINLOGSECSIZE" "$MAXLOGSECSIZE" 1); do
 			# With some abstractions like mdraid flushing to disk
 			# may be delayed for a long time.
 			FSTIME="$UMOUNT_TIME";;
+		    xsquash*)
+			# Creating the squash image may take more than a few
+			# seconds. Use the more accurate timestamp from the
+			# superblock.
+			FSTIME="$(unsquashfs -s "${FSIMAGEP}0.img" | grep ^Creation | awk '{print $6 " " $7 " " $8 " " $9 " " $10; }')"
+			FSTIME="$(date -d "$FSTIME" -u '+%Y-%m-%d %H:%M:%S')";;
 		    *)
 			FSTIME="$(TZ=UTC ls --time-style="+%Y-%m-%d_%H:%M:%S" -l -d "${FSIMAGEP}0.img"|awk '{print $6; }'|sed 's,_, ,g')";;
 		esac
Signature · 1 line
2.27.0
#4 lore raw

PATCH 4/17 tests: Fail immediately when grub-shell fails and do not occlude the error code

In reply to Glenn Washburn

If grub-shell fails, that means that whatever was being tested was not actually tested. So fail immediately. Sometimes grub-shell is not the last command in a pipeline of several commands, and in this case the failed error code can be hidden by a later failing command or hidden when 'set -e' is not set and there are subsequent successful commands. When the test script fails because of a failure in grub-shell, then test script should exit with the failed exit code of grub-shell.

---
 tests/ahci_test.in             | 6 +++++-
 tests/cdboot_test.in           | 3 ++-
 tests/core_compress_test.in    | 6 ++++--
 tests/ehci_test.in             | 6 +++++-
 tests/fddboot_test.in          | 3 ++-
 tests/grub_cmd_date.in         | 3 ++-
 tests/grub_cmd_test.in         | 1 +
 tests/grub_script_blockarg.in  | 2 +-
 tests/grub_script_expansion.in | 3 ++-
 tests/gzcompress_test.in       | 3 ++-
 tests/hddboot_test.in          | 3 ++-
 tests/lzocompress_test.in      | 3 ++-
 tests/netboot_test.in          | 3 ++-
 tests/ohci_test.in             | 6 +++++-
 tests/partmap_test.in          | 4 ++--
 tests/pata_test.in             | 3 ++-
 tests/test_sha512sum.in        | 1 +
 tests/uhci_test.in             | 6 +++++-
 tests/xzcompress_test.in       | 3 ++-
 19 files changed, 49 insertions(+), 19 deletions(-)
tests/ahci_test.in +5 -1
index 7df560462..3fb7f54a2 100644
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(echo "nativedisk; source '(ahci0)/$outfile';" | "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0 " | tail -n 1)" != "Hello World" ]; then
+echo "nativedisk; source '(ahci0)/$outfile';" |
+    "${grubshell}" --qemu-opts="-drive id=disk,file=$imgfile,if=none
+				-device ahci,id=ahci
+				-device ide-drive,drive=disk,bus=ahci.0" >$outfile
+if [ "$(cat "$outfile" | tail -n 1)" != "Hello World" ]; then
    rm "$imgfile"
    rm "$outfile"
    exit 1
tests/cdboot_test.in +2 -1
index 75acdfedb..7229f79fb 100644
@@ -34,6 +34,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=cd)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=cd`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
tests/core_compress_test.in +4 -2
index 9d216ebcf..90dd00607 100644
@@ -27,10 +27,12 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 esac
 
 
-if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=xz)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --grub-mkimage-extra=--compress=xz`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
 
-if [ "$(echo hello | "${grubshell}" --grub-mkimage-extra=--compress=none)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --grub-mkimage-extra=--compress=none`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
tests/ehci_test.in +5 -1
index b197f8cdc..64bd80070 100644
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(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" | tail -n 1)" != "Hello World" ]; then
+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
    rm "$imgfile"
    rm "$outfile"
    exit 1
tests/fddboot_test.in +2 -1
index 2d7dfc889..1bbe60ee5 100644
@@ -46,6 +46,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad")" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=fd --mkrescue-arg="--compress=xz --fonts= --locales= --themes= -no-pad"`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
tests/grub_cmd_date.in +2 -1
index f7c9ca004..f9156691e 100644
@@ -9,7 +9,8 @@ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ];
 fi
 
 pdt="$(date -u +%s)"
-dt=`echo date | @builddir@/grub-shell | sed 's, [A-Z][a-z]*$,,'`
+dt=`echo date | @builddir@/grub-shell`
+dt=`echo "$dt" | sed 's, [A-Z][a-z]*$,,'`
 dtg="$(date -u -d "$dt" +%s)"
 ndt="$(date -u +%s)"
 
tests/grub_cmd_test.in +1 -0
index 3399eb292..dac6f7d6a 100644
@@ -1,4 +1,5 @@
 #! @BUILD_SHEBANG@
+set -e
 
 # create a randome file
 empty="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
tests/grub_script_blockarg.in +1 -1
index 6ea9b8c3d..6152cc141 100644
@@ -1,4 +1,4 @@
-#! @BUILD_SHEBANG@
+#! @BUILD_SHEBANG@ -e
 
 # Run GRUB script in a Qemu instance
 # Copyright (C) 2010  Free Software Foundation, Inc.
tests/grub_script_expansion.in +2 -1
index 9d0dcdd29..98d5a9068 100644
@@ -17,7 +17,8 @@ set -e
 # You should have received a copy of the GNU General Public License
 # along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
-disks=`echo ls | @builddir@/grub-shell| grep -av '^Network protocols:$'| grep -av '^tftp http $'`
+disks=`echo ls | @builddir@/grub-shell`
+disks=`echo "$disks"| grep -av '^Network protocols:$'| grep -av '^tftp http $'`
 other=`echo insmod regexp\; echo \* | @builddir@/grub-shell`
 for d in $disks; do
     if echo "$d" |grep ',' >/dev/null; then
tests/gzcompress_test.in +2 -1
index 42c8fe7c4..572b2a1a5 100644
@@ -24,6 +24,7 @@ if ! which gzip >/dev/null 2>&1; then
    exit 77
 fi
 
-if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=gz)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --mkrescue-arg=--compress=gz`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
tests/hddboot_test.in +2 -1
index 6d70847a5..abe3e0ae1 100644
@@ -31,7 +31,8 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=hd)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=hd`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
 
tests/lzocompress_test.in +2 -1
index 4e5f7e078..8f08a8046 100644
@@ -24,6 +24,7 @@ if ! which lzop >/dev/null 2>&1; then
    exit 77
 fi
 
-if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --mkrescue-arg=--compress=lzo`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
tests/netboot_test.in +2 -1
index 9f71e3d88..6a1d95a22 100644
@@ -40,6 +40,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	exit 0;;
 esac
 
-if [ "$(echo hello | "${grubshell}" --boot=net)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --boot=net`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
tests/ohci_test.in +5 -1
index 8693f8c47..cc35f67a9 100644
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(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" | tail -n 1)" != "Hello World" ]; then
+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
    rm "$imgfile"
    rm "$outfile"
    exit 1
tests/partmap_test.in +2 -2
index 7353dc70e..5f18ab51c 100644
@@ -58,8 +58,8 @@ list_parts () {
     shift
 
     echo ls | "${grubshell}" --disk="${imgfile}" \
-	--modules=$mod | tr -d "\n\r" > "${outfile}"
-    cat "${outfile}"
+	--modules=$mod > "${outfile}"
+    cat "${outfile}" | tr -d "\n\r"
     echo
 }
 
tests/pata_test.in +2 -1
index 4b18fdef3..3d19cecde 100644
@@ -45,7 +45,8 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(echo "nativedisk; source '($indisk)/$outfile';" | "${grubshell}" --qemu-opts="-$disk $imgfile")" != "Hello World" ]; then
+v=`echo "nativedisk; source '($indisk)/$outfile';" | "${grubshell}" --qemu-opts="-$disk $imgfile"`
+if [ "$v" != "Hello World" ]; then
    rm "$imgfile"
    rm "$outfile"
    exit 1
tests/test_sha512sum.in +1 -0
index 027092a8b..d97b7ae2c 100644
@@ -1,4 +1,5 @@
 #! @BUILD_SHEBANG@
+set -e
 
 # create a randome file
 file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
tests/uhci_test.in +5 -1
index f0eec5032..6aab10ba6 100644
@@ -41,7 +41,11 @@ echo "hello" > "$outfile"
 
 tar cf "$imgfile" "$outfile"
 
-if [ "$(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" | tail -n 1)" != "Hello World" ]; then
+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
    rm "$imgfile"
    rm "$outfile"
    exit 1
tests/xzcompress_test.in +2 -1
index 03bfb5e95..61acba33b 100644
@@ -24,6 +24,7 @@ if ! which xz >/dev/null 2>&1; then
    exit 77
 fi
 
-if [ "$(echo hello | "${grubshell}" --mkrescue-arg=--compress=xz)" != "Hello World" ]; then
+v=`echo hello | "${grubshell}" --mkrescue-arg=--compress=xz`
+if [ "$v" != "Hello World" ]; then
    exit 1
 fi
Signature · 1 line
2.27.0
#5 lore raw

PATCH 5/17 grub-shell: Allow specifying non-default trim line contents

In reply to Glenn Washburn

This will be useful for tests that have unwanted output from setup. This is not documented because its only intended to be internal at the moment. Also, --no-trim is allowed to explicitly turn off trim.

---
 tests/util/grub-shell.in | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
tests/util/grub-shell.in +9 -5
index 93e9f5148..b409962f1 100644
@@ -32,6 +32,7 @@ PATH="${builddir}:$PATH"
 export PATH
 
 trim=0
+trim_head=664cbea8-132f-4770-8aa4-1696d59ac35c
 
 # Usage: usage
 # Print the usage.
@@ -212,8 +213,13 @@ for option in "$@"; do
 	echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
 	exit 0 ;;
     --trim)
-	trim=1
+	trim=1 ;;
+    --trim=*)
+	trim=2
+	trim_head=`echo "$option" | sed -e 's/--trim=//' -e 's/,/ /g'`
 	;;
+    --no-trim)
+	trim=0 ;;
     --debug)
         debug=1 ;;
     --modules=*)
@@ -336,8 +342,6 @@ terminal_input ${term}
 terminal_output ${term}
 EOF
 
-trim_head=664cbea8-132f-4770-8aa4-1696d59ac35c
-
 if [ $trim = 1 ]; then
     echo "echo $trim_head" >>${cfgfile}
 fi
@@ -452,8 +456,8 @@ fi
 
 do_trim ()
 {
-    if [ $trim = 1 ]; then
-	awk '{ if (have_head == 1) print $0; } /664cbea8-132f-4770-8aa4-1696d59ac35c/ { have_head=1; }'
+    if [ $trim = 1 ] || [ $trim = 2 ]; then
+	awk '{ if (have_head == 1) print $0; } /'"$trim_head"'/ { have_head=1; }'
     else
 	cat
     fi
Signature · 1 line
2.27.0
#6 lore raw

PATCH 6/17 grub-shell: Trim line should always be matched from the beginning of the line

In reply to Glenn Washburn

When turning on shell tracing the trim line will be output before we actually want to start the trim. However, in this case the trim line never starts from the beginning of the line. So start trimming from the correct line by matching from the beginning of the line.

---
 tests/util/grub-shell.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/util/grub-shell.in +2 -2
index b409962f1..602b16f3e 100644
@@ -343,7 +343,7 @@ terminal_output ${term}
 EOF
 
 if [ $trim = 1 ]; then
-    echo "echo $trim_head" >>${cfgfile}
+    echo "echo; echo $trim_head" >>${cfgfile}
 fi
 
 rom_directory=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
@@ -457,7 +457,7 @@ fi
 do_trim ()
 {
     if [ $trim = 1 ] || [ $trim = 2 ]; then
-	awk '{ if (have_head == 1) print $0; } /'"$trim_head"'/ { have_head=1; }'
+	awk '{ if (have_head == 1) print $0; } /^'"$trim_head"'/ { have_head=1; }'
     else
 	cat
     fi
Signature · 1 line
2.27.0
#7 lore raw

PATCH 7/17 grub-shell: Only show grub-mkrescue output if it returns an error

In reply to Glenn Washburn

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.

---
 tests/util/grub-shell.in | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
tests/util/grub-shell.in +15 -2
index 602b16f3e..9d8c417da 100644
@@ -60,6 +60,17 @@ Report bugs to <[email protected]>.
 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
Signature · 1 line
2.27.0
#8 lore raw

PATCH 8/17 grub-shell: Allow setting default timeout via GRUB_SHELL_DEFAULT_TIMEOUT envvar

In reply to Glenn Washburn
---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-shell.in +1 -1
index 9d8c417da..e80471126 100644
@@ -211,7 +211,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	console=console;;
 esac
 
-timeout=60
+timeout=${GRUB_SHELL_DEFAULT_TIMEOUT:-60}
 mkimage_extra_arg=
 
 # Check the arguments.
Signature · 1 line
2.27.0
#9 lore raw

PATCH 9/17 grub-shell: Put all generated files into working dir and use better file names

In reply to Glenn Washburn

When running tests there are many invocations of grub-shell, and because the output files are all random names in the same tmp directory, it becomes more work to figure out which files went with which grub-shell invocations. So all generated files from one invocation of grub-shell are put into a randomly named directory, so as not to collide with other grub-shell invocations. And now that the generated files can be put in a location where they will not get stepped on, and they can be named sensible names.

---
 tests/util/grub-shell.in | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
tests/util/grub-shell.in +13 -9
index e80471126..8c6ed76d7 100644
@@ -71,6 +71,8 @@ exec_show_error () {
     fi
 }
 
+work_directory=${WORKDIR:-`mktemp -d "${TMPDIR:-/tmp}/grub-shell.XXXXXXXXXX"`} || exit 1
+
 . "${builddir}/grub-core/modinfo.sh"
 qemuopts="${GRUB_QEMU_OPTS}"
 serial_port=com0
@@ -80,7 +82,7 @@ pseries=n
 disk="hda "
 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     *-emu)
-	device_map=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+	device_map="$work_directory/device.map"
 	boot=emu
 	console=console
 	disk=0
@@ -318,14 +320,14 @@ for option in "$@"; do
 done
 
 if [ "x${source}" = x ] ; then
-    tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+    tmpfile="$work_directory/testcase.cfg"
     while read REPLY; do
 	echo "$REPLY" >> ${tmpfile}
     done
     source=${tmpfile}
 fi
 
-cfgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+cfgfile="$work_directory/grub.cfg"
 cat <<EOF >${cfgfile}
 grubshell=yes
 enable_progress_indicator=0
@@ -357,7 +359,8 @@ if [ $trim = 1 ]; then
     echo "echo; echo $trim_head" >>${cfgfile}
 fi
 
-rom_directory=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+rom_directory="$work_directory/rom_directory"
+mkdir -p "$rom_directory"
 
 for mod in ${modules}
 do
@@ -378,7 +381,7 @@ test -z "$debug" || echo "GRUB script: ${cfgfile}" >&2
 test -z "$debug" || echo "GRUB testcase script: ${tmpfile}" >&2
 test -z "$debug" || echo "Boot device: ${boot}" >&2
 
-isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+isofile="$work_directory/grub.iso"
 test -z "$debug" || echo "GRUB ISO file: ${isofile}" >&2
 test -z "$debug" || echo "GRUB ROM directory: ${rom_directory}" >&2
 
@@ -450,7 +453,7 @@ if [ x$boot = xmips_qemu ]; then
 fi
 
 if [ x$boot = xcoreboot ]; then
-    imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+    imgfile="$work_directory/coreboot.img"
     cp "${GRUB_COREBOOT_ROM}" "${imgfile}"
     "${GRUB_CBFSTOOL}" "${imgfile}" add-payload -f "${rom_directory}/coreboot.elf" -n fallback/payload
     bootdev="-bios ${imgfile}"
@@ -493,14 +496,15 @@ copy_extra_files() {
 }
 
 if [ x$boot = xnet ]; then
-    netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
+    netdir="$work_directory/netdir"
+    mkdir -p "$netdir"
     pkgdatadir="@builddir@" "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null
     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" | do_trim
 elif [ x$boot = xemu ]; then
-    rootdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")"
+    rootdir="$work_directory/rootdir"
     grubdir="$rootdir/boot/grub"
     mkdir -p "$grubdir/fonts"
     mkdir -p "$grubdir/themes"
@@ -515,7 +519,7 @@ elif [ x$boot = xemu ]; then
     cp "${cfgfile}" "$grubdir/grub.cfg"
     cp "${source}" "$grubdir/testcase.cfg"
     [ -z "$files" ] || copy_extra_files "$rootdir" $files
-    roottar="$(mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")"
+    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" | do_trim
     test -n "$debug" || rm -rf "$rootdir"
Signature · 1 line
2.27.0
#10 lore raw

PATCH 10/17 grub-shell: Add grub output logfile with grub-shell --debug

In reply to Glenn Washburn

This allows seeing full qemu output of grub-shell, which can be invaluable when debugging failing tests.

---
 tests/util/grub-shell.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tests/util/grub-shell.in +6 -3
index 8c6ed76d7..c6d7860e9 100644
@@ -379,6 +379,9 @@ echo "${halt_cmd}" >>${cfgfile}
 
 test -z "$debug" || echo "GRUB script: ${cfgfile}" >&2
 test -z "$debug" || echo "GRUB testcase script: ${tmpfile}" >&2
+
+goutfile="$work_directory/grub-qemu.log"
+test -z "$debug" || echo "GRUB output log: ${goutfile}" >&2
 test -z "$debug" || echo "Boot device: ${boot}" >&2
 
 isofile="$work_directory/grub.iso"
@@ -502,7 +505,7 @@ 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" | do_trim
+    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
 elif [ x$boot = xemu ]; then
     rootdir="$work_directory/rootdir"
     grubdir="$rootdir/boot/grub"
@@ -521,11 +524,11 @@ 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" | do_trim
+    @builddir@/grub-core/grub-emu -m "$device_map" --memdisk "$roottar" -r memdisk -d "/boot/grub" | tr -d "\r" | tee "${goutfile}" | do_trim
     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" | do_trim
+    timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} | cat | tr -d "\r" | tee "${goutfile}" | do_trim
 fi
 if [ x$boot = xcoreboot ]; then
     test -n "$debug" || rm -f "${imgfile}"
Signature · 1 line
2.27.0
#11 lore raw

PATCH 11/17 grub-shell: Set exit status to qemu exit status

In reply to Glenn Washburn

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.

---
 tests/util/grub-shell.in | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tests/util/grub-shell.in +8 -4
index c6d7860e9..40c62b9fd 100644
@@ -498,6 +498,9 @@ copy_extra_files() {
     done
 }
 
+ret=0
+mkfifo "$work_directory/qemu-pipe"
+cat < "$work_directory/qemu-pipe" | tr -d "\r" | tee "${goutfile}" | do_trim &
 if [ x$boot = xnet ]; then
     netdir="$work_directory/netdir"
     mkdir -p "$netdir"
@@ -505,7 +508,7 @@ 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
+    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,11 +527,11 @@ 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
+    @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
+    timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -${device}"${isofile}" ${bootdev} > "$work_directory/qemu-pipe" || ret=$?
 fi
 if [ x$boot = xcoreboot ]; then
     test -n "$debug" || rm -f "${imgfile}"
@@ -536,6 +539,7 @@ fi
 test -n "$debug" || rm -f "${isofile}"
 test -n "$debug" || rm -rf "${rom_directory}"
 test -n "$debug" || rm -f "${tmpfile}" "${cfgfile}"
-exit 0
+rm -f "$work_directory/qemu-pipe"
+exit $ret
 
 
Signature · 1 line
2.27.0
#12 lore raw

PATCH 12/17 tests: Allow turning on shell tracing from environment variables

In reply to Glenn Washburn

This allows turning on shell tracing when its not practical or not possible to use commandline arguments. Turn on tracing when the envvar is an integer greater than 1, since these can log a lot of messages.

---
 tests/util/grub-fs-tester.in | 2 ++
 tests/util/grub-shell.in     | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
tests/util/grub-fs-tester.in +2 -0
index 4213b7bfc..9a5f409e9 100644
@@ -2,6 +2,8 @@
 
 set -e
 
+[ "${GRUB_TEST_DEFAULT_DEBUG:-0}" -gt 1 ] && set -x
+
 fs="$1"
 
 GRUBFSTEST="@builddir@/grub-fstest"
tests/util/grub-shell.in +4 -1
index 40c62b9fd..3b6bce4c2 100644
@@ -215,6 +215,7 @@ esac
 
 timeout=${GRUB_SHELL_DEFAULT_TIMEOUT:-60}
 mkimage_extra_arg=
+debug=${GRUB_SHELL_DEFAULT_DEBUG}
 
 # Check the arguments.
 for option in "$@"; do
@@ -234,7 +235,7 @@ for option in "$@"; do
     --no-trim)
 	trim=0 ;;
     --debug)
-        debug=1 ;;
+        debug=$((debug+1)) ;;
     --modules=*)
 	ms=`echo "$option" | sed -e 's/--modules=//' -e 's/,/ /g'`
 	modules="$modules $ms" ;;
@@ -319,6 +320,8 @@ for option in "$@"; do
     esac
 done
 
+[ "${debug:-0}" -gt 1 ] && set -x
+
 if [ "x${source}" = x ] ; then
     tmpfile="$work_directory/testcase.cfg"
     while read REPLY; do
Signature · 1 line
2.27.0
#13 lore raw

PATCH 13/17 grub-shell: Add --verbose to mkrescue when $debug is greater than 2

In reply to Glenn Washburn
---
 tests/util/grub-shell.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/util/grub-shell.in +3 -1
index 3b6bce4c2..211bfdb95 100644
@@ -404,7 +404,9 @@ fi
 
 if [ x$boot != xnet ] && [ x$boot != xemu ]; then
     pkgdatadir="@builddir@" \
-    exec_show_error "@builddir@/grub-mkrescue" "--output=${isofile}" \
+    exec_show_error "@builddir@/grub-mkrescue" \
+	${debug:+$([ "$debug" -gt 2 ] && echo -n "--verbose")} \
+	"--output=${isofile}" \
 	"--override-directory=${builddir}/grub-core" \
 	--rom-directory="${rom_directory}" \
 	--locale-directory="@srcdir@/po" \
Signature · 1 line
2.27.0
#14 lore raw

PATCH 14/17 grub-shell: Use malta qemu-mips machine type instead off non-existant indy

In reply to Glenn Washburn
---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-shell.in +1 -1
index 211bfdb95..332fae704 100644
@@ -119,7 +119,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
     mips-arc)
 	boot=cd
 	qemu=qemu-system-mips64
-	qemuopts="-M indy $qemuopts"
+	qemuopts="-M malta $qemuopts"
 	serial_port=arc/serial0/line0
 	console=
 	trim=1
Signature · 1 line
2.27.0
#15 lore raw

PATCH 15/17 grub-shell: Update qemu UEFI firmware names to be more generic

In reply to Glenn Washburn

The current qemu firmware paths for arm-efi and arm64-efi are hardcoded and not available on Ubuntu/Debian. Make these paths relative and basenames generic. The idea is that regardless where or what names firmware images are installed under they can be copied and renamed into a temporary directory. Then use the -L argument to qemu to point to that directory.

For convenience, the GRUB source directory which build grub-shell will be added to the list of firmware paths that qemu will search. So all that is needed is to copy the firmwares to the source directory with potential renames.

---
 tests/util/grub-shell.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/util/grub-shell.in +3 -3
index 332fae704..33d39d4dd 100644
@@ -74,7 +74,7 @@ exec_show_error () {
 work_directory=${WORKDIR:-`mktemp -d "${TMPDIR:-/tmp}/grub-shell.XXXXXXXXXX"`} || exit 1
 
 . "${builddir}/grub-core/modinfo.sh"
-qemuopts="${GRUB_QEMU_OPTS}"
+qemuopts="${GRUB_QEMU_OPTS} -L ${srcdir}"
 serial_port=com0
 serial_null=
 halt_cmd=halt
@@ -194,7 +194,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	boot=hd
 	console=console
 	trim=1
-	qemuopts="-machine virt -cpu cortex-a57 -bios /usr/share/qemu-efi/QEMU_EFI.fd $qemuopts"
+	qemuopts="-machine virt -cpu cortex-a57 -bios OVMF-aarch64.fd $qemuopts"
 	disk="device virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
 	serial_port=
 	;;
@@ -203,7 +203,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	boot=hd
 	console=console
 	trim=1
-	qemuopts="-machine virt -bios /usr/share/ovmf-arm/QEMU_EFI.fd $qemuopts"
+	qemuopts="-machine virt -bios OVMF-arm.fd $qemuopts"
 	disk="device virtio-blk-device,drive=hd1 -drive if=none,id=hd1,file="
 	serial_port=efi0
 	;;
Signature · 1 line
2.27.0
#16 lore raw

PATCH 16/17 ci: Add .gitlab-ci.yml for continuous integration with Gitlab CI

In reply to Glenn Washburn
---
 .ci/build.sh            |   66 +++
 .ci/functions.gitlab.sh |   30 +
 .ci/functions.sh        |   30 +
 .ci/make-images.sh      |   71 +++
 .ci/process-tests.sh    |  108 ++++
 .ci/test.sh             |  106 ++++
 .gitlab-ci.yml          | 1184 +++++++++++++++++++++++++++++++++++++++
 7 files changed, 1595 insertions(+)
 create mode 100755 .ci/build.sh
 create mode 100644 .ci/functions.gitlab.sh
 create mode 100644 .ci/functions.sh
 create mode 100755 .ci/make-images.sh
 create mode 100755 .ci/process-tests.sh
 create mode 100755 .ci/test.sh
 create mode 100644 .gitlab-ci.yml
.ci/build.sh new file +66 -0
new file mode 100755
index 000000000..14dd7f7c5
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+set -eo pipefail
+
+# Environment variables
+# JOBS: Number of concurrent jobs while building, defaults to number of
+#   processors plus 1, unless number of processors is 1 in which case its 1.
+# SRCDIR: Path to source files
+# BUILDDIR: Directory in which to place the build
+# INSTALLDIR: Directory to install binaries
+# ARCH: Architecture to build for
+# PLATFORM: Platform to build for
+# CONFIGURE_OPTS: Extra configure options
+# SHELL_TRACE: Set to 'y' to enable shell tracing
+
+[ "x${SHELL_TRACE}" = "xy" ] && set -x
+
+[ -f "$(dirname "$0")/functions.sh" ] &&
+. "$(dirname "$0")/functions.sh"
+
+[ -f "$(dirname "$0")/functions.$CI_TYPE.sh" ] &&
+. "$(dirname "$0")/functions.$CI_TYPE.sh"
+
+JOBS=${JOBS:-`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 1`};
+[ "$JOBS" == 1 ] || JOBS=$(($JOBS + 1));
+
+TARGET="${ARCH}-${PLATFORM}"
+
+mkdir -pv ${BUILDDIR};
+
+RET=0;
+cd ${BUILDDIR};
+
+# echo -e "#!$SHELL\nREAL_SHELL=\${REAL_SHELL:-\$(readlink /proc/\$\$/exe)}\nexec \$REAL_SHELL \$SHELL_OPTS \"\$@\"" >${BUILDDIR}/shell-wrapper.sh;
+# cat <<EOF >${BUILDDIR}/shell-wrapper.sh
+# #!$SHELL
+# REAL_SHELL=\${REAL_SHELL:-$(readlink /proc/\$\$/exe)}
+# exec \$REAL_SHELL \$SHELL_OPTS \"\$@\"
+# EOF
+
+# chmod +x ${BUILDDIR}/shell-wrapper.sh;
+# export CONFIG_SHELL=${BUILDDIR}/shell-wrapper.sh;
+
+start_log -c -n "configure-$TARGET" "Configuring $TARGET";
+ls -la $SRCDIR;
+[ -x "$SRCDIR/configure" ] && $SRCDIR/configure --help;
+$SRCDIR/configure --target=$ARCH --with-platform=$PLATFORM \
+  --prefix=${INSTALLDIR} $CONFIGURE_OPTS || RET=$?;
+end_log -n "configure-$TARGET";
+
+if [ "$RET" -ne 0 ]; then
+  start_log -c -n "showlogs-$TARGET" "Configuring $TARGET failed, showing logs";
+  cat ${BUILDDIR}/config.log;
+  end_log -n "showlogs-$TARGET";
+  exit $RET;
+fi;
+
+start_log -c -n "build-$TARGET" "Building $TARGET";
+make -j$JOBS || RET=$?;
+end_log -n "build-$TARGET";
+[ "$RET" -ne 0 ] && exit $RET;
+
+start_log -c -n "install-$TARGET" "Installing $TARGET";
+make -j$JOBS install || RET=$?;
+end_log -n "install-$TARGET";
+exit $RET;
\ No newline at end of file
.ci/functions.gitlab.sh new file +30 -0
new file mode 100644
index 000000000..e9cd2f9be
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+TXT_RED="\e[31m"
+TXT_YELLOW="\e[33m"
+TXT_CLEAR="\e[0m"
+
+function start_log() {
+  while [ "$#" -gt 0 ]; do
+    case "$1" in
+      -c) LOG_COLLAPSE=1; shift;;
+      -n) LOG_NAME="$2"; shift;;
+      *) [ "$#" -eq 1 ] && LOG_MSG="$1"; shift;;
+    esac
+  done
+
+  echo -e "section_start:`date +%s`:${LOG_NAME}${LOG_COLLAPSE:+[collapsed=true]}\r\e[0K${LOG_MSG}"
+}
+
+function end_log() {
+  while [ "$#" -gt 0 ]; do
+    case "$1" in
+      -n) LOG_NAME=$2; shift;;
+      *) shift;;
+    esac
+  done
+
+  echo -e "section_end:`date +%s`:${LOG_NAME}\r\e[0K"
+}
+
+:;
.ci/functions.sh new file +30 -0
new file mode 100644
index 000000000..bba33fb5f
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+TXT_RED="\e[31m"
+TXT_YELLOW="\e[33m"
+TXT_CLEAR="\e[0m"
+
+function start_log() {
+  while [ "$#" -gt 0 ]; do
+    case "$1" in
+      -c) LOG_COLLAPSE=1; shift;;
+      -n) LOG_NAME="$2"; shift;;
+      *) [ "$#" -eq 1 ] && LOG_MSG="$1"; shift;;
+    esac
+  done
+
+  echo -e "Start:${LOG_NAME} ${LOG_MSG}"
+}
+
+function end_log() {
+  while [ "$#" -gt 0 ]; do
+    case "$1" in
+      -n) LOG_NAME=$2; shift;;
+      *) shift;;
+    esac
+  done
+
+  echo -e "End:${LOG_NAME}"
+}
+
+:;
.ci/make-images.sh new file +71 -0

71 lines not on this page · raw message

.ci/process-tests.sh new file +108 -0

108 lines not on this page · raw message

.ci/test.sh new file +106 -0

106 lines not on this page · raw message

.gitlab-ci.yml new file +1184 -0

1,184 lines not on this page · raw message

Signature · 1 line
2.27.0
#17 lore raw

PATCH 17/17 keep: remove a lot of cruft that we probably want to reuse at some point

In reply to Glenn Washburn
---
 .ci/build.sh         |  10 -
 .ci/process-tests.sh |  11 -
 .ci/test.sh          |   8 -
 .gitlab-ci.yml       | 552 -------------------------------------------
 4 files changed, 581 deletions(-)
.ci/build.sh +0 -10
index 14dd7f7c5..55af74a1b 100755
@@ -31,16 +31,6 @@ mkdir -pv ${BUILDDIR};
 RET=0;
 cd ${BUILDDIR};
 
-# echo -e "#!$SHELL\nREAL_SHELL=\${REAL_SHELL:-\$(readlink /proc/\$\$/exe)}\nexec \$REAL_SHELL \$SHELL_OPTS \"\$@\"" >${BUILDDIR}/shell-wrapper.sh;
-# cat <<EOF >${BUILDDIR}/shell-wrapper.sh
-# #!$SHELL
-# REAL_SHELL=\${REAL_SHELL:-$(readlink /proc/\$\$/exe)}
-# exec \$REAL_SHELL \$SHELL_OPTS \"\$@\"
-# EOF
-
-# chmod +x ${BUILDDIR}/shell-wrapper.sh;
-# export CONFIG_SHELL=${BUILDDIR}/shell-wrapper.sh;
-
 start_log -c -n "configure-$TARGET" "Configuring $TARGET";
 ls -la $SRCDIR;
 [ -x "$SRCDIR/configure" ] && $SRCDIR/configure --help;
.ci/process-tests.sh +0 -11
index ab030cfc2..635436e39 100755
@@ -25,8 +25,6 @@ set -eo pipefail
 [ -f "$(dirname "$0")/functions.$CI_TYPE.sh" ] &&
 . "$(dirname "$0")/functions.$CI_TYPE.sh"
 
-# TARGET="${ARCH}-${PLATFORM}"
-
 test "x${SHELL_TRACE}" = "xy" && set -x;
 if [ -f ${BUILDDIR}/test.success ]; then
   echo "Not processing test logs because make check ran successfully";
@@ -96,13 +94,4 @@ fi;
   RET=1;
 fi;
 end_log -n "process-test-$TARGET";
-# if [ -f $CI_PROJECT_DIR/${TARGET}.timedout-failures ]; then
-#   sed 's/^/${TARGET}:/' $CI_PROJECT_DIR/${TARGET}.timedout-failures
-#     >> $CI_PROJECT_DIR/build/test.timedout.log;
-# fi;
-# if [ -f $CI_PROJECT_DIR/${TARGET}.unexpected-failures ]; then
-#   sed 's/^/${TARGET}:/' $CI_PROJECT_DIR/${TARGET}.unexpected-failures
-#     >> $CI_PROJECT_DIR/build/test.failed.log;
-#   exit 1;
-# fi;
 exit ${RET:-0};
.ci/test.sh +0 -8
index 3f51de58b..b780ae51f 100755
@@ -85,16 +85,8 @@ if [ -n "$GRUB_SHELL_DEFAULT_DEBUG" ]; then
 fi;
 TIMEOUT=${TESTS_TIMEOUT};
 
-function func_strace () {
-  strace -y -yy -f -v -s4096 -o >($COMP -9 > ${BUILDDIR}/test.strace.$RANDOM.$COMP) "$@";
-};
-':' STRACE="func_strace";
-
-':' $STRACE ${TIMEOUT:+timeout $TIMEOUT} make -C ${BUILDDIR} -j$JOBS SUBDIRS= check || RET=$?;
 ${TIMEOUT:+timeout $TIMEOUT} make -C ${BUILDDIR} -j$JOBS SUBDIRS= check || RET=$?;
-':' timeout $TIMEOUT $STRACE make -C ${BUILDDIR} -j$JOBS SUBDIRS= LOG_COMPILER="${BUILDDIR}/log-tester.sh" check || RET=$?;
 [ "$RET" -eq 124 -o "$RET" -eq 137 ] && echo "ERROR":" make check timed out";
-':' gzip -9 ${BUILDDIR}/test.strace.*;
 
 end_log -n "test-$TARGET";
 
.gitlab-ci.yml +0 -552

687 lines not on this page · raw message

Signature · 1 line
2.27.0