Changeset 90684 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- Aug 13, 2021 1:38:57 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 146296
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/audio/tdAudioTest.py
r90668 r90684 207 207 return (False, ""); 208 208 209 def executeHstBinaryAsAdmin(self, sWhat, asArgs): 210 """ 211 Runs a binary (image) with admin (root) rights on the host. 212 213 Returns success status (exit code is 0). 214 """ 215 fRc = False; 216 oProcess = utils.sudoProcessPopen(asArgs, stdout=subprocess.PIPE, stdin=subprocess.PIPE, 217 stderr=subprocess.PIPE, shell = False, close_fds = False); 218 if oProcess: 219 sOut, sErr = oProcess.communicate(); 220 221 sOut = sOut.decode(sys.stdin.encoding); 222 for sLine in sOut.split('\n'): 223 reporter.log(sLine); 224 225 sErr = sErr.decode(sys.stdin.encoding); 226 for sLine in sErr.split('\n'): 227 reporter.log(sLine); 228 229 iExitCode = oProcess.poll(); 230 if iExitCode == 0: 231 fRc = True; 232 else: 233 reporter.error('%s on host returned exit code error %d' % (sWhat, iExitCode)); 234 else: 235 fRc = False; 236 237 if not fRc: 238 reporter.error('%s on host failed' % (sWhat,)); 239 240 return fRc; 241 209 242 def killHstProcessByName(self, sProcName): 210 243 """ … … 213 246 reporter.log('Trying to kill processes named "%s"' % (sProcName,)); 214 247 if sys.platform == 'win32': 215 os.system('taskkill /IM "%s.exe" /F' % (sProcName)); 248 sArgProcName = '\"%s.exe\"' % sProcName; 249 asArgs = [ 'taskkill', '/IM', sArgProcName, '/F' ]; 250 self.executeHstBinaryAsAdmin('Killing process', asArgs); 216 251 else: # Note: killall is not available on older Debians (requires psmisc). 217 252 # Using the BSD syntax here; MacOS also should understand this. … … 302 337 # Windows hosts than Vista. 303 338 asArgs = self.getWinFirewallArgsDisable('vista'); 304 305 if asArgs: 306 oProcess = utils.sudoProcessPopen(asArgs, stdout=subprocess.PIPE, stdin=subprocess.PIPE, 307 stderr=subprocess.PIPE, shell = False, close_fds = False); 308 if oProcess: 309 sOut, sErr = oProcess.communicate(); 310 311 sOut = sOut.decode(sys.stdin.encoding); 312 for sLine in sOut.split('\n'): 313 reporter.log(sLine); 314 315 sErr = sErr.decode(sys.stdin.encoding); 316 for sLine in sErr.split('\n'): 317 reporter.log(sLine); 318 319 iExitCode = oProcess.poll(); 320 if iExitCode == 0: 321 fRc = True; 322 else: 323 reporter.error('Disabling firewall on host returned exit code error %d' % iExitCode); 324 else: 325 fRc = False; 326 327 if not fRc: 328 reporter.error('Disabling firewall on host failed'); 339 if asArgs: 340 fRc = self.executeHstBinaryAsAdmin('Disabling firewall', asArgs); 329 341 else: 330 342 reporter.log('Firewall not available on host, skipping');
Note:
See TracChangeset
for help on using the changeset viewer.