diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-05-02 20:29:06 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-05-06 19:49:24 +0200 |
| commit | ded3f2a70ffaef3355316220647366c54508fe7e (patch) | |
| tree | abda2068913494cf9a7fcf680227a1a277266e5b /scripts | |
| parent | 7d3566403af0c70de5a6a389c4964779c2eda9ce (diff) | |
| download | vyos-build-ded3f2a70ffaef3355316220647366c54508fe7e.tar.gz vyos-build-ded3f2a70ffaef3355316220647366c54508fe7e.zip | |
Testsuite: T8147: add common waitForLogin() helper
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-qemu-install | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index b0a93dc5..4f99e82d 100755 --- a/scripts/check-qemu-install +++ b/scripts/check-qemu-install @@ -302,6 +302,14 @@ def shutdownVM(c, log, message=''): log.error(tmp) raise Exception(tmp) +def waitForLogin(child, log, timeout=20) -> None: + try: + child.expect('The highlighted entry will be executed automatically in', + timeout=timeout) + child.sendline('') + except pexpect.TIMEOUT: + log.warning('Did not find GRUB countdown window, ignoring') + def loginVM(c, log): log.info('Waiting for login prompt') c.expect('[Ll]ogin:', timeout=600) @@ -819,12 +827,7 @@ try: ################################################# # Logging into VyOS system ################################################# - try: - c.expect('The highlighted entry will be executed automatically in', timeout=10) - c.sendline('') - except pexpect.TIMEOUT: - log.warning('Did not find GRUB countdown window, ignoring') - + waitForLogin(c, log) loginVM(c, log) ################################################# @@ -940,11 +943,7 @@ try: log.info('system installed, rebooting') c.sendline('reboot now') - try: - c.expect('The highlighted entry will be executed automatically in', timeout=10) - c.sendline('') - except pexpect.TIMEOUT: - log.warning('Did not find GRUB countdown window, ignoring') + waitForLogin(c, log) # Check for vyos-router message c.expect('.*Mounted encrypted config volume', timeout=120) @@ -973,11 +972,7 @@ try: log.debug(f'Executing command: {cmd}') c = pexpect.spawn(cmd, logfile=stl) - try: - c.expect('The highlighted entry will be executed automatically in', timeout=10) - c.sendline('') - except pexpect.TIMEOUT: - log.warning('Did not find GRUB countdown window, ignoring') + waitForLogin(c, log) c.expect('.*Encrypted config volume has not been mounted', timeout=120) @@ -1019,12 +1014,7 @@ try: log.debug(f'Executing command: {cmd}') c = pexpect.spawn(cmd, logfile=stl) - try: - c.expect('The highlighted entry will be executed automatically in', timeout=10) - c.sendline('') - except pexpect.TIMEOUT: - log.warning('Did not find GRUB countdown window, ignoring') - + waitForLogin(c, log) loginVM(c, log) # New recovery key @@ -1055,11 +1045,7 @@ try: log.debug(f'Executing command: {cmd}') c = pexpect.spawn(cmd, logfile=stl) - try: - c.expect('The highlighted entry will be executed automatically in', timeout=10) - c.sendline('') - except pexpect.TIMEOUT: - log.warning('Did not find GRUB countdown window, ignoring') + waitForLogin(c, log) c.expect('.*encrypted config volume will not be automatically mounted', timeout=120) @@ -1115,12 +1101,7 @@ try: ################################################# # Logging into VyOS system ################################################# - try: - c.expect('The highlighted entry will be executed automatically in', timeout=10) - c.sendline('') - except pexpect.TIMEOUT: - log.warning('Did not find GRUB countdown window, ignoring') - + waitForLogin(c, log) loginVM(c, log) c.sendline('cat /proc/mdstat') |
