Changeset 95021 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- May 16, 2022 2:35:58 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py
r94899 r95021 594 594 595 595 def actionExecute(self): 596 # Make sure vboxapi has been imported so we can execute the driver without going thru 597 # a former configuring step. 598 if not self.importVBoxApi(): 599 return False; 596 600 if not self._detectPaths(): 597 601 return False; … … 634 638 self.sExeSuff = '.exe' if utils.getHostOs() in [ 'win', 'dos', 'os2' ] else ''; 635 639 636 self._testRunUnitTestsSet( r'^tst*', 'testcase');637 self._testRunUnitTestsSet( r'^tst*', '.');640 self._testRunUnitTestsSet(oTestVm, r'^tst*', 'testcase'); 641 self._testRunUnitTestsSet(oTestVm, r'^tst*', '.'); 638 642 639 643 fRc = self.cFailed == 0; … … 806 810 or self.oTxsSession is None: 807 811 return; 808 sStringExp = self. txsExpandString(self.oSession, self.oTxsSession,sString);812 sStringExp = self.oTxsSession.syncExpandString(sString); 809 813 if not sStringExp: 810 814 return; … … 821 825 if self.sMode.startswith('remote'): 822 826 self._logExpandString(sPath); 823 fRc = self. txsIsDir(self.oSession, self.oTxsSession,sPath, fIgnoreErrors = True);827 fRc = self.oTxsSession.syncIsDir(sPath, fIgnoreErrors = True); 824 828 if not fRc: 825 fRc = self. txsIsFile(self.oSession, self.oTxsSession,sPath, fIgnoreErrors = True);829 fRc = self.oTxsSession.syncIsFile(sPath, fIgnoreErrors = True); 826 830 else: 827 831 fRc = os.path.exists(sPath); … … 837 841 fRc = True; 838 842 if self.sMode.startswith('remote'): 839 fRc = self. txsMkDirPath(self.oSession, self.oTxsSession,sPath, fMode = 0o755);843 fRc = self.oTxsSession.syncMkDirPath(sPath, fMode = 0o755); 840 844 else: 841 845 if utils.getHostOs() in [ 'win', 'os2' ]: … … 843 847 else: 844 848 fRc = self._sudoExecuteSync(['/bin/mkdir', '-p', '-m', '0755', sPath]); 845 if fRc is not True:846 r aise Exception('Failed to create dir "%s".' % (sPath,));847 return True;849 if not fRc: 850 reporter.log('Failed to create dir "%s".' % (sPath,)); 851 return fRc; 848 852 849 853 def _wrapCopyFile(self, sSrc, sDst, iMode): … … 859 863 self._logExpandString(sDst); 860 864 if self.sMode == 'remote-exec': 861 self. txsCopyFile(self.oSession, self.oTxsSession,sSrc, sDst, iMode);865 self.oTxsSession.syncCopyFile(sSrc, sDst, iMode); 862 866 else: 863 fRc = self. txsUploadFile(self.oSession, self.oTxsSession,sSrc, sDst);867 fRc = self.oTxsSession.syncUploadFile(sSrc, sDst); 864 868 if fRc: 865 self.oTxsSession.syncChMod(sDst, iMode);869 fRc = self.oTxsSession.syncChMod(sDst, iMode); 866 870 else: 867 871 if utils.getHostOs() in [ 'win', 'os2' ]: … … 874 878 if fRc is not True: 875 879 raise Exception('Failed to chmod "%s".' % (sDst,)); 876 if fRc is not True:877 r aise Exception('Failed to copy "%s" to "%s".' % (sSrc, sDst,));878 return True;880 if not fRc: 881 reporter.log('Failed to copy "%s" to "%s".' % (sSrc, sDst,)); 882 return fRc; 879 883 880 884 def _wrapDeleteFile(self, sPath): … … 887 891 fRc = True; 888 892 if self.sMode.startswith('remote'): 889 if self. txsIsFile(self.oSession, self.oTxsSession,sPath):890 fRc = self. txsRmFile(self.oSession, self.oTxsSession, sPath);893 if self.oTxsSession.syncIsFile(sPath): 894 fRc = self.oTxsSession.syncRmFile(sPath, fIgnoreErrors = True); 891 895 else: 892 896 if os.path.exists(sPath): … … 895 899 else: 896 900 fRc = self._sudoExecuteSync(['/bin/rm', sPath]); 897 if fRc is not True:898 r aise Exception('Failed to remove "%s".' % (sPath,));899 return True;901 if not fRc: 902 reporter.log('Failed to remove "%s".' % (sPath,)); 903 return fRc; 900 904 901 905 def _wrapRemoveDir(self, sPath): … … 908 912 fRc = True; 909 913 if self.sMode.startswith('remote'): 910 if self. txsIsDir(self.oSession, self.oTxsSession,sPath):911 fRc = self. txsRmDir(self.oSession, self.oTxsSession, sPath);914 if self.oTxsSession.syncIsDir(sPath): 915 fRc = self.oTxsSession.syncRmDir(sPath, fIgnoreErrors = True); 912 916 else: 913 917 if os.path.exists(sPath): … … 916 920 else: 917 921 fRc = self._sudoExecuteSync(['/bin/rmdir', sPath]); 918 if fRc is not True:919 r aise Exception('Failed to remove "%s".' % (sPath,));920 return True;922 if not fRc: 923 reporter.log('Failed to remove "%s".' % (sPath,)); 924 return fRc; 921 925 922 926 def _envSet(self, sName, sValue): … … 929 933 return True; 930 934 931 def _executeTestCase(self, sName, sFullPath, sTestCaseSubDir, oDevNull): # pylint: disable=too-many-locals,too-many-statements935 def _executeTestCase(self, oTestVm, sName, sFullPath, sTestCaseSubDir, oDevNull): # pylint: disable=too-many-locals,too-many-statements 932 936 """ 933 937 Executes a test case. … … 975 979 976 980 sDst = os.path.join(sDstDir, os.path.basename(sFullPath) + self.sExeSuff); 977 self._wrapCopyFile(sSrc, sDst, 0o755); 981 fModeExe = 0; 982 fModeDeps = 0; 983 if not oTestVm.isWindows(): ## @todo NT4 does not like the chmod. Investigate this! 984 fModeExe = 0o755; 985 fModeDeps = 0o644; 986 self._wrapCopyFile(sSrc, sDst, fModeExe); 978 987 asFilesToRemove.append(sDst); 979 988 … … 986 995 if self._wrapPathExists(sSrc): 987 996 sDst = os.path.join(sDstDir, os.path.basename(sSrc)); 988 self._wrapCopyFile(sSrc, sDst, 0o644);997 self._wrapCopyFile(sSrc, sDst, fModeDeps); 989 998 asFilesToRemove.append(sDst); 990 999 … … 994 1003 if os.path.exists(sSrc): 995 1004 sDst = os.path.join(sDstDir, os.path.basename(sSrc)); 996 self._wrapCopyFile(sSrc, sDst, 0o644);1005 self._wrapCopyFile(sSrc, sDst, fModeDeps); 997 1006 asFilesToRemove.append(sDst); 998 1007 … … 1004 1013 if os.path.exists(sSrc): 1005 1014 sDst = os.path.join(sDstDir, os.path.basename(sSrc)); 1006 self._wrapCopyFile(sSrc, sDst, 0o644);1015 self._wrapCopyFile(sSrc, sDst, fModeDeps); 1007 1016 asFilesToRemove.append(sDst); 1008 1017 … … 1043 1052 if not self.fDryRun: 1044 1053 if fCopyToRemote: 1045 fRc = self.txsRunTest(self.oTxsSession, sName, 30 * 60 * 1000, asArgs[0], asArgs, self.asEnv, \1046 1054 fRc = self.txsRunTest(self.oTxsSession, sName, cMsTimeout = 30 * 60 * 1000, sExecName = asArgs[0], \ 1055 asArgs = asArgs, asAddEnv = self.asEnv, fCheckSessionStatus = True); 1047 1056 if fRc: 1048 1057 iRc = 0; … … 1123 1132 return fSkipped; 1124 1133 1125 def _testRunUnitTestsSet(self, sTestCasePattern, sTestCaseSubDir):1134 def _testRunUnitTestsSet(self, oTestVm, sTestCasePattern, sTestCaseSubDir): 1126 1135 """ 1127 1136 Run subset of the unit tests set. … … 1203 1212 reporter.testStart(sName); 1204 1213 try: 1205 fSkipped = self._executeTestCase( sName, sFullPath, sTestCaseSubDir, oDevNull);1214 fSkipped = self._executeTestCase(oTestVm, sName, sFullPath, sTestCaseSubDir, oDevNull); 1206 1215 except: 1207 1216 reporter.errorXcpt('!*!');
Note:
See TracChangeset
for help on using the changeset viewer.