Changeset 83965 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Apr 24, 2020 2:07:41 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137532
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py
r83964 r83965 36 36 import sys; 37 37 import re; 38 import struct;39 import time;40 38 import ssl; 41 39 … … 43 41 if sys.version_info[0] < 3: 44 42 import urllib2 as urllib; # pylint: disable=import-error,no-name-in-module 45 from urllib2 import quote as urllib_quote; # pylint: disable=import-error,no-name-in-module46 from urllib import urlencode as urllib_urlencode; # pylint: disable=import-error,no-name-in-module47 43 from urllib2 import ProxyHandler as urllib_ProxyHandler; # pylint: disable=import-error,no-name-in-module 48 44 from urllib2 import build_opener as urllib_build_opener; # pylint: disable=import-error,no-name-in-module 49 45 else: 50 46 import urllib; # pylint: disable=import-error,no-name-in-module 51 from urllib.parse import quote as urllib_quote; # pylint: disable=import-error,no-name-in-module52 from urllib.parse import urlencode as urllib_urlencode; # pylint: disable=import-error,no-name-in-module53 47 from urllib.request import ProxyHandler as urllib_ProxyHandler; # pylint: disable=import-error,no-name-in-module 54 48 from urllib.request import build_opener as urllib_build_opener; # pylint: disable=import-error,no-name-in-module … … 281 275 return True; 282 276 283 def guestProcessExecute(self, oGuestSession, sTestName, cMsTimeout, sExecName, asArgs = (), fGetStdOut = True, fIsError = True): 277 def guestProcessExecute(self, oGuestSession, sTestName, cMsTimeout, sExecName, asArgs = (), 278 fGetStdOut = True, fIsError = True): 284 279 """ 285 280 Helper function to execute a program on a guest, specified in the current test. … … 491 486 if not fIgnoreErrors: 492 487 return reporter.errorXcpt('Download file failed: Could not create session for vbox'); 493 else: 494 reporter.log('warning: Download file failed: Could not create session for vbox'); 495 return False; 488 reporter.log('warning: Download file failed: Could not create session for vbox'); 489 return False; 496 490 497 491 try: … … 708 702 709 703 if fRc: 710 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Allowing execution for the vbox installer', 711 30 * 1000, '/usr/bin/sudo', 712 ['/usr/bin/sudo', '/bin/chmod', '755', '/tmp/' + os.path.basename(self.sTestBuild)], 713 False, True); 704 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 705 'Allowing execution for the vbox installer', 706 30 * 1000, '/usr/bin/sudo', 707 ['/usr/bin/sudo', '/bin/chmod', '755', 708 '/tmp/' + os.path.basename(self.sTestBuild)], 709 False, True); 714 710 if fRc: 715 711 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Installing VBox', 716 240 * 1000, '/usr/bin/sudo', 717 ['/usr/bin/sudo', '/tmp/' + os.path.basename(self.sTestBuild),], False, True); 712 240 * 1000, '/usr/bin/sudo', 713 ['/usr/bin/sudo', 714 '/tmp/' + os.path.basename(self.sTestBuild),], 715 False, True); 718 716 719 717 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. … … 1047 1045 1048 1046 # Create autostart database directory writeable for everyone 1049 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Setting the autostart environment variable', 1050 30 * 1000, 'C:\\Windows\\System32\\reg.exe', 1051 ['reg', 'add', 1052 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment', 1053 '/v', 'VBOXAUTOSTART_CONFIG', '/d', 1054 'C:\\ProgramData\\autostart.cfg', '/f'], 1055 False, True); 1047 (fRc, _, _, _) = \ 1048 self.guestProcessExecute(oGuestSession, 'Setting the autostart environment variable', 1049 30 * 1000, 'C:\\Windows\\System32\\reg.exe', 1050 ['reg', 'add', 1051 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment', 1052 '/v', 'VBOXAUTOSTART_CONFIG', '/d', 1053 'C:\\ProgramData\\autostart.cfg', '/f'], 1054 False, True); 1056 1055 1057 1056 sVBoxCfg = self._createAutostartCfg(sDefaultPolicy, asUserAllow, asUserDeny); … … 1070 1069 return fRc; 1071 1070 1072 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Create VM ' + sVmName, 1073 30 * 1000, 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1074 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 'createvm', 1075 '--name', sVmName, '--register'], False, True); 1076 if fRc: 1077 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Enabling autostart for test VM', 1078 30 * 1000, 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1079 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1080 'modifyvm', sVmName, '--autostart-enabled', 'on'], False, True); 1071 (fRc, _, _, _) = \ 1072 self.guestProcessExecute(oGuestSession, 'Create VM ' + sVmName, 1073 30 * 1000, 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1074 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 'createvm', 1075 '--name', sVmName, '--register'], False, True); 1076 if fRc: 1077 (fRc, _, _, _) = \ 1078 self.guestProcessExecute(oGuestSession, 'Enabling autostart for test VM', 1079 30 * 1000, 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1080 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe', 1081 'modifyvm', sVmName, '--autostart-enabled', 'on'], False, True); 1081 1082 fRc = fRc and self.uploadString(oSession, 'password', 'C:\\ProgramData\\password.cfg'); 1082 1083 if fRc: 1083 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Install autostart service for the user', 1084 30 * 1000, 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxAutostartSvc.exe', 1085 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxAutostartSvc.exe', 1086 'install', '--user=' + sUser, '--password-file=C:\\ProgramData\\password.cfg'], 1087 False, True); 1084 (fRc, _, _, _) = \ 1085 self.guestProcessExecute(oGuestSession, 'Install autostart service for the user', 1086 30 * 1000, 'C:\\Program Files\\Oracle\\VirtualBox\\VBoxAutostartSvc.exe', 1087 ['C:\\Program Files\\Oracle\\VirtualBox\\VBoxAutostartSvc.exe', 1088 'install', '--user=' + sUser, 1089 '--password-file=C:\\ProgramData\\password.cfg'], 1090 False, True); 1088 1091 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 1089 1092
Note:
See TracChangeset
for help on using the changeset viewer.