def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--virt-modes':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
         self.asVirtModes = asArgs[iArg].split(':');
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)));
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
         self.acCpus = [];
         for s in asArgs[iArg].split(':'):
             try: c = int(s);
             except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
             if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
             self.acCpus.append(c);
     elif asArgs[iArg] == '--test-vms':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
         self.asTestVMs = asArgs[iArg].split(':');
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)));
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
         self.asSkipVMs = asArgs[iArg].split(':');
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
     elif asArgs[iArg] == '--usb-ctrls':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--usb-ctrls" takes a colon separated list of USB controllers');
         self.asUsbCtrls = asArgs[iArg].split(':');
         for s in self.asUsbCtrls:
             if s not in self.asUsbCtrlsDef:
                 reporter.log('warning: The "--usb-ctrls" value "%s" is not a valid USB controller.' % (s));
     elif asArgs[iArg] == '--usb-speed':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--usb-speed" takes a colon separated list of USB speeds');
         self.asUsbSpeed = asArgs[iArg].split(':');
         for s in self.asUsbSpeed:
             if s not in self.asUsbSpeedDef:
                 reporter.log('warning: The "--usb-speed" value "%s" is not a valid USB speed.' % (s));
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg);
     return iArg + 1;
Exemplo n.º 2
0
    def parseOption(self, asArgs, iArg):                                  # pylint: disable=too-many-branches,too-many-statements
        if asArgs[iArg] == '--tests':
            iArg += 1;
            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of tests');
            self.asTests = asArgs[iArg].split(':');
            for s in self.asTests:
                if s not in self.asTestsDef:
                    raise base.InvalidOption('The "--tests" value "%s" is not valid; valid values are: %s'
                                             % (s, ' '.join(self.asTestsDef),));

        elif asArgs[iArg] == '--quick':
            self.parseOption(['--virt-modes', 'hwvirt'], 0);
            self.parseOption(['--cpu-counts', '1'], 0);

        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg);
        return iArg + 1;
Exemplo n.º 3
0
    def parseOption(self, asArgs, iArg):
        """
        Extend standard options set
        """
        if asArgs[iArg] == '--boot-hdd':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--boot-hdd" option requires an argument')
            self.sHddName = asArgs[iArg]

        elif asArgs[iArg] == '--cpus':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--cpus" option requires an argument')
            self.cCpus = int(asArgs[iArg])
        elif asArgs[iArg] == '--no-ioapic':
            self.fEnableIOAPIC = False
        elif asArgs[iArg] == '--no-nested-paging':
            self.fEnableNestedPaging = False
        elif asArgs[iArg] == '--pae':
            self.fEnablePAE = True
        elif asArgs[iArg] == '--suspend-host':
            self.fSuspendHost = True
        elif asArgs[iArg] == '--suspend-time':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--suspend-time" option requires an argument')
            self.cSecSuspendTime = int(asArgs[iArg])
        elif asArgs[iArg] == '--shutdown-iters':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--shutdown-iters" option requires an argument')
            self.cShutdownIters = int(asArgs[iArg])
        elif asArgs[iArg] == '--extra-vm':
            self.fExtraVm = True
        elif asArgs[iArg] == '--local-catch':
            self.fLocalCatch = True
        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg)

        return iArg + 1
 def parseOption(self, asArgs, iArg):  # pylint: disable=too-many-branches,too-many-statements
     if asArgs[iArg] == '--storage-ctrls':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--storage-ctrls" takes a colon separated list of Storage controller types'
             )
         self.asStorageCtrls = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--disk-formats':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--disk-formats" takes a colon separated list of disk formats'
             )
         self.asDiskFormats = asArgs[iArg].split(':')
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 5
0
    def parseOption(self, asArgs, iArg):
        if asArgs[iArg] == '--serial-modes':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--serial-modes" takes a colon separated list of serial port modes to test'
                )
            self.asSerialModes = asArgs[iArg].split(':')
            for s in self.asSerialModes:
                if s not in self.asSerialModesDef:
                    reporter.log(
                        'warning: The "--serial-modes" value "%s" is not a valid serial port mode.'
                        % (s))
        elif asArgs[iArg] == '--serial-tests':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--serial-tests" takes a colon separated list of serial port tests'
                )
            self.asSerialTests = asArgs[iArg].split(':')
            for s in self.asSerialTests:
                if s not in self.asSerialTestsDef:
                    reporter.log(
                        'warning: The "--serial-tests" value "%s" is not a valid serial port test.'
                        % (s))
        elif asArgs[iArg] == '--aurts':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--uarts" takes a colon separated list of uarts to test'
                )
            self.asUarts = asArgs[iArg].split(':')
            for s in self.asUarts:
                if s not in self.asUartsDef:
                    reporter.log(
                        'warning: The "--uarts" value "%s" is not a valid uart.'
                        % (s))
        elif asArgs[iArg] == '--verbose-test':
            iArg += 1
            self.fVerboseTest = True
        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg)

        return iArg + 1
Exemplo n.º 6
0
    def parseOption(self, asArgs, iArg):                                        # pylint: disable=too-many-branches,too-many-statements
        if asArgs[iArg] == '--runningvmname':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "----runningvmname" needs VM name')

            self.sVMname = asArgs[iArg]
        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg)
        return iArg + 1
Exemplo n.º 7
0
    def parseOption(self, asArgs, iArg):  # pylint: disable=R0912,R0915
        if asArgs[iArg] == '--tests':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption(
                    'The "--tests" takes a colon separated list of tests')
            self.asTests = asArgs[iArg].split(':')
            for s in self.asTests:
                if s not in self.asTestsDef:
                    raise base.InvalidOption('The "--tests" value "%s" is not valid; valid values are: %s' \
                        % (s, ' '.join(self.asTestsDef)))

        elif asArgs[iArg] == '--quick':
            self.parseOption(['--virt-modes', 'hwvirt'], 0)
            self.parseOption(['--cpu-counts', '1'], 0)

        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg)
        return iArg + 1
Exemplo n.º 8
0
    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
        if asArgs[iArg] == '--runningvmname':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "----runningvmname" needs VM name')

            self.sVMname = asArgs[iArg]
        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg)
        return iArg + 1
Exemplo n.º 9
0
 def parseOption(self, asArgs, iArg):
     if asArgs[iArg] == '--virt-modes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--virt-modes" takes a colon separated list of modes')
         self.asVirtModes = asArgs[iArg].split(':')
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)))
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--cpu-counts" takes a colon separated list of cpu counts'
             )
         self.acCpus = []
         for s in asArgs[iArg].split(':'):
             try:
                 c = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is not an integer' %
                     (s, ))
             if c <= 0:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is zero or negative' %
                     (s, ))
             self.acCpus.append(c)
     elif asArgs[iArg] == '--quick':
         self.asVirtModes = [
             'raw',
         ]
         self.acCpus = [
             1,
         ]
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
 def parseOption(self, asArgs, iArg):  # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--storage-ctrls':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--storage-ctrls" takes a colon separated list of Storage controller types'
             )
         self.asStorageCtrls = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--disk-formats':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--disk-formats" takes a colon separated list of disk formats'
             )
         self.asDiskFormats = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--test-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-vms" takes colon separated list')
         self.asTestVMs = asArgs[iArg].split(':')
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)))
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log(
                     'warning: The "--test-vms" value "%s" does not specify any of our test VMs.'
                     % (s))
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 11
0
 def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--test-build-dir':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dir" takes a path argument');
         self.sTestBuildDir = asArgs[iArg];
     elif asArgs[iArg] == '--test-vms':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
         self.asTestVMs = asArgs[iArg].split(':');
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)));
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1;
         if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
         self.asSkipVMs = asArgs[iArg].split(':');
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg);
     return iArg + 1;
Exemplo n.º 12
0
 def parseOption(self, asArgs, iArg):
     if asArgs[iArg] == '--nic-attachment':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--nic-attachment" takes an argument')
         self.sNicAttachment = asArgs[iArg]
         if self.sNicAttachment not in ('bridged', 'nat', 'mixed'):
             raise base.InvalidOption('The "--nic-attachment" value "%s" is not supported. Valid values are: bridged, nat' \
                     % (self.sNicAttachment))
     elif asArgs[iArg] == '--quick':
         # Disable all but a few VMs and configurations.
         for oTestVm in self.oTestVmSet.aoTestVms:
             if oTestVm.sVmName == 'tst-win2k3ent':  # 32-bit paging
                 oTestVm.asVirtModesSup = ['hwvirt']
                 oTestVm.acCpusSup = range(1, 2)
             elif oTestVm.sVmName == 'tst-rhel5':  # 32-bit paging
                 oTestVm.asVirtModesSup = ['raw']
                 oTestVm.acCpusSup = range(1, 2)
             elif oTestVm.sVmName == 'tst-win2k8':  # 64-bit
                 oTestVm.asVirtModesSup = ['hwvirt-np']
                 oTestVm.acCpusSup = range(1, 2)
             elif oTestVm.sVmName == 'tst-sol10-64':  # SMP, 64-bit
                 oTestVm.asVirtModesSup = ['hwvirt']
                 oTestVm.acCpusSup = range(2, 3)
             elif oTestVm.sVmName == 'tst-sol10':  # SMP, 32-bit
                 oTestVm.asVirtModesSup = ['hwvirt-np']
                 oTestVm.acCpusSup = range(2, 3)
             elif oTestVm.sVmName == 'tst-nsthwvirt-ubuntu-64':  # Nested hw.virt, 64-bit
                 oTestVm.asVirtModesSup = ['hwvirt-np']
                 oTestVm.acCpusSup = range(1, 2)
             else:
                 oTestVm.fSkip = True
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 13
0
 def parseOption(self, asArgs, iArg):
     if asArgs[
             iArg] == '--add-shared-folders-tests':  # 'add' as in 'additions', not the verb.
         iArg += 1
         iNext = self.oTstDrv.requireMoreArgs(1, asArgs, iArg)
         if asArgs[iArg] == 'all':
             self.asTests = self.asTestsDef
         else:
             self.asTests = asArgs[iArg].split(':')
             for s in self.asTests:
                 if s not in self.asTestsDef:
                     raise base.InvalidOption(
                         'The "--add-shared-folders-tests" value "%s" is not valid; valid values are: %s'
                         % (s, ' '.join(self.asTestsDef)))
         return iNext
     if asArgs[iArg] == '--add-shared-folders-extra-arg':
         iArg += 1
         iNext = self.oTstDrv.requireMoreArgs(1, asArgs, iArg)
         self.asExtraArgs.append(asArgs[iArg])
         return iNext
     return iArg
Exemplo n.º 14
0
    def actionConfig(self):
        """
        Configure pre-conditions.
        """

        if not self.importVBoxApi():
            return False

        assert self.sIso is not None
        if self.sIso not in self.kaoVmParams:
            reporter.log('Error: unknown ISO image specified: %s' % self.sIso)
            return False

        # Get VM params specific to ISO image
        cBytesHdd, sKind, sController = self.kaoVmParams[self.sIso]

        # Create VM itself
        eNic0AttachType = vboxcon.NetworkAttachmentType_NAT
        self.sIso = os.path.join(self.sIsoPathBase, self.sIso)
        assert os.path.isfile(self.sIso)

        self.sFloppy = os.path.join(self.sIsoPathBase,
                                    os.path.splitext(self.sIso)[0] + '.img')

        oVM = self.createTestVM(self.sVmName,
                                1,
                                sKind=sKind,
                                sDvdImage=self.sIso,
                                cCpus=self.cCpus,
                                sFloppy=self.sFloppy,
                                eNic0AttachType=eNic0AttachType)
        assert oVM is not None

        oSession = self.openSession(oVM)

        # Create HDD
        sHddPath = os.path.join(self.sScratchPath, self.sHddName)
        fRc = True
        if sController == self.ksSataController:
            fRc = oSession.setStorageControllerType(
                vboxcon.StorageControllerType_IntelAhci, sController)

        fRc = fRc and oSession.createAndAttachHd(sHddPath,
                                                 cb=cBytesHdd,
                                                 sController=sController,
                                                 iPort=0,
                                                 fImmutable=False)
        if sController == self.ksSataController:
            fRc = fRc and oSession.setStorageControllerPortCount(
                sController, 1)

        # Set proper boot order
        fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
        fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_Floppy)

        # Enable HW virt
        fRc = fRc and oSession.enableVirtEx(True)

        # Enable I/O APIC
        fRc = fRc and oSession.enableIoApic(self.fEnableIOAPIC)

        # Enable Nested Paging
        fRc = fRc and oSession.enableNestedPaging(self.fEnableNestedPaging)

        # Enable PAE
        fRc = fRc and oSession.enablePae(self.fEnablePAE)

        # Remote desktop
        oSession.setupVrdp(True)

        # Set extra data
        if self.asExtraData != []:
            for sExtraData in self.asExtraData:
                try:
                    sKey, sValue = sExtraData.split(':')
                except ValueError:
                    raise base.InvalidOption(
                        'Invalid extradata specified: %s' % sExtraData)
                reporter.log('Set extradata: %s => %s' % (sKey, sValue))
                fRc = fRc and oSession.setExtraData(sKey, sValue)

        fRc = fRc and oSession.saveSettings()
        fRc = oSession.close()
        assert fRc is True

        return vbox.TestDriver.actionConfig(self)
Exemplo n.º 15
0
 def parseOption(self, asArgs, iArg):  # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--virt-modes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--virt-modes" takes a colon separated list of modes')
         self.asVirtModes = asArgs[iArg].split(':')
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)))
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--cpu-counts" takes a colon separated list of cpu counts'
             )
         self.acCpus = []
         for s in asArgs[iArg].split(':'):
             try:
                 c = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is not an integer' %
                     (s, ))
             if c <= 0:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is zero or negative' %
                     (s, ))
             self.acCpus.append(c)
     elif asArgs[iArg] == '--test-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-vms" takes colon separated list')
         self.asTestVMs = asArgs[iArg].split(':')
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)))
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log(
                     'warning: The "--test-vms" value "%s" does not specify any of our test VMs.'
                     % (s))
     elif asArgs[iArg] == '--usb-ctrls':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--usb-ctrls" takes a colon separated list of USB controllers'
             )
         self.asUsbCtrls = asArgs[iArg].split(':')
         for s in self.asUsbCtrls:
             if s not in self.asUsbCtrlsDef:
                 reporter.log(
                     'warning: The "--usb-ctrls" value "%s" is not a valid USB controller.'
                     % (s))
     elif asArgs[iArg] == '--usb-speed':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--usb-speed" takes a colon separated list of USB speeds'
             )
         self.asUsbSpeed = asArgs[iArg].split(':')
         for s in self.asUsbSpeed:
             if s not in self.asUsbSpeedDef:
                 reporter.log(
                     'warning: The "--usb-speed" value "%s" is not a valid USB speed.'
                     % (s))
     elif asArgs[iArg] == '--usb-tests':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--usb-tests" takes a colon separated list of USB tests'
             )
         self.asUsbTests = asArgs[iArg].split(':')
         for s in self.asUsbTests:
             if s not in self.asUsbTestsDef:
                 reporter.log(
                     'warning: The "--usb-tests" value "%s" is not a valid USB test.'
                     % (s))
     elif asArgs[iArg] == '--usb-reattach-cycles':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--usb-reattach-cycles" takes cycle count')
         try:
             self.cUsbReattachCycles = int(asArgs[iArg])
         except:                raise base.InvalidOption('The "--usb-reattach-cycles" value "%s" is not an integer' \
             % (asArgs[iArg],))
         if self.cUsbReattachCycles <= 0:
             raise base.InvalidOption('The "--usb-reattach-cycles" value "%s" is zero or negative.' \
                 % (self.cUsbReattachCycles,))
     elif asArgs[iArg] == '--hostname':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption('The "--hostname" takes a hostname')
         self.sHostname = asArgs[iArg]
     elif asArgs[iArg] == '--default-gadget-host':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--default-gadget-host" takes a hostname')
         self.sGadgetHostnameDef = asArgs[iArg]
     elif asArgs[iArg] == '--default-gadget-port':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--default-gadget-port" takes port number')
         try:
             self.uGadgetPortDef = int(asArgs[iArg])
         except:                raise base.InvalidOption('The "--default-gadget-port" value "%s" is not an integer' \
             % (asArgs[iArg],))
         if self.uGadgetPortDef <= 0:
             raise base.InvalidOption('The "--default-gadget-port" value "%s" is zero or negative.' \
                 % (self.uGadgetPortDef,))
     elif asArgs[iArg] == '--usb-capture-path':
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--usb-capture-path" takes a path argument')
         self.sUsbCapturePath = asArgs[iArg]
     elif asArgs[iArg] == '--usb-capture':
         self.fUsbCapture = True
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 16
0
 def parseOption(self, asArgs, iArg):  # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--virt-modes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--virt-modes" takes a colon separated list of modes')
         self.asVirtModes = asArgs[iArg].split(':')
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)))
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--cpu-counts" takes a colon separated list of cpu counts'
             )
         self.acCpus = []
         for s in asArgs[iArg].split(':'):
             try:
                 c = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is not an integer' %
                     (s, ))
             if c <= 0:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is zero or negative' %
                     (s, ))
             self.acCpus.append(c)
     elif asArgs[iArg] == '--storage-ctrls':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--storage-ctrls" takes a colon separated list of Storage controller types'
             )
         self.asStorageCtrls = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--disk-formats':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--disk-formats" takes a colon separated list of disk formats'
             )
         self.asDiskFormats = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--disk-dirs':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--disk-dirs" takes a colon separated list of directories'
             )
         self.asDirs = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--iscsi-targets':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--iscsi-targets" takes a colon separated list of iscsi targets'
             )
         self.asIscsiTargets = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--tests':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--tests" takes a colon separated list of disk formats'
             )
         self.asTests = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--guest-fs':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--guest-fs" takes a colon separated list of filesystem identifiers'
             )
         self.asGuestFs = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--test-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-vms" takes colon separated list')
         self.asTestVMs = asArgs[iArg].split(':')
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)))
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log(
                     'warning: The "--test-vms" value "%s" does not specify any of our test VMs.'
                     % (s))
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 17
0
    def getReconfiguredVm(self,
                          oTestDrv,
                          cCpus,
                          sVirtMode,
                          sParavirtMode=None):
        #
        # Do the standard reconfig in the base class first, it'll figure out
        # if we can run the VM as requested.
        #
        (fRc,
         oVM) = vboxtestvms.TestVm.getReconfiguredVm(self, oTestDrv, cCpus,
                                                     sVirtMode, sParavirtMode)

        #
        # Make sure there is no HD from the previous run attached nor taking
        # up storage on the host.
        #
        if fRc is True:
            fRc = self.detatchAndDeleteHd(oTestDrv)

        #
        # Check for ubuntu installer vs. AMD host CPU.
        #
        if fRc is True and (self.fInstVmFlags & self.kfUbuntuNewAmdBug):
            if self.isHostCpuAffectedByUbuntuNewAmdBug(oTestDrv):
                return (None, None)
                # (skip)

        #
        # Make adjustments to the default config, and adding a fresh HD.
        #
        if fRc is True:
            oSession = oTestDrv.openSession(oVM)
            if oSession is not None:
                if self.sHddControllerType == self.ksSataController:
                    fRc = fRc and oSession.setStorageControllerType(
                        vboxcon.StorageControllerType_IntelAhci,
                        self.sHddControllerType)
                    fRc = fRc and oSession.setStorageControllerPortCount(
                        self.sHddControllerType, 1)
                elif self.sHddControllerType == self.ksScsiController:
                    fRc = fRc and oSession.setStorageControllerType(
                        vboxcon.StorageControllerType_LsiLogic,
                        self.sHddControllerType)
                try:
                    sHddPath = os.path.join(
                        os.path.dirname(oVM.settingsFilePath),
                        '%s-%s-%s.vdi' % (
                            self.sVmName,
                            sVirtMode,
                            cCpus,
                        ))
                except:
                    reporter.errorXcpt()
                    sHddPath = None
                    fRc = False

                fRc = fRc and oSession.createAndAttachHd(
                    sHddPath,
                    cb=self.cGbHdd * 1024 * 1024 * 1024,
                    sController=self.sHddControllerType,
                    iPort=0,
                    fImmutable=False)

                # Set proper boot order
                fRc = fRc and oSession.setBootOrder(
                    1, vboxcon.DeviceType_HardDisk)
                fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)

                # Adjust memory if requested.
                if self.iOptRamAdjust != 0:
                    fRc = fRc and oSession.setRamSize(
                        oSession.o.machine.memorySize + self.iOptRamAdjust)

                # Set extra data
                for sExtraData in self.asExtraData:
                    try:
                        sKey, sValue = sExtraData.split(':')
                    except ValueError:
                        raise base.InvalidOption(
                            'Invalid extradata specified: %s' % sExtraData)
                    reporter.log('Set extradata: %s => %s' % (sKey, sValue))
                    fRc = fRc and oSession.setExtraData(sKey, sValue)

                # Other variations?

                # Save the settings.
                fRc = fRc and oSession.saveSettings()
                fRc = oSession.close() and fRc
            else:
                fRc = False
            if fRc is not True:
                oVM = None

        # Done.
        return (fRc, oVM)
Exemplo n.º 18
0
 def parseOption(self, asArgs, iArg):  # pylint: disable=too-many-branches,too-many-statements
     if asArgs[iArg] == '--remote-host':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--remote-host" takes an IP address or a hostname')
         self.sRemoteName = asArgs[iArg]
     elif asArgs[iArg] == '--local-host':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--local-host" takes an IP address or a hostname')
         self.sLocalName = asArgs[iArg]
     elif asArgs[iArg] == '--guest-host':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--guest-host" takes an IP address or a hostname')
         self.sGuestName = asArgs[iArg]
     elif asArgs[iArg] == '--virt-modes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--virt-modes" takes a colon separated list of modes')
         self.asVirtModes = asArgs[iArg].split(':')
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)))
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--cpu-counts" takes a colon separated list of cpu counts'
             )
         self.acCpus = []
         for s in asArgs[iArg].split(':'):
             try:
                 c = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is not an integer' %
                     (s, ))
             if c <= 0:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is zero or negative' %
                     (s, ))
             self.acCpus.append(c)
     elif asArgs[iArg] == '--nic-types':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--nic-types" takes a colon separated list of NIC types'
             )
         self.asNicTypes = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--nic-attachment':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--nic-attachment" takes an argument')
         self.sNicAttachment = asArgs[iArg]
         if self.sNicAttachment not in ('bridged', 'nat'):
             raise base.InvalidOption('The "--nic-attachment" value "%s" is not supported. Valid values are: bridged, nat' \
                     % (self.sNicAttachment))
     elif asArgs[iArg] == '--setups':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--setups" takes a colon separated list of setups')
         self.asSetups = asArgs[iArg].split(':')
         for s in self.asSetups:
             if s not in self.asSetupsDef:
                 raise base.InvalidOption('The "--setups" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asSetupsDef)))
     elif asArgs[iArg] == '--secs-per-run':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--secs-per-run" takes second count')
         try:
             self.cSecsRun = int(asArgs[iArg])
         except:
             raise base.InvalidOption(
                 'The "--secs-per-run" value "%s" is not an integer' %
                 (self.cSecsRun, ))
         if self.cSecsRun <= 0:
             raise base.InvalidOption(
                 'The "--secs-per-run" value "%s" is zero or negative.' %
                 (self.cSecsRun, ))
     elif asArgs[iArg] == '--tests':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--tests" takes a colon separated list of tests')
         self.asTests = asArgs[iArg].split(':')
         for s in self.asTests:
             if s not in self.asTestsDef:
                 raise base.InvalidOption('The "--tests" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestsDef)))
     elif asArgs[iArg] == '--latency-sizes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--latency-sizes" takes a colon separated list of sizes'
             )
         self.acbLatencyPkts = []
         for s in asArgs[iArg].split(':'):
             try:
                 cb = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--latency-sizes" value "%s" is not an integer' %
                     (s, ))
             if cb <= 0:
                 raise base.InvalidOption(
                     'The "--latency-sizes" value "%s" is zero or negative'
                     % (s, ))
             self.acbLatencyPkts.append(cb)
     elif asArgs[iArg] == '--throughput-sizes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--throughput-sizes" takes a colon separated list of sizes'
             )
         self.acbThroughputPkts = []
         for s in asArgs[iArg].split(':'):
             try:
                 cb = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--throughput-sizes" value "%s" is not an integer'
                     % (s, ))
             if cb <= 0:
                 raise base.InvalidOption(
                     'The "--throughput-sizes" value "%s" is zero or negative'
                     % (s, ))
             self.acbThroughputPkts.append(cb)
     elif asArgs[iArg] == '--test-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-vms" takes colon separated list')
         self.asTestVMs = asArgs[iArg].split(':')
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)))
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log(
                     'warning: The "--test-vms" value "%s" does not specify any of our test VMs.'
                     % (s))
     elif asArgs[iArg] == '--quick':
         self.cSecsRun = 5
         self.asVirtModes = [
             'hwvirt',
         ]
         self.acCpus = [
             1,
         ]
         self.acbLatencyPkts = [
             32,
         ]
         self.acbThroughputPkts = [
             8192,
         ]
         self.asTestVMs = [
             'tst-rhel5',
             'tst-win2k3ent',
             'tst-sol10',
         ]
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 19
0
 def parseOption(self, asArgs, iArg):
     if asArgs[iArg] == '--virt-modes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--virt-modes" takes a colon separated list of modes')
         self.asVirtModes = asArgs[iArg].split(':')
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)))
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--cpu-counts" takes a colon separated list of cpu counts'
             )
         self.acCpus = []
         for s in asArgs[iArg].split(':'):
             try:
                 c = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is not an integer' %
                     (s, ))
             if c <= 0:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is zero or negative' %
                     (s, ))
             self.acCpus.append(c)
     elif asArgs[iArg] == '--test-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-vms" takes colon separated list')
         if asArgs[iArg]:
             self.asTestVMs = asArgs[iArg].split(':')
             for s in self.asTestVMs:
                 if s not in self.asTestVMsDef:
                     raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                         % (s, ' '.join(self.asTestVMsDef)))
         else:
             self.asTestVMs = []
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log(
                     'warning: The "--skip-vms" value "%s" does not specify any of our test VMs.'
                     % (s))
     elif asArgs[iArg] == '--tests':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--tests" takes colon separated list')
         self.asTests = asArgs[iArg].split(':')
         for s in self.asTests:
             if s not in self.asTestsDef:
                 reporter.log(
                     'warning: The "--tests" value "%s" does not specify any of our tests.'
                     % (s))
     elif asArgs[iArg] == '--skip-tests':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-tests" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipTests:
             if s not in self.asTestsDef:
                 reporter.log(
                     'warning: The "--skip-tests" value "%s" does not specify any of our tests.'
                     % (s))
     elif asArgs[iArg] == '--quick':
         self.asVirtModes = [
             'hwvirt',
         ]
         self.acCpus = [
             1,
         ]
         #self.asTestVMs          = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10',];
         self.asTestVMs = [
             'tst-rhel5',
         ]
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 20
0
    def actionConfig(self, oTestDrv, eNic0AttachType = None, sDvdImage = None):
        """
        For base.TestDriver.actionConfig. Configure the VMs with defaults and
        a few tweaks as per arguments.

        Returns True if successful.
        Returns False if not.
        """

        # Check if --paravirt-modes option was specified and it meets requirements.
        if self.asParavirtModes is not None:
            iNumberOfActivatedVMs = len([item for item in self.aoTestVms if item.fSkip is not True])
            if iNumberOfActivatedVMs != 1:
                raise base.InvalidOption('The --paravirt-modes option assumes that the only one VM '
                                         'is activated in test VMs set while %d are active.' % iNumberOfActivatedVMs)

        for oTestVm in self.aoTestVms:
            if oTestVm.fSkip:
                continue;

            # At this point we know that if --paravirt-modes option was specified, there is only one VM in set.
            if self.asParavirtModes is not None:
                for sMode in self.asParavirtModes:
                    if sMode not in g_kdaParavirtProvidersSupported[oTestVm.sGuestOsType]:
                        raise base.InvalidOption('Paravirtualisation provider "%s" is not supported by current guest OS.' % sMode)
                # At this point oTestVm' asParavirtModes might be safely overwritten.
                oTestVm.asParavirtModes = self.asParavirtModes

            if oTestVm.fSnapshotRestoreCurrent:
                # If we want to restore a VM we don't need to create
                # the machine anymore -- so just add it to the test VM list.
                oVM = oTestDrv.addTestMachine(oTestVm.sVmName);
            else:
                ## @todo This could possibly be moved to the TestVM object.
                if sDvdImage is not None:
                    sMyDvdImage = sDvdImage;
                else:
                    sMyDvdImage = oTestVm.sDvdImage;

                if eNic0AttachType is not None:
                    eMyNic0AttachType = eNic0AttachType;
                elif oTestVm.sNic0AttachType is None:
                    eMyNic0AttachType = None;
                elif oTestVm.sNic0AttachType == 'nat':
                    eMyNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
                elif oTestVm.sNic0AttachType == 'bridged':
                    eMyNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
                else:
                    assert False, oTestVm.sNic0AttachType;

                oVM = oTestDrv.createTestVM(oTestVm.sVmName, 1, \
                                            sHd                = oTestVm.sHd, \
                                            sKind              = oTestVm.sKind, \
                                            fIoApic            = oTestVm.fIoApic, \
                                            fPae               = oTestVm.fPae, \
                                            eNic0AttachType    = eMyNic0AttachType, \
                                            sDvdImage          = sMyDvdImage, \
                                            sHddControllerType = oTestVm.sHddControllerType,
                                            sFloppy            = oTestVm.sFloppy,
                                            fVmmDevTestingPart = oTestVm.fVmmDevTestingPart,
                                            fVmmDevTestingMmio = oTestVm.fVmmDevTestingPart);
            if oVM is None:
                return False;

        return True;
Exemplo n.º 21
0
    def parseOption(self, asArgs, iArg):
        """
        Parses the set test vm set options (--test-vms and --skip-vms), modifying the set
        Invoked by the testdriver method with the same name.

        Keyword arguments:
        asArgs -- The argument vector.
        iArg   -- The index of the current argument.

        Returns iArg if the option was not recognized and the caller should handle it.
        Returns the index of the next argument when something is consumed.

        In the event of a syntax error, a InvalidOption or QuietInvalidOption
        is thrown.
        """

        if asArgs[iArg] == '--virt-modes':
            iArg += 1;
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');

            self.asVirtModes = asArgs[iArg].split(':');
            for s in self.asVirtModes:
                if s not in self.asVirtModesDef:
                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                        % (s, ' '.join(self.asVirtModesDef)));

        elif asArgs[iArg] == '--skip-virt-modes':
            iArg += 1;
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--skip-virt-modes" takes a colon separated list of modes');

            for s in asArgs[iArg].split(':'):
                if s not in self.asVirtModesDef:
                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                        % (s, ' '.join(self.asVirtModesDef)));
                if s in self.asVirtModes:
                    self.asVirtModes.remove(s);

        elif asArgs[iArg] == '--cpu-counts':
            iArg += 1;
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');

            self.acCpus = [];
            for s in asArgs[iArg].split(':'):
                try: c = int(s);
                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
                self.acCpus.append(c);

        elif asArgs[iArg] == '--test-vms':
            iArg += 1;
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--test-vms" takes colon separated list');

            for oTestVm in self.aoTestVms:
                oTestVm.fSkip = True;

            asTestVMs = asArgs[iArg].split(':');
            for s in asTestVMs:
                oTestVm = self.findTestVmByName(s);
                if oTestVm is None:
                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                                             % (s, self.getAllVmNames(' ')));
                oTestVm.fSkip = False;

        elif asArgs[iArg] == '--skip-vms':
            iArg += 1;
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--skip-vms" takes colon separated list');

            asTestVMs = asArgs[iArg].split(':');
            for s in asTestVMs:
                oTestVm = self.findTestVmByName(s);
                if oTestVm is None:
                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s,));
                else:
                    oTestVm.fSkip = True;

        elif asArgs[iArg] == '--snapshot-restore-current':
            for oTestVm in self.aoTestVms:
                if oTestVm.fSkip is False:
                    oTestVm.fSnapshotRestoreCurrent = True;
                    reporter.log('VM "%s" will be restored.' % (oTestVm.sVmName));

        elif asArgs[iArg] == '--paravirt-modes':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes');

            # Check and remember specified paravirtualisation providers list.
            self.asParavirtModes = asArgs[iArg].split(':')

            for sMode in self.asParavirtModes:
                if sMode not in (g_ksParavirtProviderNone, g_ksParavirtProviderDefault,
                                 g_ksParavirtProviderLegacy, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV):
                    raise base.InvalidOption('Bad paravirtualisation provider specified: %s' % sMode);

        else:
            return iArg;
        return iArg + 1;
Exemplo n.º 22
0
    def parseOption(self, asArgs, iArg):
        """
        Parses the audio test driver-specific command line options.
        """
        if asArgs[iArg] == '--runningvmname':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('The "--runningvmname" needs VM name')

            self.sRunningVmName = asArgs[iArg]
        elif asArgs[iArg] == '--audio-tests':
            iArg += 1
            if asArgs[iArg] == 'all':  # Nice for debugging scripts.
                self.asTests = self.asTestsDef
            else:
                self.asTests = asArgs[iArg].split(':')
                for s in self.asTests:
                    if s not in self.asTestsDef:
                        raise base.InvalidOption(
                            'The "--audio-tests" value "%s" is not valid; valid values are: %s'
                            % (s, ' '.join(self.asTestsDef)))
        elif asArgs[iArg] == '--audio-controller-type':
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('Option "%s" needs a value' %
                                         (asArgs[iArg - 1]))
            if    asArgs[iArg] == 'HDA' \
               or asArgs[iArg] == 'AC97' \
               or asArgs[iArg] == 'SB16':
                self.sAudioControllerType = asArgs[iArg]
            else:
                raise base.InvalidOption(
                    'The "--audio-controller-type" value "%s" is not valid' %
                    (asArgs[iArg]))
        elif    asArgs[iArg] == '--audio-test-count' \
             or asArgs[iArg] == '--audio-test-tone-duration':
            # Strip the "--audio-test-" prefix and keep the options as defined in VKAT,
            # e.g. "--audio-test-count" -> "--count". That way we don't
            # need to do any special argument translation and whatnot.
            self.asVkatTestArgs.extend(
                ['--' + asArgs[iArg][len('--audio-test-'):]])
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('Option "%s" needs a value' %
                                         (asArgs[iArg - 1]))
            self.asVkatTestArgs.extend([asArgs[iArg]])
        elif    asArgs[iArg] == '--audio-verify-max-diff-count' \
             or asArgs[iArg] == '--audio-verify-max-diff-percent' \
             or asArgs[iArg] == '--audio-verify-max-size-percent':
            # Strip the "--audio-verify-" prefix and keep the options as defined in VKAT,
            # e.g. "--audio-verify-max-diff-count" -> "--max-diff-count". That way we don't
            # need to do any special argument translation and whatnot.
            self.asVkatVerifyArgs.extend(
                ['--' + asArgs[iArg][len('--audio-verify-'):]])
            iArg += 1
            if iArg >= len(asArgs):
                raise base.InvalidOption('Option "%s" needs a value' %
                                         (asArgs[iArg - 1]))
            self.asVkatVerifyArgs.extend([asArgs[iArg]])
        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg)
        return iArg + 1
Exemplo n.º 23
0
 def parseOption(self, asArgs, iArg):  # pylint: disable=R0912,R0915
     if asArgs[iArg] == '--virt-modes':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--virt-modes" takes a colon separated list of modes')
         self.asVirtModes = asArgs[iArg].split(':')
         for s in self.asVirtModes:
             if s not in self.asVirtModesDef:
                 raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asVirtModesDef)))
     elif asArgs[iArg] == '--cpu-counts':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--cpu-counts" takes a colon separated list of cpu counts'
             )
         self.acCpus = []
         for s in asArgs[iArg].split(':'):
             try:
                 c = int(s)
             except:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is not an integer' %
                     (s, ))
             if c <= 0:
                 raise base.InvalidOption(
                     'The "--cpu-counts" value "%s" is zero or negative' %
                     (s, ))
             self.acCpus.append(c)
     elif asArgs[iArg] == '--storage-ctrls':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--storage-ctrls" takes a colon separated list of Storage controller types'
             )
         self.asStorageCtrls = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--host-io-cache':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--host-io-cache" takes a colon separated list of I/O cache settings'
             )
         self.asHostIoCache = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--disk-formats':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--disk-formats" takes a colon separated list of disk formats'
             )
         self.asDiskFormats = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--disk-variants':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--disk-variants" takes a colon separated list of disk variants'
             )
         self.asDiskVariants = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--iscsi-targets':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--iscsi-targets" takes a colon separated list of iscsi targets'
             )
         self.asIscsiTargets = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--tests':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--tests" takes a colon separated list of tests to run'
             )
         self.asTests = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--test-sets':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-sets" takes a colon separated list of test sets'
             )
         self.asTestSets = asArgs[iArg].split(':')
     elif asArgs[iArg] == '--diff-levels':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--diff-levels" takes an integer')
         try:
             self.cDiffLvls = int(asArgs[iArg])
         except:
             raise base.InvalidOption(
                 'The "--diff-levels" value "%s" is not an integer' %
                 (asArgs[iArg], ))
     elif asArgs[iArg] == '--test-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--test-vms" takes colon separated list')
         self.asTestVMs = asArgs[iArg].split(':')
         for s in self.asTestVMs:
             if s not in self.asTestVMsDef:
                 raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
                     % (s, ' '.join(self.asTestVMsDef)))
     elif asArgs[iArg] == '--skip-vms':
         iArg += 1
         if iArg >= len(asArgs):
             raise base.InvalidOption(
                 'The "--skip-vms" takes colon separated list')
         self.asSkipVMs = asArgs[iArg].split(':')
         for s in self.asSkipVMs:
             if s not in self.asTestVMsDef:
                 reporter.log(
                     'warning: The "--test-vms" value "%s" does not specify any of our test VMs.'
                     % (s))
     elif asArgs[iArg] == '--test-host':
         self.fTestHost = True
     elif asArgs[iArg] == '--use-scratch':
         self.fUseScratch = True
     elif asArgs[iArg] == '--always-wipe-storage-cfg':
         self.fRecreateStorCfg = True
     elif asArgs[iArg] == '--dont-wipe-storage-cfg':
         self.fRecreateStorCfg = False
     elif asArgs[iArg] == '--report-benchmark-results':
         self.fReportBenchmarkResults = True
     elif asArgs[iArg] == '--dont-report-benchmark-results':
         self.fReportBenchmarkResults = False
     else:
         return vbox.TestDriver.parseOption(self, asArgs, iArg)
     return iArg + 1
Exemplo n.º 24
0
    def parseOption(self, asArgs, iArg):
        """
        Extend standard options set
        """

        if asArgs[iArg] == '--parallel':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            self.cInParallel = int(asArgs[iArg]);
            if self.cInParallel <= 0:
                self.cInParallel = 1;
        elif asArgs[iArg] == '--select':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            self.aoSelectedVms = [];
            for sTestVm in asArgs[iArg].split(':'):
                oTestVm = self.oTestVmSet.findTestVmByName(sTestVm);
                if not oTestVm:
                    raise base.InvalidOption('Unknown test VM: %s'  % (sTestVm,));
                self.aoSelectedVms.append(oTestVm);
        elif asArgs[iArg] == '--copy':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            asNames = asArgs[iArg].split('=');
            if len(asNames) != 2 or not asNames[0] or not asNames[1]:
                raise base.InvalidOption('The --copy option expects value on the form "old=new": %s'  % (asArgs[iArg],));
            oOldTestVm = self.oTestVmSet.findTestVmByName(asNames[0]);
            if not oOldTestVm:
                raise base.InvalidOption('Unknown test VM: %s'  % (asNames[0],));
            oNewTestVm = copy.deepcopy(oOldTestVm);
            oNewTestVm.sVmName = asNames[1];
            self.oTestVmSet.aoTestVms.append(oNewTestVm);
            self.aoSelectedVms = [oNewTestVm];
        elif asArgs[iArg] == '--guest-type':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            for oTestVm in self.aoSelectedVms:
                oTestVm.sKind = asArgs[iArg];
        elif asArgs[iArg] == '--install-iso':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            for oTestVm in self.aoSelectedVms:
                oTestVm.sInstallIso = asArgs[iArg];
        elif asArgs[iArg] == '--ram-adjust':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            for oTestVm in self.aoSelectedVms:
                oTestVm.iOptRamAdjust = int(asArgs[iArg]);
        elif asArgs[iArg] == '--max-cpus':
            iArg = self.requireMoreArgs(1, asArgs, iArg);
            for oTestVm in self.aoSelectedVms:
                oTestVm.iOptMaxCpus = int(asArgs[iArg]);
        elif asArgs[iArg] == '--set-extradata':
            iArg = self.requireMoreArgs(1, asArgs, iArg)
            sExtraData = asArgs[iArg];
            try:     _, _ = sExtraData.split(':');
            except: raise base.InvalidOption('Invalid extradata specified: %s' % (sExtraData, ));
            for oTestVm in self.aoSelectedVms:
                oTestVm.asOptExtraData.append(sExtraData);
        elif asArgs[iArg] == '--ioapic':
            for oTestVm in self.aoSelectedVms:
                oTestVm.fOptIoApic = True;
        elif asArgs[iArg] == '--no-ioapic':
            for oTestVm in self.aoSelectedVms:
                oTestVm.fOptIoApic = False;
        elif asArgs[iArg] == '--pae':
            for oTestVm in self.aoSelectedVms:
                oTestVm.fOptPae = True;
        elif asArgs[iArg] == '--no-pae':
            for oTestVm in self.aoSelectedVms:
                oTestVm.fOptPae = False;
        elif asArgs[iArg] == '--install-additions':
            for oTestVm in self.aoSelectedVms:
                oTestVm.fOptInstallAdditions = True;
        elif asArgs[iArg] == '--no-install-additions':
            for oTestVm in self.aoSelectedVms:
                oTestVm.fOptInstallAdditions = False;
        else:
            return vbox.TestDriver.parseOption(self, asArgs, iArg);
        return iArg + 1;