Changeset 90646 in vbox
- Timestamp:
- Aug 12, 2021 10:11:37 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146258
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/audio/tdAudioTest.py
r90644 r90646 51 51 from testdriver import vbox 52 52 from testdriver import vboxtestvms 53 from common import utils; 53 54 54 55 # pylint: disable=unnecessary-semicolon … … 231 232 self.killProcessByName("VBoxAudioTest"); 232 233 234 def getWinFirewallArgsDisable(self, sOsType): 235 """ 236 Returns the command line arguments for Windows OSes 237 to disable the built-in firewall (if any). 238 239 If not supported, returns an empty array. 240 """ 241 if sOsType == 'vista': # Vista and up. 242 return (['netsh', 'advfirewall', 'set', 'allprofiles', 'state', 'off']); 243 elif sOsType == 'xp': # Older stuff (XP / 2003). 244 return(['netsh', 'firewall', 'set', 'opmode', 'mode=DISABLE']); 245 # Not supported / available. 246 return []; 247 248 def disableGstFirewall(self, oTestVm, oTxsSession): 249 """ 250 Disables the firewall on a guest (if any). 251 252 Needs elevated / admin / root privileges. 253 254 Returns success status, not logged. 255 """ 256 fRc = False; 257 258 asArgs = []; 259 sOsType = ''; 260 if oTestVm.isWindows(): 261 if oTestVm.sKind in ['WindowsNT4', 'WindowsNT3x']: 262 sOsType = 'nt3x'; # Not supported, but define it anyway. 263 elif oTestVm.sKind in ('Windows2000', 'WindowsXP', 'Windows2003'): 264 sOsType = 'xp'; 265 else: 266 sOsType = 'vista'; 267 asArgs = self.getWinFirewallArgsDisable(sOsType); 268 else: 269 sOsType = 'unsupported'; 270 271 reporter.log('Disabling firewall on guest (type: %s) ...' % (sOsType,)); 272 273 if len(asArgs) > 0: 274 fRc = self.txsRunTest(oTxsSession, 'Disabling guest firewall', \ 275 oTestVm.pathJoin(self.getGuestSystemDir(oTestVm), asArgs[0]), asArgs); 276 if not fRc: 277 reporter.error('Disabling firewall on guest returned exit code error %d' % (self.getLastRcFromTxs(oTxsSession))); 278 else: 279 reporter.log('Firewall not available on guest, skipping'); 280 fRc = True; # Not available, just skip. 281 282 return fRc; 283 284 def disableHstFirewall(self): 285 """ 286 Disables the firewall on the host (if any). 287 288 Needs elevated / admin / root privileges. 289 290 Returns success status, not logged. 291 """ 292 fRc = False; 293 294 asArgs = []; 295 sOsType = sys.platform; 296 297 if sOsType == 'win32': 298 reporter.log('Disabling firewall on host (type: %s) ...' % (sOsType)); 299 300 ## @todo For now we ASSUME that we don't run (and don't support even) on old(er) 301 # Windows hosts than Vista. 302 asArgs = self.getWinFirewallArgsDisable('vista'); 303 304 if len(asArgs) > 0: 305 oProcess = utils.sudoProcessPopen(asArgs, stdout=subprocess.PIPE, stdin=subprocess.PIPE, 306 stderr=subprocess.PIPE, shell = False, close_fds = False); 307 if oProcess: 308 sOut, sErr = oProcess.communicate(); 309 310 sOut = sOut.decode(sys.stdin.encoding); 311 for sLine in sOut.split('\n'): 312 reporter.log(sLine); 313 314 sErr = sErr.decode(sys.stdin.encoding); 315 for sLine in sErr.split('\n'): 316 reporter.log(sLine); 317 318 iExitCode = oProcess.poll(); 319 if iExitCode != 0: 320 fRc = False; 321 else: 322 fRc = False; 323 324 if not fRc: 325 reporter.error('Disabling firewall on host returned exit code error %d' % iExitCode); 326 else: 327 reporter.log('Firewall not available on host, skipping '); 328 fRc = True; # Not available, just skip. 329 330 return fRc; 331 233 332 def getLastRcFromTxs(self, oTxsSession): 234 333 """ … … 353 452 Executes the specified audio tests. 354 453 """ 454 455 # Disable any OS-specific firewalls preventing VKAT / ATS to run. 456 self.disableHstFirewall(); 457 self.disableGstFirewall(oTestVm, oTxsSession); 355 458 356 459 # First try to kill any old VKAT / VBoxAudioTest processes lurking around on the host.
Note:
See TracChangeset
for help on using the changeset viewer.