VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/tests/smoketests/tdSmokeTest1.py@ 106683

Last change on this file since 106683 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.7 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: tdSmokeTest1.py 106061 2024-09-16 14:03:52Z vboxsync $
4
5"""
6VirtualBox Validation Kit - Smoke Test #1.
7"""
8
9__copyright__ = \
10"""
11Copyright (C) 2010-2024 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: 106061 $"
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 base;
56from testdriver import vbox;
57from testdriver import vboxcon;
58
59
60class tdSmokeTest1(vbox.TestDriver):
61 """
62 VBox Smoke Test #1.
63 """
64
65 def __init__(self):
66 vbox.TestDriver.__init__(self);
67 self.asRsrcs = None;
68 self.oTestVmSet = self.oTestVmManager.getSmokeVmSet();
69 self.sNicAttachmentDef = 'mixed';
70 self.sNicAttachment = self.sNicAttachmentDef;
71 self.fQuick = False;
72
73 #
74 # Overridden methods.
75 #
76 def showUsage(self):
77 rc = vbox.TestDriver.showUsage(self);
78 reporter.log('');
79 reporter.log('Smoke Test #1 options:');
80 reporter.log(' --nic-attachment <bridged|nat|mixed>');
81 reporter.log(' Default: %s' % (self.sNicAttachmentDef));
82 reporter.log(' --quick');
83 reporter.log(' Very selective testing.')
84 return rc;
85
86 def parseOption(self, asArgs, iArg):
87 if asArgs[iArg] == '--nic-attachment':
88 iArg += 1;
89 if iArg >= len(asArgs): raise base.InvalidOption('The "--nic-attachment" takes an argument');
90 self.sNicAttachment = asArgs[iArg];
91 if self.sNicAttachment not in ('bridged', 'nat', 'mixed'):
92 raise base.InvalidOption('The "--nic-attachment" value "%s" is not supported. Valid values are: bridged, nat' \
93 % (self.sNicAttachment));
94 elif asArgs[iArg] == '--quick':
95 # Disable all but a few VMs and configurations.
96 for oTestVm in self.oTestVmSet.aoTestVms:
97 if oTestVm.sVmName == 'tst-win2k3ent': # 32-bit paging
98 oTestVm.asVirtModesSup = [ 'hwvirt' ];
99 oTestVm.acCpusSup = range(1, 2);
100 elif oTestVm.sVmName == 'tst-rhel5': # 32-bit paging
101 oTestVm.asVirtModesSup = [ 'raw' ];
102 oTestVm.acCpusSup = range(1, 2);
103 elif oTestVm.sVmName == 'tst-win2k8': # 64-bit
104 oTestVm.asVirtModesSup = [ 'hwvirt-np' ];
105 oTestVm.acCpusSup = range(1, 2);
106 elif oTestVm.sVmName == 'tst-sol10-64': # SMP, 64-bit
107 oTestVm.asVirtModesSup = [ 'hwvirt' ];
108 oTestVm.acCpusSup = range(2, 3);
109 elif oTestVm.sVmName == 'tst-sol10': # SMP, 32-bit
110 oTestVm.asVirtModesSup = [ 'hwvirt-np' ];
111 oTestVm.acCpusSup = range(2, 3);
112 elif oTestVm.sVmName == 'tst-nsthwvirt-ubuntu-64': # Nested hw.virt, 64-bit
113 oTestVm.asVirtModesSup = [ 'hwvirt-np' ];
114 oTestVm.acCpusSup = range(1, 2);
115 else:
116 oTestVm.fSkip = True;
117 else:
118 return vbox.TestDriver.parseOption(self, asArgs, iArg);
119 return iArg + 1;
120
121 def actionVerify(self):
122 if self.sVBoxValidationKitIso is None or not os.path.isfile(self.sVBoxValidationKitIso):
123 reporter.error('Cannot find the VBoxValidationKit.iso! (%s)'
124 'Please unzip a Validation Kit build in the current directory or in some parent one.'
125 % (self.sVBoxValidationKitIso,) );
126 return False;
127 return vbox.TestDriver.actionVerify(self);
128
129 def actionConfig(self):
130 # Make sure vboxapi has been imported so we can use the constants.
131 if not self.importVBoxApi():
132 return False;
133
134 # Do the configuring.
135 if self.sNicAttachment == 'nat': eNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
136 elif self.sNicAttachment == 'bridged': eNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
137 else: eNic0AttachType = None;
138 assert self.sVBoxValidationKitIso is not None;
139 return self.oTestVmSet.actionConfig(self, eNic0AttachType = eNic0AttachType, sDvdImage = self.sVBoxValidationKitIso);
140
141 def actionExecute(self):
142 """
143 Execute the testcase.
144 """
145 return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
146
147
148 #
149 # Test execution helpers.
150 #
151
152 def testOneVmConfig(self, oVM, oTestVm):
153 """
154 Runs the specified VM thru test #1.
155 """
156
157 # Simple test.
158 self.logVmInfo(oVM);
159 # Try waiting for a bit longer (15 minutes) until the CD is available to avoid running into timeouts.
160 oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True, cMsCdWait = 15 * 60 * 1000);
161 if oSession is not None:
162 self.addTask(oTxsSession);
163
164 ## @todo do some quick tests: save, restore, execute some test program, shut down the guest.
165
166 # cleanup.
167 self.removeTask(oTxsSession);
168 self.terminateVmBySession(oSession)
169 return True;
170 return None;
171
172if __name__ == '__main__':
173 sys.exit(tdSmokeTest1().main(sys.argv));
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