diff options
Diffstat (limited to 'scripts/check-qemu-install')
-rwxr-xr-x | scripts/check-qemu-install | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install index 7aedd1a1..e8a7cc6f 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) @@ -143,7 +144,7 @@ def get_qemu_cmd(name, enable_kvm, enable_uefi, disk_img, raid=None, iso_img=Non macbase = '52:54:00:00:00' cmd = f'qemu-system-x86_64 \ -name "{name}" \ - -smp sockets=1,cpus={cpucount},cores=1 \ + -smp {cpucount},sockets=1,cores={cpucount},threads=1 \ -cpu host \ {uefi} \ -m 3G \ @@ -271,7 +272,7 @@ gen_disk(args.disk) if args.qemu_cmd: tmp = get_qemu_cmd('TESTVM', kvm, args.uefi, args.disk, diskname_raid, args.iso) - print(tmp) + os.system(tmp) exit(0) test_timeout = 3 *3600 # 3 hours (in seconds) @@ -305,42 +306,29 @@ try: ################################################# log.info('Starting installer') c.sendline('install image') - c.expect('\nWould you like to continue?.*:') - c.sendline('yes') - - if args.raid: - c.expect('\nWould you like to configure RAID-1 mirroring on them?.*:') - c.sendline('yes') - # Erase all data on disks - c.expect('\nAre you sure you want to do this?.*:') - c.sendline('yes') - else: - log.info('Partitioning disk') - c.expect('\nPartition.*:') - c.sendline('') - c.expect('\nInstall the image on.*:') - c.sendline('') - c.expect(r'\nContinue\?.*:') - c.sendline('Yes') - c.expect('\nHow big of a root partition should I create?.*:') - c.sendline('') - - log.info('Disk(s) partitioned, installing...') - c.expect('\nWhat would you like to name this image?.*:', timeout=600) + c.expect('\nWould you like to continue?.*') + c.sendline('y') + c.expect('\nWhat would you like to name this image?.*') c.sendline('') - log.info('Copying files') - c.expect('\nWhich one should I copy to.*:', timeout=600) + c.expect(f'\nPlease enter a password for the "{default_user}" user.*') c.sendline('') - log.info('Files Copied!') - c.expect('\nEnter password for user.*:') - c.sendline(default_user) - c.expect('\nRetype password for user.*:') - c.sendline(default_password) + c.expect('\nWhat console should be used by default?.*') + c.sendline('S') - if not args.raid: - c.expect('\nWhich drive should GRUB modify the boot partition on.*:') + if args.raid: + c.expect('\nWould you like to configure RAID-1 mirroring??.*') + c.sendline('y') + c.expect('\nWould you like to configure RAID-1 mirroring on them?.*') + c.sendline('y') + c.expect('\nInstallation will delete all data on both drives. Continue?.*') + c.sendline('y') + else: + c.expect('\nWhich one should be used for installation?.*') c.sendline('') - c.expect(op_mode_prompt) + c.expect('\nInstallation will delete all data on the drive. Continue?.*') + c.sendline('y') + c.expect('\nWould you like to use all the free space on the drive?.*') + c.sendline('y') log.info('system installed, shutting down') @@ -452,12 +440,12 @@ try: c.expect(op_mode_prompt) log.info('Re-format new RAID member') - c.sendline('format disk sda like sdb') + c.sendline('format by-id disk drive-hd1 like drive-hd2') c.sendline('yes') c.expect(op_mode_prompt) log.info('Add member to RAID1 (md0)') - c.sendline('add raid md0 member sda1') + c.sendline('add raid md0 by-id member drive-hd1-part3') c.expect(op_mode_prompt) log.info('Now we need to wait for re-sync to complete') @@ -486,6 +474,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_*') |