summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-09-15 17:30:40 +0200
committerGitHub <noreply@github.com>2023-09-15 17:30:40 +0200
commit419c71c0b6c619a5c956a1b276fc1d262dea405a (patch)
tree6bf32ad465b197f7346ff77e97fe0d2db0b6e707
parent6a88f671162d8acb41e181223b488b5e41a2d1b5 (diff)
parentd9e93d73535fd8ed8974605e355b5890fcdacd4b (diff)
downloadvyos-build-419c71c0b6c619a5c956a1b276fc1d262dea405a.tar.gz
vyos-build-419c71c0b6c619a5c956a1b276fc1d262dea405a.zip
Merge pull request #408 from sarthurdev/test_match
smoketest: live: T5568: Option to specify smoketests to run, serial boot option to live ISO
-rw-r--r--Makefile4
-rwxr-xr-xdata/live-build-config/hooks/live/01-live-serial.binary31
-rwxr-xr-xscripts/check-qemu-install6
3 files changed, 39 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 74b17c7c..5ba003d0 100644
--- a/Makefile
+++ b/Makefile
@@ -32,12 +32,12 @@ checkiso:
.PHONY: test
.ONESHELL:
test: checkiso
- scripts/check-qemu-install --debug --uefi build/live-image-amd64.hybrid.iso
+ scripts/check-qemu-install --debug --match="$(MATCH)" --uefi build/live-image-amd64.hybrid.iso
.PHONY: test-no-interfaces
.ONESHELL:
test-no-interfaces: checkiso
- scripts/check-qemu-install --debug --no-interfaces build/live-image-amd64.hybrid.iso
+ scripts/check-qemu-install --debug --match="$(MATCH)" --no-interfaces build/live-image-amd64.hybrid.iso
.PHONY: testd
.ONESHELL:
diff --git a/data/live-build-config/hooks/live/01-live-serial.binary b/data/live-build-config/hooks/live/01-live-serial.binary
new file mode 100755
index 00000000..e138b20d
--- /dev/null
+++ b/data/live-build-config/hooks/live/01-live-serial.binary
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+GRUB_PATH=boot/grub/grub.cfg
+ISOLINUX_PATH=isolinux/live.cfg
+
+KVM_CONSOLE="console=ttyS0,115200 console=tty0"
+SERIAL_CONSOLE="console=tty0 console=ttyS0,115200"
+
+# Grub.cfg Update
+GRUB_MENUENTRY=$(sed -e '/menuentry.*hotkey.*/,/^}/!d' -e 's/--hotkey=l//g' $GRUB_PATH)
+
+# Update KVM menuentry name
+sed -i 's/"Live system \((.*-vyos)\)"/"Live system \1 - KVM console"/' $GRUB_PATH
+
+# Insert serial menuentry
+echo "$GRUB_MENUENTRY" | sed \
+ -e 's/"Live system \((.*-vyos)\)"/"Live system \1 - Serial console"/' \
+ -e "s/$KVM_CONSOLE/$SERIAL_CONSOLE/g" >> $GRUB_PATH
+
+# Live.cfg Update
+ISOLINUX_MENUENTRY=$(sed -e '/label live-\(.*\)-vyos$/,/^\tappend.*/!d' $ISOLINUX_PATH)
+
+# Update KVM menuentry name
+sed -i 's/Live system \((.*-vyos)\)/Live system \1 - KVM console/' $ISOLINUX_PATH
+
+# Insert serial menuentry
+echo "\n$ISOLINUX_MENUENTRY" | sed \
+ -e 's/live-\(.*\)-vyos/live-\1-vyos-serial/' \
+ -e '/^\tmenu default/d' \
+ -e 's/Live system \((.*-vyos)\)/Live system \1 - Serial console/' \
+ -e "s/$KVM_CONSOLE/$SERIAL_CONSOLE/g" >> $ISOLINUX_PATH
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install
index fabe8fbb..82c20ed3 100755
--- a/scripts/check-qemu-install
+++ b/scripts/check-qemu-install
@@ -63,6 +63,7 @@ parser.add_argument('--silent', help='Do not show output on stdout unless an err
parser.add_argument('--debug', help='Send all debug output to stdout',
action='store_true', default=False)
parser.add_argument('--logfile', help='Log to file')
+parser.add_argument('--match', help='Smoketests to run')
parser.add_argument('--uefi', help='Boot using UEFI', action='store_true', default=False)
parser.add_argument('--raid', help='Perform a RAID-1 install', action='store_true', default=False)
parser.add_argument('--no-kvm', help='Disable use of kvm', action='store_true', default=False)
@@ -486,6 +487,11 @@ try:
elif not args.configtest:
# run default smoketest suite
+ if args.match:
+ # Remove tests that we don't want to run
+ match_str = '-o '.join([f'-name "test_*{name}*.py" ' for name in args.match.split("|")]).strip()
+ c.sendline(f'sudo find /usr/libexec/vyos/tests/smoke/cli/test_* -type f ! \( {match_str} \) -delete')
+ c.expect(op_mode_prompt)
if args.no_interfaces:
# remove interface tests as they consume a lot of time
c.sendline('sudo rm -f /usr/libexec/vyos/tests/smoke/cli/test_interfaces_*')