VirtualBox

Ignore:
Timestamp:
Jul 22, 2022 10:14:40 AM (2 years ago)
Author:
vboxsync
Message:

Validation Kit/tests/api/tdTreeDepth1.py: Added random selection of depth tests plus more logging in case something goes wrong (instead of just asserting).

File:
1 edited

Legend:

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

    r95779 r95786  
    7878            assert oVM is not None
    7979
    80             # create chain with 300 disk images (medium tree depth limit)
     80            # create chain with up to 64 disk images (medium tree depth limit)
    8181            fRc = True
    8282            oSession = self.oTstDrv.openSession(oVM)
    83             cImages = 38 #00
     83            cImages = random.randrange(1, 64);
     84            reporter.log('Creating chain with %d disk images' % (cImages))
    8485            for i in range(1, cImages + 1):
    8586                sHddPath = os.path.join(self.oTstDrv.sScratchPath, 'Test' + str(i) + '.vdi')
     
    121122            reporter.log('API reports %i base images' % (cBaseImages))
    122123            fRc = fRc and cBaseImages == 0
     124            if cBaseImages != 0:
     125                reporter.error('Got %d initial base images, expected %d' % (cBaseImages, 0));
    123126
    124127            # re-register to test loading of settings
     
    138141            reporter.log('API reports %i base images' % (cBaseImages))
    139142            fRc = fRc and cBaseImages == 0
    140 
    141             assert fRc is True
     143            if cBaseImages != 0:
     144                reporter.error('Got %d base images after unregistering, expected %d' % (cBaseImages, 0));
     145
    142146        except:
    143147            reporter.errorXcpt()
     
    163167            fRc = fRc and oSession.saveSettings()
    164168
    165             # take 250 snapshots (snapshot tree depth limit)
    166             cSnapshots = 13 #00
     169            # take up to 200 snapshots (255 is the snapshot tree depth limit)
     170            cSnapshots = random.randrange(1, 200); ## @todo r=andy BUGBUG When specifying 254 here, it fails with object 251.
     171            reporter.log('Taking %d snapshots' % (cSnapshots))
    167172            for i in range(1, cSnapshots + 1):
    168173                fRc = fRc and oSession.takeSnapshot('Snapshot ' + str(i))
     
    171176            reporter.log('API reports %i snapshots' % (oVM.snapshotCount))
    172177            fRc = fRc and oVM.snapshotCount == cSnapshots
    173 
    174             assert fRc is True
     178            if oVM.snapshotCount != cSnapshots:
     179                reporter.error('Got %d initial snapshots, expected %d' % (oVM.snapshotCount, cSnapshots));
    175180
    176181            # unregister, making sure the images are closed
     
    197202            reporter.log('API reports %i base images' % (cBaseImages))
    198203            fRc = fRc and cBaseImages == 0
     204            if cBaseImages != 0:
     205                reporter.error('Got %d initial base images, expected %d' % (cBaseImages, 0));
    199206
    200207            # re-register to test loading of settings
     
    207214            reporter.log('API reports %i snapshots' % (oVM.snapshotCount))
    208215            fRc = fRc and oVM.snapshotCount == cSnapshots
     216            if oVM.snapshotCount != cSnapshots:
     217                reporter.error('Got %d snapshots after re-registering, expected %d' % (oVM.snapshotCount, cSnapshots));
    209218
    210219            reporter.log('unregistering VM')
     
    215224            reporter.log('API reports %i base images' % (cBaseImages))
    216225            fRc = fRc and cBaseImages == 0
    217 
    218             assert fRc is True
     226            if cBaseImages != 0:
     227                reporter.error('Got %d base images after unregistering, expected %d' % (cBaseImages, 0));
    219228        except:
    220229            reporter.errorXcpt()
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