# -*- coding: utf-8 -*-
# $Id$
"""
VirtualBox Validation Kit - Medium and Snapshot Tree Depth Test #1
"""
__copyright__ = \
"""
Copyright (C) 2010-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
General Public License (GPL) as published by the Free Software
Foundation, in version 2 as it comes in the "COPYING" file of the
VirtualBox OSE distribution. VirtualBox OSE is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
The contents of this file may alternatively be used under the terms
of the Common Development and Distribution License Version 1.0
(CDDL) only, as it comes in the "COPYING.CDDL" file of the
VirtualBox OSE distribution, in which case the provisions of the
CDDL are applicable instead of those of the GPL.
You may elect to license modified versions of this file under the
terms and conditions of either the GPL or the CDDL or both.
"""
# Standard Python imports.
import os
import sys
# Only the main script needs to modify the path.
try: __file__
# Validation Kit imports.
"""
Medium and Snapshot Tree Depth Test #1.
"""
#
# Overridden methods.
#
"""
Import the API.
"""
if not self.importVBoxApi():
return False
return True
"""
Execute the testcase.
"""
return self.testMediumTreeDepth() \
and self.testSnapshotTreeDepth()
#
# Test execution helpers.
#
"""
Test medium tree depth.
"""
try:
assert oVM is not None
# create chain with 300 disk images (medium tree depth limit)
if i is 1:
else:
if oHd is None:
break
# modify the VM config, attach HDD
fRc = fRc and oSession.attachHd(sHddPath, sController='SATA Controller', fImmutable=False, fForceResource=False)
# unregister and re-register to test loading of settings
except:
"""
Test snapshot tree depth.
"""
try:
assert oVM is not None
# modify the VM config, create and attach empty HDD
fRc = fRc and oSession.createAndAttachHd(sHddPath, cb=1024*1024, sController='SATA Controller', fImmutable=False)
# take 250 snapshots (snapshot tree depth limit)
# unregister and re-register to test loading of settings
except:
if __name__ == '__main__':