VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/cpu/tdCpuIemInstr1.py@ 102967

Last change on this file since 102967 was 102967, checked in by vboxsync, 14 months ago

ValidationKit/tests/cpu: Add very basic tdCpuIemInstr1.py testcase to run certain bootsector testcases automatically, bugref:10582 [remove comment]

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdCpuIemInstr1.py 102967 2024-01-19 11:31:41Z 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: 102967 $"
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 vboxcon;
57from testdriver import vboxtestvms;
58
59
60class IemTestVm(vboxtestvms.BootSectorTestVm):
61 """
62 A Boot Sector Test VM which is configured to run in IEM mode only.
63 """
64
65 def __init__(self, oSet, oTestDriver, sVmName, asVirtModesSup = None, f64BitRequired = True):
66 vboxtestvms.BootSectorTestVm.__init__(self,
67 oSet,
68 'tst-' + sVmName,
69 os.path.join(oTestDriver.sVBoxBootSectors, sVmName + '.img'),
70 asVirtModesSup,
71 f64BitRequired);
72
73 def _childVmReconfig(self, oTestDrv, oVM, oSession):
74 _ = oTestDrv;
75
76 fRc = oSession.setExtraData('VBoxInternal/EM/IemExecutesAll', '1');
77 if fRc:
78 if oVM.platform.x86.getHWVirtExProperty(vboxcon.HWVirtExPropertyType_NestedPaging):
79 fRc = oSession.setExtraData('VBoxInternal/EM/IemRecompiled', '1');
80 else:
81 fRc = oSession.setExtraData('VBoxInternal/EM/IemRecompiled', '0');
82
83 return fRc;
84
85class tdCpuIemInstr1(vbox.TestDriver):
86 """
87 CPU IEM instruction testcase #1.
88 """
89
90 def __init__(self):
91 vbox.TestDriver.__init__(self);
92
93 #
94 # There is no official IEM support in the virt modes yet, so hwvirt is interpreted IEM
95 # and hwvirt-np is recompiled IEM for now (gets configured in the IemTestVm class).
96 #
97 asVirtModesSup = [ 'hwvirt', 'hwvirt-np' ];
98
99 kaTestVMs = (
100 # @todo r=aeichner Crashes in ASMAtomicXchgU16, unaligned pointer, see @bugref{10547}.
101 #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-basic-2', asVirtModesSup),
102
103 # @todo r=aeichner Fails currently in IEM
104 #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-decoding-1', asVirtModesSup),
105
106 # @todo r=aeichner Fails and hangs in 'lm64' / aaa
107 #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-generated-1', asVirtModesSup),
108
109 # @todo r=aeichner Image can not be found (probably it is too large for a floppy weighing in at 16MiB)
110 #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-basic-3', asVirtModesSup),
111
112 IemTestVm(self.oTestVmSet, self, 'bs3-cpu-instr-2', asVirtModesSup),
113
114 # @todo r=aeichner Fails with IEM currently.
115 #IemTestVm(self.oTestVmSet, self, 'bs3-cpu-instr-3' asVirtModesSup),
116
117 # @todo r=aeichner Hangs after test.
118 #IemTestVm(self.oTestVmSet, self, 'b3s-cpu-state64-1', asVirtModesSup),
119
120 IemTestVm(self.oTestVmSet, self, 'bs3-cpu-weird-1', asVirtModesSup)
121 );
122
123 for oTestVm in kaTestVMs:
124 self.oTestVmSet.aoTestVms.append(oTestVm);
125
126 #
127 # Overridden methods.
128 #
129
130
131 def actionConfig(self):
132 self._detectValidationKit();
133 return self.oTestVmSet.actionConfig(self);
134
135 def actionExecute(self):
136 return self.oTestVmSet.actionExecute(self, self.testOneCfg);
137
138
139
140 #
141 # Test execution helpers.
142 #
143
144 def testOneCfg(self, oVM, oTestVm):
145 """
146 Runs the specified VM thru the tests.
147
148 Returns a success indicator on the general test execution. This is not
149 the actual test result.
150 """
151
152 fRc = False
153
154 # Set up the result file
155 sXmlFile = self.prepareResultFile();
156 asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile, ];
157
158 # Do the test:
159 self.logVmInfo(oVM);
160 oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv);
161 if oSession is not None:
162 cMsTimeout = 30 * 60000;
163 if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
164 cMsTimeout = self.adjustTimeoutMs(180 * 60000);
165
166 oRc = self.waitForTasks(cMsTimeout);
167 if oRc == oSession:
168 fRc = oSession.assertPoweredOff();
169 else:
170 reporter.error('oRc=%s, expected %s' % (oRc, oSession));
171
172 reporter.addSubXmlFile(sXmlFile);
173 self.terminateVmBySession(oSession);
174
175 return fRc;
176
177
178
179if __name__ == '__main__':
180 sys.exit(tdCpuIemInstr1().main(sys.argv));
181
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