VirtualBox

Ignore:
Timestamp:
Jan 30, 2018 5:46:55 PM (7 years ago)
Author:
vboxsync
Message:

ValidationKit: Turn all API tests into sub-tests which can still be run separately. tdApi1.py runs them all in one go.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/api/tdTreeDepth1.py

    r69111 r70812  
    4242
    4343# Validation Kit imports.
     44from testdriver import base
    4445from testdriver import reporter
    45 from testdriver import vbox
    4646from testdriver import vboxcon
    4747
    4848
    49 class tdTreeDepth1(vbox.TestDriver):
     49class SubTstDrvTreeDepth1(base.SubTestDriverBase):
    5050    """
    51     Medium and Snapshot Tree Depth Test #1.
     51    Sub-test driver for Medium and Snapshot Tree Depth Test #1.
    5252    """
    5353
    54     def __init__(self):
    55         vbox.TestDriver.__init__(self)
    56         self.asRsrcs            = None
     54    def __init__(self, oTstDrv):
     55        base.SubTestDriverBase.__init__(self, 'tree-depth', oTstDrv)
    5756
    58 
    59     #
    60     # Overridden methods.
    61     #
    62 
    63     def actionConfig(self):
     57    def testIt(self):
    6458        """
    65         Import the API.
    66         """
    67         if not self.importVBoxApi():
    68             return False
    69         return True
    70 
    71     def actionExecute(self):
    72         """
    73         Execute the testcase.
     59        Execute the sub-testcase.
    7460        """
    7561        return  self.testMediumTreeDepth() \
     
    8773
    8874        try:
    89             oVM = self.createTestVM('test-medium', 1, None, 4)
     75            oVM = self.oTstDrv.createTestVM('test-medium', 1, None, 4)
    9076            assert oVM is not None
    9177
    9278            # create chain with 300 disk images (medium tree depth limit)
    9379            fRc = True
    94             oSession = self.openSession(oVM)
     80            oSession = self.oTstDrv.openSession(oVM)
    9581            for i in range(1, 301):
    96                 sHddPath = os.path.join(self.sScratchPath, 'Test' + str(i) + '.vdi')
     82                sHddPath = os.path.join(self.oTstDrv.sScratchPath, 'Test' + str(i) + '.vdi')
    9783                if i is 1:
    9884                    oHd = oSession.createBaseHd(sHddPath, cb=1024*1024)
     
    11298            reporter.log('unregistering VM')
    11399            oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
    114             oVBox = self.oVBoxMgr.getVirtualBox()
     100            oVBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
    115101            reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
    116102            oVM = oVBox.openMachine(sSettingsFile)
     
    129115
    130116        try:
    131             oVM = self.createTestVM('test-snap', 1, None, 4)
     117            oVM = self.oTstDrv.createTestVM('test-snap', 1, None, 4)
    132118            assert oVM is not None
    133119
    134120            # modify the VM config, create and attach empty HDD
    135             oSession = self.openSession(oVM)
    136             sHddPath = os.path.join(self.sScratchPath, 'TestSnapEmpty.vdi')
     121            oSession = self.oTstDrv.openSession(oVM)
     122            sHddPath = os.path.join(self.oTstDrv.sScratchPath, 'TestSnapEmpty.vdi')
    137123            fRc = True
    138124            fRc = fRc and oSession.createAndAttachHd(sHddPath, cb=1024*1024, sController='SATA Controller', fImmutable=False)
     
    148134            reporter.log('unregistering VM')
    149135            oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
    150             oVBox = self.oVBoxMgr.getVirtualBox()
     136            oVBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
    151137            reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
    152138            oVM = oVBox.openMachine(sSettingsFile)
     
    160146
    161147if __name__ == '__main__':
    162     sys.exit(tdTreeDepth1().main(sys.argv))
     148    sys.path.append(os.path.dirname(os.path.abspath(__file__)))
     149    from tdApi1 import tdApi1
     150    oTstDrv = tdApi1()
     151    oTstDrv.addSubTestDriver(SubTstDrvTreeDepth1(oTstDrv))
     152    sys.exit(oTstDrv.main(sys.argv))
    163153
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette