tdGuestOsShutdown1.py revision 87f6c321b80edf7589024af7b4329c5869dd3fcb
# -*- coding: utf-8 -*-
"""
VMM Guest OS boot tests.
"""
__copyright__ = \
"""
Copyright (C) 2010-2014 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.
"""
__version__ = "$Revision$"
# Standard Python imports.
import os
import sys
import time
# Only the main script needs to modify the path.
try: __file__
# Validation Kit imports.
from testdriver import vbox
from testdriver import base
from testdriver import reporter
from testdriver import vboxcon
"""
VMM Unit Tests Set.
Scenario:
- Create VM that corresponds to Guest OS pre-installed on selected HDD
- Start VM and wait for TXS server connection (which is started after Guest successfully booted)
"""
ksSataController = 'SATA Controller'
ksIdeController = 'IDE Controller'
# VM parameters required to run HDD image.
# Format: { HDD image filename: (sKind, HDD controller type) }
kaoVmParams = {
}
# List of platforms which are able to suspend and resume host automatically.
# In order to add new platform, self._SuspendResume() should be adapted.
kasSuspendAllowedPlatforms = ( 'darwin' )
"""
Reinitialize child class instance.
"""
# TODO: that should be moved to some common place
#
# Overridden methods.
#
"""
Extend usage info
"""
return rc
"""
Extend standard options set
"""
iArg += 1
iArg += 1
iArg += 1
if iArg >= len(asArgs): raise base.InvalidOption('The "--suspend-time" option requires an argument')
iArg += 1
if iArg >= len(asArgs): raise base.InvalidOption('The "--shutdown-iters" option requires an argument')
else:
return iArg + 1
def getResourceSet(self):
"""
TESTBOX_PATH_RESOURCES.
"""
"""
Create VM
"""
# Get VM params specific to HDD image
# Create VM itself
oVM = \
assert oVM is not None
# Attach an HDD
# Enable HW virt
# Enable I/O APIC
# Enable Nested Paging
# Enable PAE
if (sNicTraceFile is not None):
# Remote desktop
return oVM
def actionConfig(self):
"""
Configure pre-conditions.
"""
if not self.importVBoxApi():
return False
# Save time: do not start VM if there is no way to suspend host
return False
return False
"""
Put host into sleep and automatically resume it after specified timeout.
"""
# Wait for host to wake up
return fRc == 0
def _waitKeyboardInterrupt(self):
"""
Idle loop until user press CTRL+C
"""
while (True):
try:
except KeyboardInterrupt:
break
def actionExecute(self):
"""
Execute the testcase itself.
"""
#self.logVmInfo(self.oVM)
cIter = 0
if oExtraSession is None or oExtraTxsSession is None:
return False
cIter += 1
if oSession is not None and oTxsSession is not None:
# Wait until guest reported success
else:
reporter.log('Put host to sleep and resume it automatically after %d seconds.' % self.cSecSuspendTime)
else:
else:
# Do not terminate failing VM in order to catch it.
break
else:
# Stop if fail
break
# Local catch at the end.
if __name__ == '__main__':