1 | #!/usr/bin/env python
|
---|
2 | # -*- coding: utf-8 -*-
|
---|
3 | # $Id: tdNetBenchmark1.py 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
4 |
|
---|
5 | """
|
---|
6 | VirtualBox Validation Kit - Networking benchmark #1.
|
---|
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: 98103 $"
|
---|
41 |
|
---|
42 |
|
---|
43 | # Standard Python imports.
|
---|
44 | import os;
|
---|
45 | import socket
|
---|
46 | import sys;
|
---|
47 |
|
---|
48 | # Only the main script needs to modify the path.
|
---|
49 | try: __file__
|
---|
50 | except: __file__ = sys.argv[0];
|
---|
51 | g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
|
---|
52 | sys.path.append(g_ksValidationKitDir);
|
---|
53 |
|
---|
54 | # Validation Kit imports.
|
---|
55 | from testdriver import reporter;
|
---|
56 | from testdriver import base;
|
---|
57 | from testdriver import vbox;
|
---|
58 | from testdriver import vboxcon;
|
---|
59 |
|
---|
60 |
|
---|
61 | class tdNetBenchmark1(vbox.TestDriver): # pylint: disable=too-many-instance-attributes
|
---|
62 | """
|
---|
63 | Networking benchmark #1.
|
---|
64 | """
|
---|
65 |
|
---|
66 | def __init__(self):
|
---|
67 | vbox.TestDriver.__init__(self);
|
---|
68 | self.asRsrcs = None;
|
---|
69 | self.sLocalName = socket.getfqdn();
|
---|
70 | self.sLocalIP = None
|
---|
71 | self.sRemoteName = None;
|
---|
72 | self.sRemoteIP = None;
|
---|
73 | self.sGuestName = None;
|
---|
74 | self.sGuestIP = None;
|
---|
75 | self.oGuestToGuestVM = None;
|
---|
76 | self.oGuestToGuestSess = None;
|
---|
77 | self.oGuestToGuestTxs = None;
|
---|
78 | self.asTestVMsDef = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10'];
|
---|
79 | self.asTestVMs = self.asTestVMsDef;
|
---|
80 | self.asSkipVMs = [];
|
---|
81 | self.asVirtModesDef = ['hwvirt', 'hwvirt-np', 'raw',]
|
---|
82 | self.asVirtModes = self.asVirtModesDef
|
---|
83 | self.acCpusDef = [1, 2,]
|
---|
84 | self.acCpus = self.acCpusDef;
|
---|
85 | self.asNicTypesDef = ['E1000', 'PCNet', 'Virtio',];
|
---|
86 | self.asNicTypes = self.asNicTypesDef;
|
---|
87 | self.sNicAttachmentDef = 'bridged';
|
---|
88 | self.sNicAttachment = self.sNicAttachmentDef;
|
---|
89 | self.asSetupsDef = ['g2h', 'g2r', 'g2g',];
|
---|
90 | self.asSetups = self.asSetupsDef;
|
---|
91 | self.cSecsRunDef = 30;
|
---|
92 | self.cSecsRun = self.cSecsRunDef;
|
---|
93 | self.asTestsDef = ['tcp-latency', 'tcp-throughput', 'udp-latency', 'udp-throughput', 'tbench'];
|
---|
94 | self.asTests = self.asTestsDef
|
---|
95 | self.acbLatencyPktsDef = [32, 1024, 4096, 8192, 65536,];
|
---|
96 | self.acbLatencyPkts = self.acbLatencyPktsDef
|
---|
97 | self.acbThroughputPktsDef = [8192, 65536];
|
---|
98 | self.acbThroughputPkts = self.acbThroughputPktsDef
|
---|
99 |
|
---|
100 | try: self.sLocalName = socket.gethostbyname(self.sLocalName);
|
---|
101 | except: pass;
|
---|
102 |
|
---|
103 | #
|
---|
104 | # Overridden methods.
|
---|
105 | #
|
---|
106 | def showUsage(self):
|
---|
107 | rc = vbox.TestDriver.showUsage(self);
|
---|
108 | reporter.log('');
|
---|
109 | reporter.log('tdNetBenchmark1 Options:');
|
---|
110 | reporter.log(' --remote-host <hostname|address>');
|
---|
111 | reporter.log(' --local-host <hostname|address>');
|
---|
112 | reporter.log(' --guest-host <hostname|address>');
|
---|
113 | reporter.log(' --virt-modes <m1[:m2[:]]');
|
---|
114 | reporter.log(' Default: %s' % (':'.join(self.asVirtModesDef)));
|
---|
115 | reporter.log(' --cpu-counts <c1[:c2[:]]');
|
---|
116 | reporter.log(' Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
|
---|
117 | reporter.log(' --nic-types <type1[:type2[:...]]>');
|
---|
118 | reporter.log(' Default: %s' % (':'.join(self.asNicTypes)));
|
---|
119 | reporter.log(' --nic-attachment <bridged|nat>');
|
---|
120 | reporter.log(' Default: %s' % (self.sNicAttachmentDef));
|
---|
121 | reporter.log(' --setups <s1[:s2[:]]>');
|
---|
122 | reporter.log(' Default: %s (all)' % (':'.join(self.asSetupsDef)));
|
---|
123 | reporter.log(' --secs-per-run <seconds>');
|
---|
124 | reporter.log(' Default: %s' % (self.cSecsRunDef));
|
---|
125 | reporter.log(' --tests <s1[:s2[:]]>');
|
---|
126 | reporter.log(' Default: %s (all)' % (':'.join(self.asTestsDef)));
|
---|
127 | reporter.log(' --latency-sizes <size1[:size2[:...]]>');
|
---|
128 | reporter.log(' Default: %s' % (':'.join(str(cb) for cb in self.acbLatencyPktsDef))); # pychecker bug?
|
---|
129 | reporter.log(' --throughput-sizes <size1[:size2[:...]]>');
|
---|
130 | reporter.log(' Default: %s' % (':'.join(str(cb) for cb in self.acbThroughputPktsDef))); # pychecker bug?
|
---|
131 | reporter.log(' --test-vms <vm1[:vm2[:...]]>');
|
---|
132 | reporter.log(' Test the specified VMs in the given order. Use this to change');
|
---|
133 | reporter.log(' the execution order or limit the choice of VMs');
|
---|
134 | reporter.log(' Default: %s (all)' % (':'.join(self.asTestVMsDef)));
|
---|
135 | reporter.log(' --skip-vms <vm1[:vm2[:...]]>');
|
---|
136 | reporter.log(' Skip the specified VMs when testing.');
|
---|
137 | reporter.log(' --quick');
|
---|
138 | reporter.log(' Shorthand for: --virt-modes hwvirt --cpu-counts 1 --secs-per-run 5 --latency-sizes 32');
|
---|
139 | reporter.log(' --throughput-sizes 8192 --test-vms tst-rhel5:tst-win2k3ent:tst-sol10');
|
---|
140 | return rc;
|
---|
141 |
|
---|
142 | def parseOption(self, asArgs, iArg): # pylint: disable=too-many-branches,too-many-statements
|
---|
143 | if asArgs[iArg] == '--remote-host':
|
---|
144 | iArg += 1;
|
---|
145 | if iArg >= len(asArgs): raise base.InvalidOption('The "--remote-host" takes an IP address or a hostname');
|
---|
146 | self.sRemoteName = asArgs[iArg];
|
---|
147 | elif asArgs[iArg] == '--local-host':
|
---|
148 | iArg += 1;
|
---|
149 | if iArg >= len(asArgs): raise base.InvalidOption('The "--local-host" takes an IP address or a hostname');
|
---|
150 | self.sLocalName = asArgs[iArg];
|
---|
151 | elif asArgs[iArg] == '--guest-host':
|
---|
152 | iArg += 1;
|
---|
153 | if iArg >= len(asArgs): raise base.InvalidOption('The "--guest-host" takes an IP address or a hostname');
|
---|
154 | self.sGuestName = asArgs[iArg];
|
---|
155 | elif asArgs[iArg] == '--virt-modes':
|
---|
156 | iArg += 1;
|
---|
157 | if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
|
---|
158 | self.asVirtModes = asArgs[iArg].split(':');
|
---|
159 | for s in self.asVirtModes:
|
---|
160 | if s not in self.asVirtModesDef:
|
---|
161 | raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
|
---|
162 | % (s, ' '.join(self.asVirtModesDef)));
|
---|
163 | elif asArgs[iArg] == '--cpu-counts':
|
---|
164 | iArg += 1;
|
---|
165 | if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
|
---|
166 | self.acCpus = [];
|
---|
167 | for s in asArgs[iArg].split(':'):
|
---|
168 | try: c = int(s);
|
---|
169 | except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
|
---|
170 | if c <= 0: raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
|
---|
171 | self.acCpus.append(c);
|
---|
172 | elif asArgs[iArg] == '--nic-types':
|
---|
173 | iArg += 1;
|
---|
174 | if iArg >= len(asArgs): raise base.InvalidOption('The "--nic-types" takes a colon separated list of NIC types');
|
---|
175 | self.asNicTypes = asArgs[iArg].split(':');
|
---|
176 | elif asArgs[iArg] == '--nic-attachment':
|
---|
177 | iArg += 1;
|
---|
178 | if iArg >= len(asArgs): raise base.InvalidOption('The "--nic-attachment" takes an argument');
|
---|
179 | self.sNicAttachment = asArgs[iArg];
|
---|
180 | if self.sNicAttachment not in ('bridged', 'nat'):
|
---|
181 | raise base.InvalidOption('The "--nic-attachment" value "%s" is not supported. Valid values are: bridged, nat' \
|
---|
182 | % (self.sNicAttachment));
|
---|
183 | elif asArgs[iArg] == '--setups':
|
---|
184 | iArg += 1;
|
---|
185 | if iArg >= len(asArgs): raise base.InvalidOption('The "--setups" takes a colon separated list of setups');
|
---|
186 | self.asSetups = asArgs[iArg].split(':');
|
---|
187 | for s in self.asSetups:
|
---|
188 | if s not in self.asSetupsDef:
|
---|
189 | raise base.InvalidOption('The "--setups" value "%s" is not valid; valid values are: %s' \
|
---|
190 | % (s, ' '.join(self.asSetupsDef)));
|
---|
191 | elif asArgs[iArg] == '--secs-per-run':
|
---|
192 | iArg += 1;
|
---|
193 | if iArg >= len(asArgs): raise base.InvalidOption('The "--secs-per-run" takes second count');
|
---|
194 | try: self.cSecsRun = int(asArgs[iArg]);
|
---|
195 | except: raise base.InvalidOption('The "--secs-per-run" value "%s" is not an integer' % (self.cSecsRun,));
|
---|
196 | if self.cSecsRun <= 0:
|
---|
197 | raise base.InvalidOption('The "--secs-per-run" value "%s" is zero or negative.' % (self.cSecsRun,));
|
---|
198 | elif asArgs[iArg] == '--tests':
|
---|
199 | iArg += 1;
|
---|
200 | if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of tests');
|
---|
201 | self.asTests = asArgs[iArg].split(':');
|
---|
202 | for s in self.asTests:
|
---|
203 | if s not in self.asTestsDef:
|
---|
204 | raise base.InvalidOption('The "--tests" value "%s" is not valid; valid values are: %s' \
|
---|
205 | % (s, ' '.join(self.asTestsDef)));
|
---|
206 | elif asArgs[iArg] == '--latency-sizes':
|
---|
207 | iArg += 1;
|
---|
208 | if iArg >= len(asArgs): raise base.InvalidOption('The "--latency-sizes" takes a colon separated list of sizes');
|
---|
209 | self.acbLatencyPkts = [];
|
---|
210 | for s in asArgs[iArg].split(':'):
|
---|
211 | try: cb = int(s);
|
---|
212 | except: raise base.InvalidOption('The "--latency-sizes" value "%s" is not an integer' % (s,));
|
---|
213 | if cb <= 0: raise base.InvalidOption('The "--latency-sizes" value "%s" is zero or negative' % (s,));
|
---|
214 | self.acbLatencyPkts.append(cb);
|
---|
215 | elif asArgs[iArg] == '--throughput-sizes':
|
---|
216 | iArg += 1;
|
---|
217 | if iArg >= len(asArgs): raise base.InvalidOption('The "--throughput-sizes" takes a colon separated list of sizes');
|
---|
218 | self.acbThroughputPkts = [];
|
---|
219 | for s in asArgs[iArg].split(':'):
|
---|
220 | try: cb = int(s);
|
---|
221 | except: raise base.InvalidOption('The "--throughput-sizes" value "%s" is not an integer' % (s,));
|
---|
222 | if cb <= 0: raise base.InvalidOption('The "--throughput-sizes" value "%s" is zero or negative' % (s,));
|
---|
223 | self.acbThroughputPkts.append(cb);
|
---|
224 | elif asArgs[iArg] == '--test-vms':
|
---|
225 | iArg += 1;
|
---|
226 | if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
|
---|
227 | self.asTestVMs = asArgs[iArg].split(':');
|
---|
228 | for s in self.asTestVMs:
|
---|
229 | if s not in self.asTestVMsDef:
|
---|
230 | raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
|
---|
231 | % (s, ' '.join(self.asTestVMsDef)));
|
---|
232 | elif asArgs[iArg] == '--skip-vms':
|
---|
233 | iArg += 1;
|
---|
234 | if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
|
---|
235 | self.asSkipVMs = asArgs[iArg].split(':');
|
---|
236 | for s in self.asSkipVMs:
|
---|
237 | if s not in self.asTestVMsDef:
|
---|
238 | reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
|
---|
239 | elif asArgs[iArg] == '--quick':
|
---|
240 | self.cSecsRun = 5;
|
---|
241 | self.asVirtModes = ['hwvirt',];
|
---|
242 | self.acCpus = [1,];
|
---|
243 | self.acbLatencyPkts = [32,];
|
---|
244 | self.acbThroughputPkts = [8192,];
|
---|
245 | self.asTestVMs = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10',];
|
---|
246 | else:
|
---|
247 | return vbox.TestDriver.parseOption(self, asArgs, iArg);
|
---|
248 | return iArg + 1;
|
---|
249 |
|
---|
250 | def completeOptions(self):
|
---|
251 | # Remove skipped VMs from the test list.
|
---|
252 | for sVM in self.asSkipVMs:
|
---|
253 | try: self.asTestVMs.remove(sVM);
|
---|
254 | except: pass;
|
---|
255 |
|
---|
256 | # Resolve any names we've been given.
|
---|
257 | self.sLocalIP = base.tryGetHostByName(self.sLocalName);
|
---|
258 | self.sRemoteIP = base.tryGetHostByName(self.sRemoteName);
|
---|
259 | self.sGuestIP = base.tryGetHostByName(self.sGuestName);
|
---|
260 |
|
---|
261 | reporter.log('Local IP : %s' % (self.sLocalIP));
|
---|
262 | reporter.log('Remote IP: %s' % (self.sRemoteIP));
|
---|
263 | if self.sGuestIP is None:
|
---|
264 | reporter.log('Guest IP : use tst-guest2guest');
|
---|
265 | else:
|
---|
266 | reporter.log('Guest IP : %s' % (self.sGuestIP));
|
---|
267 |
|
---|
268 | return vbox.TestDriver.completeOptions(self);
|
---|
269 |
|
---|
270 | def getResourceSet(self):
|
---|
271 | # Construct the resource list the first time it's queried.
|
---|
272 | if self.asRsrcs is None:
|
---|
273 | self.asRsrcs = [];
|
---|
274 | if 'tst-rhel5' in self.asTestVMs or 'g2g' in self.asSetups:
|
---|
275 | self.asRsrcs.append('3.0/tcp/rhel5.vdi');
|
---|
276 | if 'tst-rhel5-64' in self.asTestVMs:
|
---|
277 | self.asRsrcs.append('3.0/tcp/rhel5-64.vdi');
|
---|
278 | if 'tst-sles11' in self.asTestVMs:
|
---|
279 | self.asRsrcs.append('3.0/tcp/sles11.vdi');
|
---|
280 | if 'tst-sles11-64' in self.asTestVMs:
|
---|
281 | self.asRsrcs.append('3.0/tcp/sles11-64.vdi');
|
---|
282 | if 'tst-oel' in self.asTestVMs:
|
---|
283 | self.asRsrcs.append('3.0/tcp/oel.vdi');
|
---|
284 | if 'tst-oel-64' in self.asTestVMs:
|
---|
285 | self.asRsrcs.append('3.0/tcp/oel-64.vdi');
|
---|
286 | if 'tst-win2k3ent' in self.asTestVMs:
|
---|
287 | self.asRsrcs.append('3.0/tcp/win2k3ent-acpi.vdi');
|
---|
288 | if 'tst-win2k3ent-64' in self.asTestVMs:
|
---|
289 | self.asRsrcs.append('3.0/tcp/win2k3ent-64.vdi');
|
---|
290 | if 'tst-win2k8' in self.asTestVMs:
|
---|
291 | self.asRsrcs.append('3.0/tcp/win2k8.vdi');
|
---|
292 | if 'tst-sol10' in self.asTestVMs:
|
---|
293 | self.asRsrcs.append('3.0/tcp/solaris10.vdi');
|
---|
294 | if 'tst-sol11' in self.asTestVMs:
|
---|
295 | self.asRsrcs.append('3.0/tcp/solaris11.vdi');
|
---|
296 | return self.asRsrcs;
|
---|
297 |
|
---|
298 | def actionConfig(self):
|
---|
299 | # Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
|
---|
300 | sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso'));
|
---|
301 | if not os.path.isfile(sVBoxValidationKit_iso):
|
---|
302 | sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso'));
|
---|
303 | if not os.path.isfile(sVBoxValidationKit_iso):
|
---|
304 | sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/validationkit/VBoxValidationKit.iso';
|
---|
305 | if not os.path.isfile(sVBoxValidationKit_iso):
|
---|
306 | sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/testsuite/VBoxTestSuite.iso';
|
---|
307 | if not os.path.isfile(sVBoxValidationKit_iso):
|
---|
308 | sCur = os.getcwd();
|
---|
309 | for i in range(0, 10):
|
---|
310 | sVBoxValidationKit_iso = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso');
|
---|
311 | if os.path.isfile(sVBoxValidationKit_iso):
|
---|
312 | break;
|
---|
313 | sVBoxValidationKit_iso = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso');
|
---|
314 | if os.path.isfile(sVBoxValidationKit_iso):
|
---|
315 | break;
|
---|
316 | sCur = os.path.abspath(os.path.join(sCur, '..'));
|
---|
317 | if i is None: pass; # shut up pychecker/pylint.
|
---|
318 | if not os.path.isfile(sVBoxValidationKit_iso):
|
---|
319 | sVBoxValidationKit_iso = '/home/bird/validationkit/VBoxValidationKit.iso';
|
---|
320 | if not os.path.isfile(sVBoxValidationKit_iso):
|
---|
321 | sVBoxValidationKit_iso = '/home/bird/testsuite/VBoxTestSuite.iso';
|
---|
322 |
|
---|
323 | # Make sure vboxapi has been imported so we can use the constants.
|
---|
324 | if not self.importVBoxApi():
|
---|
325 | return False;
|
---|
326 |
|
---|
327 | # Guest to Guest VM.
|
---|
328 | if self.sGuestName is None and 'g2g' in self.asSetups:
|
---|
329 | oVM = self.createTestVM('tst-guest2guest', 0, '3.0/tcp/rhel5.vdi', sKind = 'RedHat', fIoApic = True, \
|
---|
330 | eNic0Type = vboxcon.NetworkAdapterType_I82545EM, \
|
---|
331 | eNic0AttachType = vboxcon.NetworkAttachmentType_Bridged, \
|
---|
332 | fVirtEx = True, sDvdImage = sVBoxValidationKit_iso);
|
---|
333 | if oVM is None:
|
---|
334 | return False;
|
---|
335 | self.oGuestToGuestVM = oVM;
|
---|
336 |
|
---|
337 | #
|
---|
338 | # Configure the VMs we're going to use.
|
---|
339 | #
|
---|
340 | eNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
|
---|
341 | if self.sNicAttachment == 'nat':
|
---|
342 | eNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
|
---|
343 |
|
---|
344 | # Linux VMs
|
---|
345 | if 'tst-rhel5' in self.asTestVMs:
|
---|
346 | oVM = self.createTestVM('tst-rhel5', 1, '3.0/tcp/rhel5.vdi', sKind = 'RedHat', fIoApic = True, \
|
---|
347 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
348 | if oVM is None:
|
---|
349 | return False;
|
---|
350 |
|
---|
351 | if 'tst-rhel5-64' in self.asTestVMs:
|
---|
352 | oVM = self.createTestVM('tst-rhel5-64', 1, '3.0/tcp/rhel5-64.vdi', sKind = 'RedHat_64', \
|
---|
353 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
354 | if oVM is None:
|
---|
355 | return False;
|
---|
356 |
|
---|
357 | if 'tst-sles11' in self.asTestVMs:
|
---|
358 | oVM = self.createTestVM('tst-sles11', 1, '3.0/tcp/sles11.vdi', sKind = 'OpenSUSE', fIoApic = True, \
|
---|
359 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
360 | if oVM is None:
|
---|
361 | return False;
|
---|
362 |
|
---|
363 | if 'tst-sles11-64' in self.asTestVMs:
|
---|
364 | oVM = self.createTestVM('tst-sles11-64', 1, '3.0/tcp/sles11-64.vdi', sKind = 'OpenSUSE_64', \
|
---|
365 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
366 | if oVM is None:
|
---|
367 | return False;
|
---|
368 |
|
---|
369 | if 'tst-oel' in self.asTestVMs:
|
---|
370 | oVM = self.createTestVM('tst-oel', 1, '3.0/tcp/oel.vdi', sKind = 'Oracle', fIoApic = True, \
|
---|
371 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
372 | if oVM is None:
|
---|
373 | return False;
|
---|
374 |
|
---|
375 | if 'tst-oel-64' in self.asTestVMs:
|
---|
376 | oVM = self.createTestVM('tst-oel-64', 1, '3.0/tcp/oel-64.vdi', sKind = 'Oracle_64', \
|
---|
377 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
378 | if oVM is None:
|
---|
379 | return False;
|
---|
380 |
|
---|
381 | # Windows VMs
|
---|
382 | if 'tst-win2k3ent' in self.asTestVMs:
|
---|
383 | oVM = self.createTestVM('tst-win2k3ent', 1, '3.0/tcp/win2k3ent-acpi.vdi', sKind = 'Windows2003', \
|
---|
384 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
385 | if oVM is None:
|
---|
386 | return False;
|
---|
387 |
|
---|
388 | if 'tst-win2k3ent-64' in self.asTestVMs:
|
---|
389 | oVM = self.createTestVM('tst-win2k3ent-64', 1, '3.0/tcp/win2k3ent-64.vdi', sKind = 'Windows2003_64', \
|
---|
390 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
391 | if oVM is None:
|
---|
392 | return False;
|
---|
393 |
|
---|
394 | if 'tst-win2k8' in self.asTestVMs:
|
---|
395 | oVM = self.createTestVM('tst-win2k8', 1, '3.0/tcp/win2k8.vdi', sKind = 'Windows2008_64', \
|
---|
396 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
397 | if oVM is None:
|
---|
398 | return False;
|
---|
399 |
|
---|
400 | # Solaris VMs
|
---|
401 | if 'tst-sol10' in self.asTestVMs:
|
---|
402 | oVM = self.createTestVM('tst-sol10', 1, '3.0/tcp/solaris10.vdi', sKind = 'Solaris_64', \
|
---|
403 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
404 | if oVM is None:
|
---|
405 | return False;
|
---|
406 |
|
---|
407 | if 'tst-sol11' in self.asTestVMs:
|
---|
408 | oVM = self.createTestVM('tst-sol11', 1, '3.0/tcp/os2009-11.vdi', sKind = 'Solaris_64', \
|
---|
409 | eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
|
---|
410 | if oVM is None:
|
---|
411 | return False;
|
---|
412 |
|
---|
413 | return True;
|
---|
414 |
|
---|
415 | def actionExecute(self):
|
---|
416 | """
|
---|
417 | Execute the testcase.
|
---|
418 | """
|
---|
419 | fRc = self.test1();
|
---|
420 | return fRc;
|
---|
421 |
|
---|
422 |
|
---|
423 | #
|
---|
424 | # Test execution helpers.
|
---|
425 | #
|
---|
426 |
|
---|
427 | def test1RunTestProgs(self, oTxsSession, fRc, sTestName, sAddr):
|
---|
428 | """
|
---|
429 | Runs all the test programs against one 'server' machine.
|
---|
430 | """
|
---|
431 | reporter.testStart(sTestName);
|
---|
432 |
|
---|
433 | reporter.testStart('TCP latency');
|
---|
434 | if fRc and 'tcp-latency' in self.asTests and sAddr is not None:
|
---|
435 | for cbPkt in self.acbLatencyPkts:
|
---|
436 | fRc = self.txsRunTest(oTxsSession, '%u bytes' % (cbPkt), self.cSecsRun * 1000 * 4,
|
---|
437 | '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
|
---|
438 | ('NetPerf', '--client', sAddr, '--interval', self.cSecsRun, '--len', cbPkt,
|
---|
439 | '--mode', 'latency'));
|
---|
440 | if not fRc:
|
---|
441 | break;
|
---|
442 | reporter.testDone();
|
---|
443 | else:
|
---|
444 | reporter.testDone(fSkipped = True);
|
---|
445 |
|
---|
446 | reporter.testStart('TCP throughput');
|
---|
447 | if fRc and 'tcp-throughput' in self.asTests and sAddr is not None:
|
---|
448 | for cbPkt in self.acbThroughputPkts:
|
---|
449 | fRc = self.txsRunTest(oTxsSession, '%u bytes' % (cbPkt), self.cSecsRun * 2 * 1000 * 4,
|
---|
450 | '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
|
---|
451 | ('NetPerf', '--client', sAddr, '--interval', self.cSecsRun, '--len', cbPkt,
|
---|
452 | '--mode', 'throughput'));
|
---|
453 | if not fRc:
|
---|
454 | break;
|
---|
455 | reporter.testDone();
|
---|
456 | else:
|
---|
457 | reporter.testDone(fSkipped = True);
|
---|
458 |
|
---|
459 | reporter.testStart('UDP latency');
|
---|
460 | if fRc and 'udp-latency' in self.asTests and sAddr is not None:
|
---|
461 | ## @todo Netperf w/UDP.
|
---|
462 | reporter.testDone(fSkipped = True);
|
---|
463 | else:
|
---|
464 | reporter.testDone(fSkipped = True);
|
---|
465 |
|
---|
466 | reporter.testStart('UDP throughput');
|
---|
467 | if fRc and 'udp-throughput' in self.asTests and sAddr is not None:
|
---|
468 | ## @todo Netperf w/UDP.
|
---|
469 | reporter.testDone(fSkipped = True);
|
---|
470 | else:
|
---|
471 | reporter.testDone(fSkipped = True);
|
---|
472 |
|
---|
473 | reporter.testStart('tbench');
|
---|
474 | if fRc and 'tbench' in self.asTests and sAddr is not None:
|
---|
475 | ## @todo tbench.
|
---|
476 | reporter.testDone(fSkipped = True);
|
---|
477 | else:
|
---|
478 | reporter.testDone(fSkipped = True);
|
---|
479 |
|
---|
480 | reporter.testDone(not fRc);
|
---|
481 | return fRc;
|
---|
482 |
|
---|
483 | def test1OneCfg(self, sVmName, eNicType, cCpus, fHwVirt, fNestedPaging):
|
---|
484 | """
|
---|
485 | Runs the specified VM thru test #1.
|
---|
486 |
|
---|
487 | Returns a success indicator on the general test execution. This is not
|
---|
488 | the actual test result.
|
---|
489 | """
|
---|
490 | oVM = self.getVmByName(sVmName);
|
---|
491 |
|
---|
492 | # Reconfigure the VM
|
---|
493 | fRc = True;
|
---|
494 | oSession = self.openSession(oVM);
|
---|
495 | if oSession is not None:
|
---|
496 | fRc = fRc and oSession.setNicType(eNicType);
|
---|
497 | fRc = fRc and oSession.enableVirtEx(fHwVirt);
|
---|
498 | fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
|
---|
499 | fRc = fRc and oSession.setCpuCount(cCpus);
|
---|
500 | fRc = fRc and oSession.saveSettings();
|
---|
501 | fRc = oSession.close() and fRc and True; # pychecker hack.
|
---|
502 | oSession = None;
|
---|
503 | else:
|
---|
504 | fRc = False;
|
---|
505 |
|
---|
506 | # Start up.
|
---|
507 | if fRc is True:
|
---|
508 | self.logVmInfo(oVM);
|
---|
509 | oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = True);
|
---|
510 | if oSession is not None:
|
---|
511 | self.addTask(oTxsSession);
|
---|
512 |
|
---|
513 | # Fudge factor - Allow the guest to finish starting up.
|
---|
514 | self.sleep(5);
|
---|
515 |
|
---|
516 | # Benchmark #1 - guest <-> host.
|
---|
517 | if 'g2h' in self.asSetups:
|
---|
518 | self.test1RunTestProgs(oTxsSession, fRc, 'guest <-> host', self.sLocalIP);
|
---|
519 |
|
---|
520 | # Benchmark #2 - guest <-> host.
|
---|
521 | if 'g2r' in self.asSetups:
|
---|
522 | self.test1RunTestProgs(oTxsSession, fRc, 'guest <-> remote', self.sRemoteIP);
|
---|
523 |
|
---|
524 | # Benchmark #3 - guest <-> guest.
|
---|
525 | if 'g2g' in self.asSetups:
|
---|
526 | self.test1RunTestProgs(oTxsSession, fRc, 'guest <-> guest', self.sGuestIP);
|
---|
527 |
|
---|
528 | # cleanup.
|
---|
529 | self.removeTask(oTxsSession);
|
---|
530 | self.terminateVmBySession(oSession)
|
---|
531 | else:
|
---|
532 | fRc = False;
|
---|
533 | return fRc;
|
---|
534 |
|
---|
535 | def test1OneVM(self, sVmName, asSkipNicTypes = (), asSupVirtModes = None, rSupCpus = range(1, 256)):
|
---|
536 | """
|
---|
537 | Runs one VM thru the various configurations.
|
---|
538 | """
|
---|
539 | if asSupVirtModes is None:
|
---|
540 | asSupVirtModes = self.asVirtModes;
|
---|
541 |
|
---|
542 | reporter.testStart(sVmName);
|
---|
543 | fRc = True;
|
---|
544 | for sNicType in self.asNicTypes:
|
---|
545 | if sNicType in asSkipNicTypes:
|
---|
546 | continue;
|
---|
547 | reporter.testStart(sNicType);
|
---|
548 |
|
---|
549 | if sNicType == 'E1000':
|
---|
550 | eNicType = vboxcon.NetworkAdapterType_I82545EM;
|
---|
551 | elif sNicType == 'PCNet':
|
---|
552 | eNicType = vboxcon.NetworkAdapterType_Am79C973;
|
---|
553 | elif sNicType == 'Virtio':
|
---|
554 | eNicType = vboxcon.NetworkAdapterType_Virtio;
|
---|
555 | else:
|
---|
556 | eNicType = None;
|
---|
557 |
|
---|
558 | for cCpus in self.acCpus:
|
---|
559 | if cCpus == 1: reporter.testStart('1 cpu');
|
---|
560 | else: reporter.testStart('%u cpus' % (cCpus));
|
---|
561 |
|
---|
562 | for sVirtMode in self.asVirtModes:
|
---|
563 | if sVirtMode == 'raw' and cCpus > 1:
|
---|
564 | continue;
|
---|
565 | if cCpus not in rSupCpus:
|
---|
566 | continue;
|
---|
567 | if sVirtMode not in asSupVirtModes:
|
---|
568 | continue;
|
---|
569 | hsVirtModeDesc = {};
|
---|
570 | hsVirtModeDesc['raw'] = 'Raw-mode';
|
---|
571 | hsVirtModeDesc['hwvirt'] = 'HwVirt';
|
---|
572 | hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
|
---|
573 | reporter.testStart(hsVirtModeDesc[sVirtMode]);
|
---|
574 |
|
---|
575 | fHwVirt = sVirtMode != 'raw';
|
---|
576 | fNestedPaging = sVirtMode == 'hwvirt-np';
|
---|
577 | fRc = self.test1OneCfg(sVmName, eNicType, cCpus, fHwVirt, fNestedPaging) and fRc and True; # pychecker hack.
|
---|
578 |
|
---|
579 | reporter.testDone();
|
---|
580 | reporter.testDone();
|
---|
581 | reporter.testDone();
|
---|
582 | reporter.testDone();
|
---|
583 | return fRc;
|
---|
584 |
|
---|
585 | def test1(self):
|
---|
586 | """
|
---|
587 | Executes test #1.
|
---|
588 | """
|
---|
589 |
|
---|
590 | # Start the VM for the guest to guest testing, if required.
|
---|
591 | fRc = True;
|
---|
592 | if 'g2g' in self.asSetups and self.sGuestName is None:
|
---|
593 | self.oGuestToGuestSess, self.oGuestToGuestTxs = self.startVmAndConnectToTxsViaTcp('tst-guest2guest', fCdWait = True);
|
---|
594 | if self.oGuestToGuestSess is None:
|
---|
595 | return False;
|
---|
596 | self.sGuestIP = self.oGuestToGuestSess.getPrimaryIp();
|
---|
597 | reporter.log('tst-guest2guest IP: %s' % (self.sGuestIP));
|
---|
598 |
|
---|
599 | # Start the test servers on it.
|
---|
600 | fRc = self.oGuestToGuestTxs.syncExec('${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
|
---|
601 | ('NetPerf', '--server', '--daemonize'), fWithTestPipe=False);
|
---|
602 |
|
---|
603 | # Loop thru the test VMs.
|
---|
604 | if fRc:
|
---|
605 | for sVM in self.asTestVMs:
|
---|
606 | # figure args.
|
---|
607 | asSkipNicTypes = [];
|
---|
608 | if sVM not in ('tst-sles11', 'tst-sles11-64'):
|
---|
609 | asSkipNicTypes.append('Virtio');
|
---|
610 | if sVM in ('tst-sol11', 'tst-sol10'):
|
---|
611 | asSkipNicTypes.append('PCNet');
|
---|
612 | asSupVirtModes = None;
|
---|
613 | if sVM in ('tst-sol11', 'tst-sol10'): # 64-bit only
|
---|
614 | asSupVirtModes = ('hwvirt', 'hwvirt-np',);
|
---|
615 |
|
---|
616 | # run test on the VM.
|
---|
617 | if not self.test1OneVM(sVM, asSkipNicTypes, asSupVirtModes):
|
---|
618 | fRc = False;
|
---|
619 |
|
---|
620 | # Kill the guest to guest VM and clean up the state.
|
---|
621 | if self.oGuestToGuestSess is not None:
|
---|
622 | self.terminateVmBySession(self.oGuestToGuestSess);
|
---|
623 | self.oGuestToGuestSess = None;
|
---|
624 | self.oGuestToGuestTxs = None;
|
---|
625 | self.sGuestIP = None;
|
---|
626 |
|
---|
627 | return fRc;
|
---|
628 |
|
---|
629 |
|
---|
630 |
|
---|
631 | if __name__ == '__main__':
|
---|
632 | sys.exit(tdNetBenchmark1().main(sys.argv));
|
---|
633 |
|
---|