Changeset 85867 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- Aug 21, 2020 2:18:59 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 140036
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py
r85470 r85867 216 216 return sVBoxCfg; 217 217 218 def _waitAdditionsIsRunning(self, oGuest ):218 def _waitAdditionsIsRunning(self, oGuest, fWaitTrayControl): 219 219 """ 220 220 Check is the additions running … … 228 228 eServiceStatus, _ = oGuest.getFacilityStatus(vboxcon.AdditionsFacilityType_VBoxService); 229 229 fRc = eServiceStatus == vboxcon.AdditionsFacilityStatus_Active; 230 if fRc and not fWaitTrayControl: 231 break; 230 232 if fRc: 231 break; 233 eServiceStatus, _ = oGuest.getFacilityStatus(vboxcon.AdditionsFacilityType_VBoxTrayClient); 234 fRc = eServiceStatus == vboxcon.AdditionsFacilityStatus_Active; 235 if fRc: 236 break; 232 237 233 238 self.oTestDriver.sleep(10); … … 499 504 except: 500 505 if not fIgnoreErrors: 501 reporter.errorXcpt('Download file exception for sSrc="%s":' % (s elf.sGuestAdditionsIso,));502 else: 503 reporter.log('warning: Download file exception for sSrc="%s":' % (s elf.sGuestAdditionsIso,));506 reporter.errorXcpt('Download file exception for sSrc="%s":' % (sSrc,)); 507 else: 508 reporter.log('warning: Download file exception for sSrc="%s":' % (sSrc,)); 504 509 fRc = False; 505 510 else: … … 560 565 raise base.GenError("VirtualBox install package not found"); 561 566 562 def waitVMisReady(self, oSession ):567 def waitVMisReady(self, oSession, fWaitTrayControl): 563 568 """ 564 569 Waits the VM is ready after start or reboot. 565 570 Returns result (true or false) and guest session obtained 566 571 """ 572 _ = fWaitTrayControl; 567 573 # Give the VM a time to reboot 568 574 self.oTestDriver.sleep(30); … … 571 577 # To do it, one will try to open the guest session and start the guest process in loop 572 578 573 if not self._waitAdditionsIsRunning(oSession.o.console.guest ):579 if not self._waitAdditionsIsRunning(oSession.o.console.guest, False): 574 580 return (False, None); 575 581 … … 609 615 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 610 616 if fRc: 611 (fRc, oGuestSession) = self.waitVMisReady(oSession );617 (fRc, oGuestSession) = self.waitVMisReady(oSession, False); 612 618 613 619 if not fRc: … … 705 711 fRc = self.closeSession(oGuestSession); 706 712 if fRc: 707 (fRc, oGuestSession) = self.waitVMisReady(oSession );713 (fRc, oGuestSession) = self.waitVMisReady(oSession, False); 708 714 709 715 # Download log files. … … 732 738 733 739 reporter.testStart('Install Virtualbox into the guest VM'); 740 reporter.log("Virtualbox install file: %s" % os.path.basename(self.sTestBuild)); 734 741 735 742 fRc = self.uploadFile(oGuestSession, self.sTestBuild, … … 934 941 return; 935 942 936 def waitVMisReady(self, oSession ):943 def waitVMisReady(self, oSession, fWaitTrayControl, fWaitFacility = True): 937 944 """ 938 945 Waits the VM is ready after start or reboot. … … 944 951 # To do it, one will try to open the guest session and start the guest process in loop 945 952 946 if not self._waitAdditionsIsRunning(oSession.o.console.guest):953 if fWaitFacility and not self._waitAdditionsIsRunning(oSession.o.console.guest, fWaitTrayControl): 947 954 return (False, None); 948 955 … … 959 966 if fRc: 960 967 break; 961 962 968 self.closeSession(oGuestSession, False); 963 969 … … 981 987 fRc = self.closeSession(oGuestSession, True) and fRc and True; # pychecker hack. 982 988 if fRc: 983 (fRc, oGuestSession) = self.waitVMisReady(oSession );989 (fRc, oGuestSession) = self.waitVMisReady(oSession, True); 984 990 if not fRc: 985 991 reporter.error('VM is not ready after reboot'); … … 1015 1021 Installs the Windows guest additions using the test execution service. 1016 1022 """ 1017 #1018 # Delete relevant log files.1019 #1020 # Note! On some guests the files in question still can be locked by the OS, so ignore1021 # deletion errors from the guest side (e.g. sharing violations) and just continue.1022 #1023 1023 reporter.testStart('Install Guest Additions'); 1024 1024 asLogFiles = []; 1025 fHaveSetupApiDevLog = False;1026 if oVM.OSTypeId in ('WindowsNT4',):1027 sWinDir = 'C:/WinNT/';1028 else:1029 sWinDir = 'C:/Windows/';1030 asLogFiles = [sWinDir + 'setupapi.log', sWinDir + 'setupact.log', sWinDir + 'setuperr.log'];1031 1032 # Apply The SetupAPI logging level so that we also get the (most verbose) setupapi.dev.log file.1033 ## @todo !!! HACK ALERT !!! Add the value directly into the testing source image. Later.1034 (fHaveSetupApiDevLog, _, _, _) = \1035 self.guestProcessExecute(oGuestSession, 'Enabling setupapi.dev.log',1036 60 * 1000, 'c:\\Windows\\System32\\reg.exe',1037 ['c:\\Windows\\System32\\reg.exe', 'add',1038 '"HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Setup"',1039 '/v', 'LogLevel', '/t', 'REG_DWORD', '/d', '0xFF'],1040 False, True);1041 for sFile in asLogFiles:1042 try: oGuestSession.fsObjRemove(sFile);1043 except: pass;1044 1025 1045 1026 fRc = self.closeSession(oGuestSession, True); # pychecker hack. 1046 1027 1047 1028 try: 1048 oCurProgress = oSession.o.console.guest.updateGuestAdditions(self.sGuestAdditionsIso, None, None);1029 oCurProgress = oSession.o.console.guest.updateGuestAdditions(self.sGuestAdditionsIso, ['/l',], None); 1049 1030 except: 1050 1031 reporter.maybeErrXcpt(True, 'Updating Guest Additions exception for sSrc="%s":' … … 1062 1043 fRc = reporter.error('No progress object returned'); 1063 1044 1064 if fRc: 1065 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 1066 'vbox', 'password', 10 * 1000, True); 1045 #--------------------------------------- 1046 # 1047 ## 1048 ## Install the public signing key. 1049 ## 1050 # 1051 #self.oTestDriver.sleep(60 * 2); 1052 # 1053 #if oVM.OSTypeId not in ('WindowsNT4', 'Windows2000', 'WindowsXP', 'Windows2003'): 1054 # (fRc, _, _, _) = \ 1055 # self.guestProcessExecute(oGuestSession, 'Installing SHA1 certificate', 1056 # 60 * 1000, 'D:\\cert\\VBoxCertUtil.exe', 1057 # ['D:\\cert\\VBoxCertUtil.exe', 'add-trusted-publisher', 1058 # 'D:\\cert\\vbox-sha1.cer'], 1059 # False, True); 1060 # if not fRc: 1061 # reporter.error('Error installing SHA1 certificate'); 1062 # else: 1063 # (fRc, _, _, _) = \ 1064 # self.guestProcessExecute(oGuestSession, 'Installing SHA1 certificate', 1065 # 60 * 1000, 'D:\\cert\\VBoxCertUtil.exe', 1066 # ['D:\\cert\\VBoxCertUtil.exe', 'add-trusted-publisher', 1067 # 'D:\\cert\\vbox-sha256.cer'], 1068 # False, True); 1069 # if not fRc: 1070 # reporter.error('Error installing SHA256 certificate'); 1071 # 1072 #(fRc, _, _, _) = \ 1073 # self.guestProcessExecute(oGuestSession, 'Installing GA', 1074 # 60 * 1000, 'D:\\VBoxWindowsAdditions.exe', 1075 # ['D:\\VBoxWindowsAdditions.exe', '/S', '/l', 1076 # '/no_vboxservice_exit'], 1077 # False, True); 1078 # 1079 #if fRc: 1080 # # Due to the GA updates as separate process the above function returns before 1081 # # the actual installation finished. So just wait until the GA installed 1082 # fRc = self.closeSession(oGuestSession, True); 1083 # if fRc: 1084 # (fRc, oGuestSession) = self.waitVMisReady(oSession, False, False); 1085 #--------------------------------------- 1086 1087 # Store the result and try download logs anyway. 1088 fGaRc = fRc; 1089 fRc, oGuestSession = self.createSession(oSession, 'Session for user: vbox', 1090 'vbox', 'password', 10 * 1000, True); 1091 if fRc is True: 1092 (fRc, oGuestSession) = self.rebootVMAndCheckReady(oSession, oGuestSession); 1067 1093 if fRc is True: 1068 (fRc, oGuestSession) = self.rebootVMAndCheckReady(oSession, oGuestSession); 1069 if fRc is True: 1070 # Add the Windows Guest Additions installer files to the files we want to download 1071 # from the guest. 1072 sGuestAddsDir = 'C:/Program Files/Oracle/VirtualBox Guest Additions/'; 1073 asLogFiles.append(sGuestAddsDir + 'install.log'); 1074 # Note: There won't be a install_ui.log because of the silent installation. 1075 asLogFiles.append(sGuestAddsDir + 'install_drivers.log'); 1076 asLogFiles.append('C:/Windows/setupapi.log'); 1077 1078 # Note: setupapi.dev.log only is available since Windows 2000. 1079 if fHaveSetupApiDevLog: 1080 asLogFiles.append('C:/Windows/setupapi.dev.log'); 1081 1082 # 1083 # Download log files. 1084 # Ignore errors as all files above might not be present (or in different locations) 1085 # on different Windows guests. 1086 # 1087 self.downloadFiles(oGuestSession, asLogFiles, fIgnoreErrors = True); 1088 else: 1089 reporter.error('Reboot after installing GuestAdditions failed'); 1090 else: 1091 reporter.error('Create session for user vbox after GA updating failed'); 1092 reporter.testDone(); 1093 return (fRc, oGuestSession); 1094 # Add the Windows Guest Additions installer files to the files we want to download 1095 # from the guest. 1096 sGuestAddsDir = 'C:/Program Files/Oracle/VirtualBox Guest Additions/'; 1097 asLogFiles.append(sGuestAddsDir + 'install.log'); 1098 # Note: There won't be a install_ui.log because of the silent installation. 1099 asLogFiles.append(sGuestAddsDir + 'install_drivers.log'); 1100 1101 # Download log files. 1102 # Ignore errors as all files above might not be present (or in different locations) 1103 # on different Windows guests. 1104 # 1105 self.downloadFiles(oGuestSession, asLogFiles, fIgnoreErrors = True); 1106 else: 1107 reporter.error('Reboot after installing GuestAdditions failed'); 1108 else: 1109 reporter.error('Create session for user vbox after GA updating failed'); 1110 reporter.testDone(); 1111 return (fRc and fGaRc, oGuestSession); 1094 1112 1095 1113 def installVirtualBox(self, oGuestSession): … … 1101 1119 return False; 1102 1120 reporter.testStart('Install Virtualbox into the guest VM'); 1121 reporter.log("Virtualbox install file: %s" % os.path.basename(self.sTestBuild)); 1103 1122 # Used windows image already contains the C:\Temp 1104 1123 fRc = self.uploadFile(oGuestSession, self.sTestBuild, … … 1108 1127 else: 1109 1128 if self.sTestBuild.endswith('.msi'): 1129 sLogFile = 'C:\\Temp\\VBoxInstallLog.txt'; 1110 1130 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Installing VBox', 1111 1131 240 * 1000, 'C:\\Windows\\System32\\msiexec.exe', 1112 ['msiexec', '/quiet', '/i', 1113 'C:\\Temp\\' + os.path.basename(self.sTestBuild)], 1132 ['msiexec', '/quiet', '/norestart', '/i', 1133 'C:\\Temp\\' + os.path.basename(self.sTestBuild), 1134 '/lv', sLogFile], 1114 1135 False, True); 1115 1136 if not fRc: 1116 1137 reporter.error('Installing the VBox from msi installer failed'); 1117 1138 else: 1139 sLogFile = 'C:\\Temp\\Virtualbox\\VBoxInstallLog.txt'; 1118 1140 (fRc, _, _, _) = self.guestProcessExecute(oGuestSession, 'Installing VBox', 1119 1141 240 * 1000, 'C:\\Temp\\' + os.path.basename(self.sTestBuild), 1120 ['C:\\Temp\\' + os.path.basename(self.sTestBuild), '--silent'], 1142 ['C:\\Temp\\' + os.path.basename(self.sTestBuild), '-vvvv', 1143 '--silent', '--logging', 1144 '--msiparams', 'REBOOT=ReallySuppress'], 1121 1145 False, True); 1122 1146 if not fRc: 1123 1147 reporter.error('Installing the VBox failed'); 1148 else: 1149 (_, _, _, aBuf) = self.guestProcessExecute(oGuestSession, 'Check installation', 1150 240 * 1000, 'C:\\Windows\\System32\\cmd.exe', 1151 ['c:\\Windows\\System32\\cmd.exe', '/c', 1152 'dir', 'C:\\Program Files\\Oracle\\VirtualBox\\*.*'], 1153 True, True); 1154 reporter.log('Content of VirtualBxox folder:'); 1155 reporter.log(str(aBuf)); 1156 1157 asLogFiles = [sLogFile,]; 1158 self.downloadFiles(oGuestSession, asLogFiles, fIgnoreErrors = True); 1159 1124 1160 reporter.testDone(); 1125 1161 return fRc; … … 1342 1378 reporter.log(' without any default value. The test raises an exception if the'); 1343 1379 reporter.log(' option is not specified. At least, one directory should be pointed.'); 1344 reporter.log(' --guest-additions-iso <path/to/iso>');1345 reporter.log(' The path to fresh VirtualBox Guest Additions iso. The option is');1346 reporter.log(' mandatory without any default value. The test raises an exception');1347 reporter.log(' if the option is not specified.');1348 1380 reporter.log(' --test-vms <vm1[:vm2[:...]]>'); 1349 1381 reporter.log(' Test the specified VMs in the given order. Use this to change'); … … 1359 1391 if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dirs" takes a paths argument'); 1360 1392 self.asTestBuildDirs = asArgs[iArg].split(','); 1361 elif asArgs[iArg] == '--guest-additions-iso':1362 iArg += 1;1363 if iArg >= len(asArgs): raise base.InvalidOption('The "--guest-additions-iso" takes a path or url to iso argument');1364 self.sGuestAdditionsIso = asArgs[iArg];1365 1393 elif asArgs[iArg] == '--test-vms': 1366 1394 iArg += 1; … … 1386 1414 if self.asTestBuildDirs is None: 1387 1415 raise base.InvalidOption('--test-build-dirs is not specified') 1388 if self.sGuestAdditionsIso is None:1389 raise base.InvalidOption('--guest-additions-iso is not specified')1390 1391 1416 for sVM in self.asSkipVMs: 1392 1417 try: self.asTestVMs.remove(sVM); … … 1414 1439 if not self.importVBoxApi(): 1415 1440 return False; 1416 1417 # Download VBoxGuestAdditions.iso before work1418 sDestinationIso = os.path.join(self.sScratchPath, 'VBoxGuestAdditions.iso');1419 utils.noxcptDeleteFile(sDestinationIso);1420 if not downloadFile(self.sGuestAdditionsIso, sDestinationIso, '', reporter.log, reporter.error):1421 raise base.GenError("Could not download VBoxGuestAdditions.iso");1422 self.sGuestAdditionsIso = sDestinationIso;1423 1424 1441 # 1425 1442 # Configure the VMs we're going to use. … … 1434 1451 fIoApic = True, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \ 1435 1452 eNic0Type = vboxcon.NetworkAdapterType_Am79C973, cMbRam = 2048, \ 1436 cCpus = 2, sDvdImage = self. sGuestAdditionsIso);1453 cCpus = 2, sDvdImage = self.getGuestAdditionsIso()); 1437 1454 if oVM is None: 1438 1455 return False; … … 1444 1461 fIoApic = True, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \ 1445 1462 sHddControllerType = "SATA Controller", cMbRam = 2048, fPae = True, cCpus = 2, \ 1446 sDvdImage = self. sGuestAdditionsIso);1463 sDvdImage = self.getGuestAdditionsIso()); 1447 1464 if oVM is None: 1448 1465 return False; … … 1492 1509 if sVmName == self.ksOsLinux: 1493 1510 oGuestOsHlp = tdAutostartOsLinux(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type 1494 self. sGuestAdditionsIso);1511 self.getGuestAdditionsIso()); 1495 1512 elif sVmName == self.ksOsSolaris: 1496 1513 oGuestOsHlp = tdAutostartOsSolaris(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type 1497 self. sGuestAdditionsIso);1514 self.getGuestAdditionsIso()); 1498 1515 elif sVmName == self.ksOsDarwin: 1499 1516 oGuestOsHlp = tdAutostartOsDarwin(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type 1500 self. sGuestAdditionsIso);1517 self.getGuestAdditionsIso()); 1501 1518 elif sVmName == self.ksOsWindows: 1502 1519 oGuestOsHlp = tdAutostartOsWin(self, self.asTestBuildDirs, self.fpApiVer, # pylint: disable=redefined-variable-type 1503 self. sGuestAdditionsIso);1520 self.getGuestAdditionsIso()); 1504 1521 1505 1522 sTestUserAllow = 'test1'; … … 1509 1526 if oGuestOsHlp is not None: 1510 1527 #wait the VM is ready after starting 1511 (fRc, oGuestSession) = oGuestOsHlp.waitVMisReady(oSession );1528 (fRc, oGuestSession) = oGuestOsHlp.waitVMisReady(oSession, True); 1512 1529 #install fresh guest additions 1513 1530 if fRc:
Note:
See TracChangeset
for help on using the changeset viewer.