本文整理汇总了Python中testdriver.reporter.testDone函数的典型用法代码示例。如果您正苦于以下问题:Python testDone函数的具体用法?Python testDone怎么用?Python testDone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了testDone函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test1
def test1(self):
"""
Executes test #1 - Negative API testing.
ASSUMES that the VMs are
"""
reporter.testStart("Test 1")
oVM = self.getVmByName("tst-bs-pae")
for cCpus in self.acCpus:
if cCpus == 1:
reporter.testStart("1 cpu")
else:
reporter.testStart("%u cpus" % (cCpus))
for sVirtMode in self.asVirtModes:
if sVirtMode == "raw" and cCpus > 1:
continue
hsVirtModeDesc = {}
hsVirtModeDesc["raw"] = "Raw-mode"
hsVirtModeDesc["hwvirt"] = "HwVirt"
hsVirtModeDesc["hwvirt-np"] = "NestedPaging"
reporter.testStart(hsVirtModeDesc[sVirtMode])
fHwVirt = sVirtMode != "raw"
fNestedPaging = sVirtMode == "hwvirt-np"
self.test1OneCfg(oVM, cCpus, fHwVirt, fNestedPaging)
reporter.testDone()
reporter.testDone()
return reporter.testDone()[1] == 0
示例2: testBenchmark
def testBenchmark(self, sTargetOs, sBenchmark, sMountpoint, oExecutor):
"""
Runs the given benchmark on the test host.
"""
# Create a basic config
dCfg = {
'RecordSize': '64k',
'TestsetSize': '100m',
'QueueDepth': '32',
'FilePath': sMountpoint,
'TargetOs': sTargetOs
};
oTst = None;
if sBenchmark == 'iozone':
oTst = IozoneTest(oExecutor, dCfg);
elif sBenchmark == 'fio':
oTst = FioTest(oExecutor, dCfg); # pylint: disable=R0204
if oTst is not None:
reporter.testStart(sBenchmark);
fRc = oTst.prepare();
if fRc:
fRc = oTst.run();
if fRc:
fRc = oTst.reportResult();
else:
reporter.testFailure('Running the testcase failed');
else:
reporter.testFailure('Preparing the testcase failed');
oTst.cleanup();
reporter.testDone();
return fRc;
示例3: testOneVmConfig
def testOneVmConfig(self, oVM, oTestVm):
"""
Install guest OS and wait for result
"""
self.logVmInfo(oVM)
reporter.testStart('Installing %s' % (oTestVm.sVmName,))
cMsTimeout = 40*60000;
if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
cMsTimeout = 180 * 60000; # will be adjusted down.
oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
if oSession is not None:
# The guest has connected to TXS, so we're done (for now anyways).
reporter.log('Guest reported success')
## @todo Do save + restore.
reporter.testDone()
fRc = self.terminateVmBySession(oSession)
return fRc is True
reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
oTestVm.detatchAndDeleteHd(self); # Save space.
reporter.testDone()
return False
示例4: test2OneVM
def test2OneVM(self, sVmBaseName, asSupVirtModes = None, rSupCpus = range(1, 256)):
"""
Runs one VM (a pair really) thru the various configurations.
"""
if asSupVirtModes is None:
asSupVirtModes = self.asVirtModes;
reporter.testStart(sVmBaseName);
for cCpus in self.acCpus:
if cCpus == 1: reporter.testStart('1 cpu');
else: reporter.testStart('%u cpus' % (cCpus));
for sVirtMode in self.asVirtModes:
if sVirtMode == 'raw' and cCpus > 1:
continue;
if cCpus not in rSupCpus:
continue;
if sVirtMode not in asSupVirtModes:
continue;
hsVirtModeDesc = {};
hsVirtModeDesc['raw'] = 'Raw-mode';
hsVirtModeDesc['hwvirt'] = 'HwVirt';
hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
reporter.testStart(hsVirtModeDesc[sVirtMode]);
fHwVirt = sVirtMode != 'raw';
fNestedPaging = sVirtMode == 'hwvirt-np';
self.test2OneCfg(sVmBaseName, cCpus, fHwVirt, fNestedPaging);
reporter.testDone();
reporter.testDone();
return reporter.testDone()[1] == 0;
示例5: test1
def test1(self):
"""
Executes test #1 - Negative API testing.
ASSUMES that the VMs are
"""
reporter.testStart('Test 1');
oVM = self.getVmByName('tst-bs-pae');
for cCpus in self.acCpus:
if cCpus == 1: reporter.testStart('1 cpu');
else: reporter.testStart('%u cpus' % (cCpus));
for sVirtMode in self.asVirtModes:
if sVirtMode == 'raw' and cCpus > 1:
continue;
hsVirtModeDesc = {};
hsVirtModeDesc['raw'] = 'Raw-mode';
hsVirtModeDesc['hwvirt'] = 'HwVirt';
hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
reporter.testStart(hsVirtModeDesc[sVirtMode]);
fHwVirt = sVirtMode != 'raw';
fNestedPaging = sVirtMode == 'hwvirt-np';
self.test1OneCfg(oVM, cCpus, fHwVirt, fNestedPaging);
reporter.testDone();
reporter.testDone();
return reporter.testDone()[1] == 0;
示例6: test1Sub7
def test1Sub7(self, oVmSrc, oVmDst):
"""
Test the password check.
"""
reporter.testStart('Bad password')
if self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
# Start the target VM.
oSessionDst, oProgressDst = self.startVmEx(
oVmDst, fWait=False)
if oSessionDst is not None:
if oProgressDst.waitForOperation(iOperation=-3) == 0:
# Start the source VM.
oSessionSrc = self.startVm(oVmSrc)
if oSessionSrc is not None:
tsPasswords = (
'password-bad',
'passwor',
'pass',
'p',
'',
'Password',
)
for sPassword in tsPasswords:
reporter.testStart(sPassword)
oProgressSrc = oSessionSrc.teleport(
'localhost', 6502, sPassword)
if oProgressSrc:
oProgressSrc.wait()
reporter.log(
'src: %s' % oProgressSrc.stringifyResult())
if oProgressSrc.isSuccess():
reporter.testFailure(
'IConsole::teleport succeeded with bad password "%s"'
% sPassword)
elif oProgressSrc.getErrInfoResultCode(
) != vbox.ComError.E_FAIL:
reporter.testFailure('IConsole::teleport returns %s instead of E_FAIL' \
% (vbox.ComError.toString(oProgressSrc.getErrInfoResultCode()),))
elif oProgressSrc.getErrInfoText(
) != 'Invalid password':
reporter.testFailure('IConsole::teleport returns "%s" instead of "Invalid password"' \
% (oProgressSrc.getErrInfoText(),))
elif oProgressDst.isCompleted():
reporter.testFailure('Destination completed unexpectedly after bad password "%s"' \
% sPassword)
else:
reporter.testFailure(
'IConsole::teleport failed with password "%s"'
% sPassword)
if reporter.testDone()[1] != 0:
break
self.terminateVmBySession(oSessionSrc, oProgressSrc)
self.terminateVmBySession(oSessionDst, oProgressDst)
else:
reporter.testFailure('reconfig failed')
return reporter.testDone()[1] == 0
示例7: testAutostartForOneVM
def testAutostartForOneVM(self, sVmName):
"""
Runs one VM thru the various configurations.
"""
reporter.testStart(sVmName);
fRc = True;
self.testAutostartOneCfg(sVmName);
reporter.testDone();
return fRc;
示例8: test1UploadFile
def test1UploadFile(self, oSession, oTxsSession):
"""
Uploads a test file to the test machine.
"""
reporter.testStart('Upload file');
fRc = self.txsUploadString(oSession, oTxsSession, self.sRndData, '${SCRATCH}/' + str(uuid.uuid4()), \
cMsTimeout = 3600 * 1000);
reporter.testDone(not fRc);
return fRc;
示例9: doTest
def doTest(self, oSession):
oConsole = oSession.console
oGuest = oConsole.guest
sOSTypeId = oGuest.OSTypeId.lower()
if sOSTypeId.find("win") == -1 :
reporter.log("Only Windows guests are currently supported")
reporter.testDone()
return True
oGuestSession = oGuest.createSession("Administrator", "password", "", "Audio Validation Kit")
guestSessionWaitResult = oGuestSession.waitFor(self.oVBoxMgr.constants.GuestSessionWaitResult_Start, 2000)
reporter.log("guestSessionWaitResult = %d" % guestSessionWaitResult)
for duration in range(3, 6):
reporter.testStart("Checking for duration of " + str(duration) + " seconds")
sPathToPlayer = "D:\\win\\" + ("amd64" if (sOSTypeId.find('_64') >= 0) else "x86") + "\\ntPlayToneWaveX.exe"
oProcess = oGuestSession.processCreate(sPathToPlayer, ["xxx0", "--total-duration-in-secs", str(duration)], [], [], 0)
processWaitResult = oProcess.waitFor(self.oVBoxMgr.constants.ProcessWaitForFlag_Start, 1000)
reporter.log("Started: pid %d, waitResult %d" % (oProcess.PID, processWaitResult))
processWaitResult = oProcess.waitFor(self.oVBoxMgr.constants.ProcessWaitForFlag_Terminate, 2 * duration * 1000)
reporter.log("Terminated: pid %d, waitResult %d" % (oProcess.PID, processWaitResult))
time.sleep(1) # Give audio backend sometime to save a stream to .wav file
absFileName = self.seekLatestAudioFileName(oGuestSession, duration)
if absFileName is None:
reporter.testFailure("Unable to find audio file")
continue
reporter.log("Checking audio file '" + absFileName + "'")
diff = self.checkGuestHostTimings(absFileName + ".timing")
if diff is not None:
if diff > 0.0: # Guest sends data quicker than a host can play
if diff > 0.01: # 1% is probably good threshold here
reporter.testFailure("Guest sends audio buffers too quickly")
else:
diff = -diff; # Much worse case: guest sends data very slow, host feels starvation
if diff > 0.005: # 0.5% is probably good threshold here
reporter.testFailure("Guest sends audio buffers too slowly")
reporter.testDone()
else:
reporter.testFailure("Unable to parse a file with timings")
oGuestSession.close()
del oGuest
del oConsole
return True
示例10: test1RunTestProgs
def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName, sGuestFs):
"""
Runs all the test programs on the test machine.
"""
_ = oSession;
reporter.testStart(sTestName);
sMkfsCmd = 'mkfs.' + sGuestFs;
# Prepare test disks, just create filesystem without partition
reporter.testStart('Preparation');
fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 1', 60000, \
'/sbin/' + sMkfsCmd,
(sMkfsCmd, '/dev/sdb'));
fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 2', 60000, \
'/sbin/' + sMkfsCmd,
(sMkfsCmd, '/dev/sdc'));
# Create test and scratch directory
fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/test', 10000, \
'/bin/mkdir',
('mkdir', '/mnt/test'));
fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/scratch', 10000, \
'/bin/mkdir',
('mkdir', '/mnt/scratch'));
# Mount test and scratch directory.
fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/test', 10000, \
'/bin/mount',
('mount', '/dev/sdb','/mnt/test'));
fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/scratch', 10000, \
'/bin/mount',
('mount', '/dev/sdc','/mnt/scratch'));
fRc = fRc and self.txsRunTest(oTxsSession, 'Copying xfstests', 10000, \
'/bin/cp',
('cp', '-r','${CDROM}/${OS.ARCH}/xfstests', '/tmp'));
reporter.testDone();
# Run xfstests (this sh + cd crap is required because the cwd for the script must be in the root
# of the xfstests directory...)
reporter.testStart('xfstests');
if fRc and 'xfstests' in self.asTests:
fRc = self.txsRunTest(oTxsSession, 'xfstests', 3600000, \
'/bin/sh',
('sh', '-c', '(cd /tmp/xfstests && ./check -g auto)'), \
('TEST_DIR=/mnt/test', 'TEST_DEV=/dev/sdb', 'SCRATCH_MNT=/mnt/scratch', 'SCRATCH_DEV=/dev/sdc', \
'FSTYP=' + sGuestFs));
reporter.testDone();
else:
reporter.testDone(fSkipped = True);
reporter.testDone(not fRc);
return fRc;
示例11: testOneVmConfig
def testOneVmConfig(self, oVM, oTestVm):
"""
Runs the specified VM thru test #1.
"""
for sUart in self.asUarts:
reporter.testStart(sUart);
# Reconfigure the VM
fRc = True;
oSession = self.openSession(oVM);
if oSession is not None:
fRc = oSession.enableSerialPort(0);
fRc = fRc and oSession.setExtraData("VBoxInternal/Devices/serial/0/Config/UartType", "string:" + sUart);
fRc = fRc and oSession.saveSettings();
fRc = oSession.close() and fRc;
oSession = None;
else:
fRc = False;
if fRc is True:
self.logVmInfo(oVM);
oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True);
if oSession is not None:
self.addTask(oTxsSession);
for sMode in self.asSerialModes:
reporter.testStart(sMode);
fRc = self.setupSerialMode(oSession, oTestVm, sMode);
if fRc:
for sTest in self.asSerialTests:
# Skip tests which don't work with the current mode.
if self.isModeCompatibleWithTest(sMode, sTest):
if sTest == 'Write':
fRc = self.testWrite(oSession, oTxsSession, oTestVm, sMode);
if sTest == 'ReadWrite':
fRc = self.testReadWrite(oSession, oTxsSession, oTestVm);
if self.oLoopback is not None:
self.oLoopback.shutdown();
self.oLoopback = None;
reporter.testDone();
self.removeTask(oTxsSession);
self.terminateVmBySession(oSession);
reporter.testDone();
return fRc;
示例12: test1Sub5
def test1Sub5(self, oVmSrc, oVmDst):
"""
Test that basic teleporting works.
xTracker: #4749
"""
reporter.testStart('Simple teleportation');
for cSecsX2 in range(0, 10):
if self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
# Start the target VM.
oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait = False);
if oSessionDst is not None:
if oProgressDst.waitForOperation(iOperation = -3) == 0:
# Start the source VM.
oSessionSrc = self.startVm(oVmSrc);
if oSessionSrc is not None:
self.sleep(cSecsX2 / 2);
# Try teleport.
oProgressSrc = oSessionSrc.teleport('localhost', 6502, 'password');
if oProgressSrc:
oProgressSrc.wait();
oProgressDst.wait();
self.terminateVmBySession(oSessionSrc, oProgressSrc);
self.terminateVmBySession(oSessionDst, oProgressDst);
else:
reporter.testFailure('reconfig failed');
return reporter.testDone()[1] == 0;
示例13: test1Sub3
def test1Sub3(self, oVM):
"""
Test that starting a teleportation target VM will fail if we give it
a bad address to bind to.
"""
reporter.testStart('bad IMachine::teleporterAddress');
# re-configure it with a bad bind-to address.
fRc = False;
oSession = self.openSession(oVM);
if oSession is not None:
fRc = oSession.setupTeleporter(True, uPort=6502, sAddress='no.such.hostname.should.ever.exist.duh');
if not oSession.saveSettings(fClose=True): fRc = False;
oSession = None;
if fRc:
# Try start it.
oSession, oProgress = self.startVmEx(oVM, fWait = False);
if oSession is not None:
oProgress.wait();
## TODO: exact error code and look for the IPRT right string.
if not oProgress.isCompleted() or oProgress.getResult() >= 0:
reporter.testFailure('%s' % (oProgress.stringifyResult(),));
self.terminateVmBySession(oSession, oProgress);
# put back the old teleporter setup.
self.test1ResetVmConfig(oVM, fTeleporterEnabled = True);
else:
reporter.testFailure('reconfig #1 failed');
return reporter.testDone()[1] == 0;
示例14: testSnapshotTreeDepth
def testSnapshotTreeDepth(self):
"""
Test snapshot tree depth.
"""
reporter.testStart('snapshotTreeDepth')
try:
oVM = self.createTestVM('test-snap', 1, None, 4)
assert oVM is not None
# modify the VM config, create and attach empty HDD
oSession = self.openSession(oVM)
sHddPath = os.path.join(self.sScratchPath, 'TestSnapEmpty.vdi')
fRc = True
fRc = fRc and oSession.createAndAttachHd(sHddPath, cb=1024*1024, sController='SATA Controller', fImmutable=False)
fRc = fRc and oSession.saveSettings()
# take 250 snapshots (snapshot tree depth limit)
for i in range(1, 251):
fRc = fRc and oSession.takeSnapshot('Snapshot ' + str(i))
fRc = oSession.close() and fRc
# unregister and re-register to test loading of settings
sSettingsFile = oVM.settingsFilePath
reporter.log('unregistering VM')
oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
oVBox = self.oVBoxMgr.getVirtualBox()
reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
oVM = oVBox.openMachine(sSettingsFile)
assert fRc is True
except:
reporter.errorXcpt()
return reporter.testDone()[1] == 0
示例15: test1
def test1(self):
"""
Executes test #1 - Negative API testing.
ASSUMES that the VMs are
"""
reporter.testStart('Test 1');
# Get the VMs.
#oVmHwVirt1 = self.getVmByName('tst-empty-hwvirt-1');
#oVmHwVirt2 = self.getVmByName('tst-empty-hwvirt-2');
oVmRaw1 = self.getVmByName('tst-empty-raw-1');
oVmRaw2 = self.getVmByName('tst-empty-raw-2');
# Reset their teleportation related configuration.
fRc = True;
#for oVM in (oVmHwVirt1, oVmHwVirt2, oVmRaw1, oVmRaw2):
for oVM in (oVmRaw1, oVmRaw2):
if not self.test1ResetVmConfig(oVM): fRc = False;
# Do the testing (don't both with fRc on the subtests).
if fRc:
self.test1Sub1(oVmRaw1);
self.test1Sub2(oVmRaw2);
self.test1Sub3(oVmRaw2);
self.test1Sub4(oVmRaw2);
self.processPendingEvents();
self.test1Sub5(oVmRaw1, oVmRaw2);
self.test1Sub6(oVmRaw1, oVmRaw2);
self.test1Sub7(oVmRaw1, oVmRaw2);
else:
reporter.testFailure('Failed to reset the VM configs')
return reporter.testDone()[1] == 0;