tdCpuPae1.py revision cf22150eaeeb72431bf1cf65c309a431454fb22b
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox Validation Kit - Catch PAE not enabled.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncTest that switching into PAE mode when it isn't enable, check that it produces
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncthe right runtime error.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCopyright (C) 2010-2014 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThis file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncavailable from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncGeneral Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncFoundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynchope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThe contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncof the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync(CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncYou may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncterms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Standard Python imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Only the main script needs to modify the path.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncg_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncclass tdCpuPae1ConsoleCallbacks(vbox.ConsoleEventHandlerBase):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync For catching the PAE runtime error.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync vbox.ConsoleEventHandlerBase.__init__(self, dArgs, 'tdCpuPae1');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def onRuntimeError(self, fFatal, sErrId, sMessage):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync """ Verify the error. """
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log('onRuntimeError: fFatal=%s sErrId="%s" sMessage="%s"' % (fFatal, sErrId, sMessage));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testFailure('sErrId=%s, expected PAEmode' % (sErrId,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.testFailure('fFatal=%s, expected True' % (fFatal,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return None;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync PAE Test #1.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw',]
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Overridden methods.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync reporter.log(' Shorthand for: --virt-modes raw --cpu-counts 1 32');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync try: c = int(s);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return vbox.TestDriver.parseOption(self, asArgs, iArg);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Make sure vboxapi has been imported so we can use the constants.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Configure a VM with the PAE bootsector as floppy image.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oVM = self.createTestVM('tst-bs-pae', 2, sKind = 'Other', fVirtEx = False, fPae = False, \
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sFloppy = os.path.join(self.sVBoxBootSectors, 'bootsector-pae.img') );
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oVM is None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Execute the testcase.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Test execution helpers.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def test1OneCfg(self, oVM, cCpus, fHwVirt, fNestedPaging):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Runs the specified VM thru test #1.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Returns a success indicator on the general test execution. This is not
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync the actual test result.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Reconfigure the VM
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = fRc and oSession.setupBootLogo(True, 2500); # Race avoidance fudge.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync fRc = oSession.close() and fRc and True; # pychecker hack.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Zap the state (used by the callback).
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Start up.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oSession is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Set up a callback for catching the runtime error. !Races the guest bootup!
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oConsoleCallbacks = oSession.registerDerivedEventHandler(tdCpuPae1ConsoleCallbacks, {'oTstDrv':self,})
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oConsoleCallbacks is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync # Wait for 30 seconds for something to finish.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if oTask is not None:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Executes test #1 - Negative API testing.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ASSUMES that the VMs are