summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-qemu-install29
1 files changed, 28 insertions, 1 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install
index 6ac4b73e..ed5bc4e6 100755
--- a/scripts/check-qemu-install
+++ b/scripts/check-qemu-install
@@ -528,13 +528,40 @@ def basic_cli_tests(c):
c.expect(op_mode_prompt)
c.sendline('show system memory detail | no-more')
c.expect(op_mode_prompt)
- c.sendline('show configuration commands | match kernel')
+ c.sendline('show configuration commands | match "option kernel"')
c.expect(op_mode_prompt)
c.sendline('cat /proc/cmdline')
c.expect(op_mode_prompt)
c.sendline('show version all | grep -e "vpp" -e "vyos-1x"')
c.expect(op_mode_prompt)
+ # Get serial console interface name from flavor definition
+ c.sendline('cat /usr/share/vyos/flavor.json | jq -r ".console_type"')
+ c.expect(op_mode_prompt)
+ lines = [l.strip() for l in c.before.splitlines() if l.strip()]
+ console_type = lines[-1].decode('utf-8').strip() # e.g. ttyS
+
+ c.sendline('cat /usr/share/vyos/flavor.json | jq -r ".console_num"')
+ c.expect(op_mode_prompt)
+ lines = [l.strip() for l in c.before.splitlines() if l.strip()]
+ console_num = lines[-1].decode('utf-8').strip() # e.g. 0
+
+ # Get serial console speed from flavor definition
+ c.sendline('cat /usr/share/vyos/flavor.json | jq -r ".console_speed"')
+ c.expect(op_mode_prompt)
+ lines = [l.strip() for l in c.before.splitlines() if l.strip()]
+ console_speed = lines[-1].decode('utf-8').strip() # e.g. 115200
+
+ # Ensure serial console with kernel option is set in CLI, done automatically by image installer
+ c.sendline('show configuration commands | match "system console"')
+ c.expect(rf'set system console device {console_type}{console_num} kernel\r\r\nset system console device {console_type}{console_num} speed \'{console_speed}\'')
+ c.expect(op_mode_prompt)
+
+ # Validate GRUB has the right console_type defined
+ c.sendline('cat /boot/grub/grub.cfg.d/20-vyos-defaults-autoload.cfg | grep "set console_type"')
+ c.expect(f'set console_type="{console_type}"')
+ c.expect(op_mode_prompt)
+
if args.qemu_cmd:
tmp = get_qemu_cmd(qemu_name, args.uefi, args.disk, raid=diskname_raid, iso_img=args.iso, vnc_enabled=args.vnc, secure_boot=args.sbtest)
os.system(tmp)