1 | #!/usr/bin/env python
|
---|
2 | # -*- coding: utf-8 -*-
|
---|
3 | # $Id: tdCpuIemInstr1.py 103221 2024-02-06 09:04:06Z vboxsync $
|
---|
4 |
|
---|
5 | """
|
---|
6 | VirtualBox Validation Kit - Test that runs various benchmarks.
|
---|
7 | """
|
---|
8 |
|
---|
9 | __copyright__ = \
|
---|
10 | """
|
---|
11 | Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
12 |
|
---|
13 | This file is part of VirtualBox base platform packages, as
|
---|
14 | available from https://www.virtualbox.org.
|
---|
15 |
|
---|
16 | This program is free software; you can redistribute it and/or
|
---|
17 | modify it under the terms of the GNU General Public License
|
---|
18 | as published by the Free Software Foundation, in version 3 of the
|
---|
19 | License.
|
---|
20 |
|
---|
21 | This program is distributed in the hope that it will be useful, but
|
---|
22 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
24 | General Public License for more details.
|
---|
25 |
|
---|
26 | You should have received a copy of the GNU General Public License
|
---|
27 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
28 |
|
---|
29 | The contents of this file may alternatively be used under the terms
|
---|
30 | of the Common Development and Distribution License Version 1.0
|
---|
31 | (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
32 | in the VirtualBox distribution, in which case the provisions of the
|
---|
33 | CDDL are applicable instead of those of the GPL.
|
---|
34 |
|
---|
35 | You may elect to license modified versions of this file under the
|
---|
36 | terms and conditions of either the GPL or the CDDL or both.
|
---|
37 |
|
---|
38 | SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
39 | """
|
---|
40 | __version__ = "$Revision: 103221 $"
|
---|
41 |
|
---|
42 |
|
---|
43 | # Standard Python imports.
|
---|
44 | import os;
|
---|
45 | import sys;
|
---|
46 |
|
---|
47 | # Only the main script needs to modify the path.
|
---|
48 | try: __file__ # pylint: disable=used-before-assignment
|
---|
49 | except: __file__ = sys.argv[0];
|
---|
50 | g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
|
---|
51 | sys.path.append(g_ksValidationKitDir);
|
---|
52 |
|
---|
53 | # Validation Kit imports.
|
---|
54 | from testdriver import reporter;
|
---|
55 | from testdriver import vbox;
|
---|
56 | from testdriver import vboxtestvms;
|
---|
57 |
|
---|
58 |
|
---|
59 | class IemTestVm(vboxtestvms.BootSectorTestVm):
|
---|
60 | """
|
---|
61 | A Boot Sector Test VM which is configured to run in IEM mode only.
|
---|
62 | """
|
---|
63 |
|
---|
64 | def __init__(self, oSet, oTestDriver, sVmName, asVirtModesSup = None, f64BitRequired = True):
|
---|
65 | vboxtestvms.BootSectorTestVm.__init__(self,
|
---|
66 | oSet,
|
---|
67 | 'tst-' + sVmName,
|
---|
68 | os.path.join(oTestDriver.sVBoxBootSectors, sVmName + '.img'),
|
---|
69 | asVirtModesSup,
|
---|
70 | f64BitRequired);
|
---|
71 |
|
---|
72 | class tdCpuIemInstr1(vbox.TestDriver):
|
---|
73 | """
|
---|
74 | CPU IEM instruction testcase #1.
|
---|
75 | """
|
---|
76 |
|
---|
77 | def __init__(self):
|
---|
78 | vbox.TestDriver.__init__(self);
|
---|
79 |
|
---|
80 | kaTestVMs = (
|
---|
81 | IemTestVm(self.oTestVmSet, self, 'bs3-cpu-basic-2'),
|
---|
82 |
|
---|
83 | # @todo r=aeichner Image can not be found (probably it is too large for a floppy weighing in at 16MiB)
|
---|
84 | #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-basic-3'),
|
---|
85 |
|
---|
86 | # @todo r=aeichner Fails currently in IEM
|
---|
87 | #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-decoding-1'),
|
---|
88 |
|
---|
89 | IemTestVm(self.oTestVmSet, self, 'bs3-cpu-generated-1'),
|
---|
90 |
|
---|
91 | IemTestVm(self.oTestVmSet, self, 'bs3-cpu-instr-2'),
|
---|
92 |
|
---|
93 | # @todo r=aeichner Fails with IEM currently.
|
---|
94 | #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-instr-3'),
|
---|
95 |
|
---|
96 | IemTestVm(self.oTestVmSet, self, 'bs3-cpu-state64-1'),
|
---|
97 | IemTestVm(self.oTestVmSet, self, 'bs3-cpu-weird-1'),
|
---|
98 | IemTestVm(self.oTestVmSet, self, 'bs3-fpustate-1')
|
---|
99 | );
|
---|
100 |
|
---|
101 | for oTestVm in kaTestVMs:
|
---|
102 | self.oTestVmSet.aoTestVms.append(oTestVm);
|
---|
103 |
|
---|
104 | #
|
---|
105 | # Overridden methods.
|
---|
106 | #
|
---|
107 |
|
---|
108 |
|
---|
109 | def actionConfig(self):
|
---|
110 | self._detectValidationKit();
|
---|
111 | return self.oTestVmSet.actionConfig(self);
|
---|
112 |
|
---|
113 | def actionExecute(self):
|
---|
114 | return self.oTestVmSet.actionExecute(self, self.testOneCfg);
|
---|
115 |
|
---|
116 |
|
---|
117 |
|
---|
118 | #
|
---|
119 | # Test execution helpers.
|
---|
120 | #
|
---|
121 |
|
---|
122 | def testOneCfg(self, oVM, oTestVm):
|
---|
123 | """
|
---|
124 | Runs the specified VM thru the tests.
|
---|
125 |
|
---|
126 | Returns a success indicator on the general test execution. This is not
|
---|
127 | the actual test result.
|
---|
128 | """
|
---|
129 |
|
---|
130 | fRc = False
|
---|
131 |
|
---|
132 | # Set up the result file
|
---|
133 | sXmlFile = self.prepareResultFile();
|
---|
134 | asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile, ];
|
---|
135 |
|
---|
136 | # Do the test:
|
---|
137 | self.logVmInfo(oVM);
|
---|
138 | oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv);
|
---|
139 | if oSession is not None:
|
---|
140 | cMsTimeout = 30 * 60000;
|
---|
141 | if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
|
---|
142 | cMsTimeout = self.adjustTimeoutMs(180 * 60000);
|
---|
143 |
|
---|
144 | oRc = self.waitForTasks(cMsTimeout);
|
---|
145 | if oRc == oSession:
|
---|
146 | fRc = oSession.assertPoweredOff();
|
---|
147 | else:
|
---|
148 | reporter.error('oRc=%s, expected %s' % (oRc, oSession));
|
---|
149 |
|
---|
150 | reporter.addSubXmlFile(sXmlFile);
|
---|
151 | self.terminateVmBySession(oSession);
|
---|
152 |
|
---|
153 | return fRc;
|
---|
154 |
|
---|
155 |
|
---|
156 |
|
---|
157 | if __name__ == '__main__':
|
---|
158 | sys.exit(tdCpuIemInstr1().main(sys.argv));
|
---|
159 |
|
---|