VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/benchmarks/tdBenchmark1.py@ 103914

Last change on this file since 103914 was 98651, checked in by vboxsync, 22 months ago

ValKit: pylint 2.16.2: checks for file

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdBenchmark1.py 98651 2023-02-20 13:10:54Z vboxsync $
4
5"""
6VirtualBox Validation Kit - Test that runs various benchmarks.
7"""
8
9__copyright__ = \
10"""
11Copyright (C) 2010-2023 Oracle and/or its affiliates.
12
13This file is part of VirtualBox base platform packages, as
14available from https://www.virtualbox.org.
15
16This program is free software; you can redistribute it and/or
17modify it under the terms of the GNU General Public License
18as published by the Free Software Foundation, in version 3 of the
19License.
20
21This program is distributed in the hope that it will be useful, but
22WITHOUT ANY WARRANTY; without even the implied warranty of
23MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24General Public License for more details.
25
26You should have received a copy of the GNU General Public License
27along with this program; if not, see <https://www.gnu.org/licenses>.
28
29The contents of this file may alternatively be used under the terms
30of the Common Development and Distribution License Version 1.0
31(CDDL), a copy of it is provided in the "COPYING.CDDL" file included
32in the VirtualBox distribution, in which case the provisions of the
33CDDL are applicable instead of those of the GPL.
34
35You may elect to license modified versions of this file under the
36terms and conditions of either the GPL or the CDDL or both.
37
38SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
39"""
40__version__ = "$Revision: 98651 $"
41
42
43# Standard Python imports.
44import os;
45import sys;
46
47# Only the main script needs to modify the path.
48try: __file__ # pylint: disable=used-before-assignment
49except: __file__ = sys.argv[0];
50g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
51sys.path.append(g_ksValidationKitDir);
52
53# Validation Kit imports.
54from testdriver import reporter;
55from testdriver import vbox;
56from testdriver import vboxtestvms;
57
58
59class tdBenchmark1(vbox.TestDriver):
60 """
61 Benchmark #1.
62 """
63
64 def __init__(self):
65 vbox.TestDriver.__init__(self);
66 oTestVm = vboxtestvms.BootSectorTestVm(self.oTestVmSet, 'tst-bs-test1',
67 os.path.join(self.sVBoxBootSectors, 'bootsector2-test1.img'));
68 self.oTestVmSet.aoTestVms.append(oTestVm);
69
70
71 #
72 # Overridden methods.
73 #
74
75
76 def actionConfig(self):
77 self._detectValidationKit();
78 return self.oTestVmSet.actionConfig(self);
79
80 def actionExecute(self):
81 return self.oTestVmSet.actionExecute(self, self.testOneCfg);
82
83
84
85 #
86 # Test execution helpers.
87 #
88
89 def testOneCfg(self, oVM, oTestVm):
90 """
91 Runs the specified VM thru the tests.
92
93 Returns a success indicator on the general test execution. This is not
94 the actual test result.
95 """
96 fRc = False;
97
98 sXmlFile = self.prepareResultFile();
99 asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile];
100
101 self.logVmInfo(oVM);
102 oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv);
103 if oSession is not None:
104 cMsTimeout = 15*60*1000;
105 if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
106 cMsTimeout = self.adjustTimeoutMs(180 * 60000);
107
108 oRc = self.waitForTasks(cMsTimeout);
109 if oRc == oSession:
110 fRc = oSession.assertPoweredOff();
111 else:
112 reporter.error('oRc=%s, expected %s' % (oRc, oSession));
113
114 reporter.addSubXmlFile(sXmlFile);
115 self.terminateVmBySession(oSession);
116 return fRc;
117
118
119
120if __name__ == '__main__':
121 sys.exit(tdBenchmark1().main(sys.argv));
122
Note: See TracBrowser for help on using the repository browser.

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