Changeset 77551 in vbox for trunk/src/VBox/ValidationKit/tests
- Timestamp:
- Mar 4, 2019 10:27:45 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129156
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
r77550 r77551 91 91 self.fRc = False; 92 92 ## IGuest reference. 93 self.oGuest = oSession.o.console.guest; 94 # Rest not used (yet). 93 self.oGuest = oSession.o.console.guest; 94 self.oSesison = oSession; 95 self.oTxsSesison = oTxsSession; 96 self.oTestVm = oTestVm; 95 97 96 98 class tdCtxCreds(object): … … 98 100 Provides credentials to pass to the guest. 99 101 """ 100 def __init__(self, sUser = None, sPassword = None, sDomain = None, oTestVm = None): 101 # If no user is specified, select the default user and 102 # password for the given test VM. 103 if sUser is None: 104 assert sPassword is None; 105 assert sDomain is None; 106 assert oTestVm is not None; 107 108 ## @todo fix this so all VMs have several usable test users with the same passwords (or none). 109 if oTestVm.isWindows(): 110 sUser = 'Administrator'; 102 def __init__(self, sUser = None, sPassword = None, sDomain = None): 103 self.sUser = sUser; 104 self.sPassword = sPassword; 105 self.sDomain = sDomain; 106 107 def applyDefaultsIfNotSet(self, oTestVm): 108 """ 109 Applies credential defaults, based on the test VM (guest OS), if 110 no credentials were set yet. 111 """ 112 self.oTestVm = oTestVm; 113 assert self.oTestVm is not None; 114 115 if self.sUser is None: 116 if self.oTestVm.isWindows(): 117 self.sUser = 'Administrator'; 111 118 else: 112 s User = 'vbox';113 sPassword = 'password'; 114 sDomain = '';115 116 self.sUser = sUser; 117 self.sPassword = sPassword if sPassword is not None else '';118 self.sDomain = sDomain if sDomain is not None else'';119 self.sUser = 'vbox'; 120 121 if self.sPassword is None: 122 self.sPassword = 'password'; 123 124 if self.sDomain is None: 125 self.sDomain = ''; 119 126 120 127 class tdTestGuestCtrlBase(object): … … 136 143 """ 137 144 self.oTest = tdCtxTest(oSession, oTxsSession, oTestVm); 145 self.oCreds.applyDefaultsIfNotSet(oTestVm); 138 146 return self.oTest; 139 147 … … 226 234 Test for copying files from the guest to the host. 227 235 """ 228 def __init__(self, sSrc = "", sDst = "", sUser = "", sPassword = "", aFlags = None):236 def __init__(self, sSrc = "", sDst = "", sUser = None, sPassword = None, aFlags = None): 229 237 tdTestGuestCtrlBase.__init__(self); 230 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");238 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 231 239 self.sSrc = sSrc; 232 240 self.sDst = sDst; … … 237 245 Test for copying files from the host to the guest. 238 246 """ 239 def __init__(self, sSrc = "", sDst = "", sUser = "", sPassword = "", aFlags = None):247 def __init__(self, sSrc = "", sDst = "", sUser = None, sPassword = None, aFlags = None): 240 248 tdTestGuestCtrlBase.__init__(self); 241 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");249 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 242 250 self.sSrc = sSrc; 243 251 self.sDst = sDst; … … 248 256 Test for directoryCreate call. 249 257 """ 250 def __init__(self, sDirectory = "", sUser = "", sPassword = "", fMode = 0, aFlags = None):258 def __init__(self, sDirectory = "", sUser = None, sPassword = None, fMode = 0, aFlags = None): 251 259 tdTestGuestCtrlBase.__init__(self); 252 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");260 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 253 261 self.sDirectory = sDirectory; 254 262 self.fMode = fMode; … … 259 267 Test for the directoryCreateTemp call. 260 268 """ 261 def __init__(self, sDirectory = "", sTemplate = "", sUser = "", sPassword = "", fMode = 0, fSecure = False):269 def __init__(self, sDirectory = "", sTemplate = "", sUser = None, sPassword = None, fMode = 0, fSecure = False): 262 270 tdTestGuestCtrlBase.__init__(self); 263 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");271 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 264 272 self.sDirectory = sDirectory; 265 273 self.sTemplate = sTemplate; … … 271 279 Test for the directoryOpen call. 272 280 """ 273 def __init__(self, sDirectory = "", sUser = "", sPassword = "",281 def __init__(self, sDirectory = "", sUser = None, sPassword = None, 274 282 sFilter = "", aFlags = None): 275 283 tdTestGuestCtrlBase.__init__(self); 276 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");284 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 277 285 self.sDirectory = sDirectory; 278 286 self.sFilter = sFilter; … … 283 291 Test for the opening, reading and closing a certain directory. 284 292 """ 285 def __init__(self, sDirectory = "", sUser = "", sPassword = "",293 def __init__(self, sDirectory = "", sUser = None, sPassword = None, 286 294 sFilter = "", aFlags = None): 287 295 tdTestDirOpen.__init__(self, sDirectory, sUser, sPassword, sFilter, aFlags); … … 294 302 def __init__(self, sCmd = "", aArgs = None, aEnv = None, \ 295 303 aFlags = None, timeoutMS = 5 * 60 * 1000, \ 296 sUser = "", sPassword = "", sDomain = "", \304 sUser = None, sPassword = None, sDomain = None, \ 297 305 fWaitForExit = True): 298 306 tdTestGuestCtrlBase.__init__(self); … … 314 322 Test for the file exists API call (fileExists). 315 323 """ 316 def __init__(self, sFile = "", sUser = "", sPassword = ""):324 def __init__(self, sFile = "", sUser = None, sPassword = None): 317 325 tdTestGuestCtrlBase.__init__(self); 318 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");326 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 319 327 self.sFile = sFile; 320 328 … … 323 331 Test querying guest file information. 324 332 """ 325 def __init__(self, sFile = "", sUser = "", sPassword = ""):333 def __init__(self, sFile = "", sUser = None, sPassword = None): 326 334 tdTestGuestCtrlBase.__init__(self); 327 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");335 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 328 336 self.sFile = sFile; 329 337 … … 332 340 Test querying guest file information. 333 341 """ 334 def __init__(self, sFile = "", sUser = "", sPassword = "", cbSize = 0, eFileType = 0):342 def __init__(self, sFile = "", sUser = None, sPassword = None, cbSize = 0, eFileType = 0): 335 343 tdTestGuestCtrlBase.__init__(self); 336 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");344 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 337 345 self.sFile = sFile; 338 346 self.cbSize = cbSize; … … 343 351 Test for the IGuestFile object. 344 352 """ 345 def __init__(self, sFile = "", sUser = "", sPassword = ""):353 def __init__(self, sFile = "", sUser = None, sPassword = None): 346 354 tdTestGuestCtrlBase.__init__(self); 347 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");355 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 348 356 self.sFile = sFile; 349 357 … … 352 360 Test for the file size query API call (fileQuerySize). 353 361 """ 354 def __init__(self, sFile = "", sUser = "", sPassword = ""):362 def __init__(self, sFile = "", sUser = None, sPassword = None): 355 363 tdTestGuestCtrlBase.__init__(self); 356 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");364 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 357 365 self.sFile = sFile; 358 366 … … 361 369 Tests reading from guest files. 362 370 """ 363 def __init__(self, sFile = "", sUser = "", sPassword = "",371 def __init__(self, sFile = "", sUser = None, sPassword = None, 364 372 sOpenMode = "r", sDisposition = "", 365 373 sSharingMode = "", … … 367 375 aBuf = None): 368 376 tdTestGuestCtrlBase.__init__(self); 369 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");377 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = None); 370 378 self.sFile = sFile; 371 379 self.sOpenMode = sOpenMode; … … 403 411 Test the guest session handling. 404 412 """ 405 def __init__(self, sUser = "", sPassword = "", sDomain = "", \413 def __init__(self, sUser = None, sPassword = None, sDomain = None, \ 406 414 sSessionName = ""): 407 415 tdTestGuestCtrlBase.__init__(self); … … 437 445 # 438 446 assert self.enmUser is None; # For later. 439 self.oCreds = tdCtxCreds( oTestVm = oTestVm);447 self.oCreds = tdCtxCreds(); 440 448 self.setEnvironment(oVmSession, oTxsSession, oTestVm); 441 449 reporter.log2('%s: %s steps' % (sMsgPrefix, len(self.aoSteps),)); … … 849 857 """ 850 858 def __init__(self, sSrc = "", aArgs = None, aFlags = None, 851 sUser = "", sPassword = "", sDomain = ""):859 sUser = None, sPassword = None, sDomain = None): 852 860 tdTestGuestCtrlBase.__init__(self); 853 861 self.oCreds = tdCtxCreds(sUser, sPassword, sDomain); … … 1478 1486 """ 1479 1487 1480 if oTestVm.isWindows():1481 sUser = "Administrator";1482 else:1483 sUser = "vbox";1484 sPassword = "password";1485 1486 1488 aaTests = [ 1487 1489 # Invalid parameters. 1488 [ tdTestSession(), 1489 tdTestResultSession(fRc = False) ], 1490 [ tdTestSession(sUser = ''), 1491 tdTestResultSession(fRc = False) ], 1492 [ tdTestSession(sPassword = 'bar'), 1493 tdTestResultSession(fRc = False) ], 1494 [ tdTestSession(sDomain = 'boo'), 1495 tdTestResultSession(fRc = False) ], 1496 [ tdTestSession(sPassword = 'bar', sDomain = 'boo'), 1497 tdTestResultSession(fRc = False) ], 1490 [ tdTestSession(sUser = ''), tdTestResultSession() ], 1491 [ tdTestSession(sPassword = 'bar'), tdTestResultSession() ], 1492 [ tdTestSession(sDomain = 'boo'),tdTestResultSession() ], 1493 [ tdTestSession(sPassword = 'bar', sDomain = 'boo'), tdTestResultSession() ], 1498 1494 # User account without a passwort - forbidden. 1499 [ tdTestSession(sUser = sUser), 1500 tdTestResultSession(fRc = False) ], 1495 [ tdTestSession(sPassword = "" ), tdTestResultSession() ], 1501 1496 # Wrong credentials. 1502 1497 # Note: On Guest Additions < 4.3 this always succeeds because these don't 1503 1498 # support creating dedicated sessions. Instead, guest process creation 1504 1499 # then will fail. See note below. 1505 [ tdTestSession(sUser = 'foo', sPassword = 'bar', sDomain = 'boo'), 1506 tdTestResultSession(fRc = False) ], 1500 [ tdTestSession(sUser = 'foo', sPassword = 'bar', sDomain = 'boo'), tdTestResultSession() ], 1507 1501 # Correct credentials. 1508 [ tdTestSession( sUser = sUser, sPassword = sPassword),1502 [ tdTestSession(), 1509 1503 tdTestResultSession(fRc = True, cNumSessions = 1) ] 1510 1504 ]; … … 1558 1552 reporter.log2('Opening multiple guest tsessions at once ...'); 1559 1553 for i in range(iMaxGuestSessions + 1): 1560 multiSession[i] = tdTestSession(s User = sUser, sPassword = sPassword, sSessionName = 'MultiSession #%d' % (i,));1554 multiSession[i] = tdTestSession(sSessionName = 'MultiSession #%d' % (i,)); 1561 1555 multiSession[i].setEnvironment(oSession, oTxsSession, oTestVm); 1562 1556 curSessionCount = multiSession[i].getSessionCount(self.oTstDrv.oVBoxMgr); … … 1629 1623 1630 1624 if oTestVm.isWindows(): 1631 sUser = "Administrator";1632 sPassword = "password";1633 sDomain = "";1634 1625 sFile = "C:\\windows\\system32\\kernel32.dll"; 1635 1626 elif oTestVm.isLinux(): 1636 sUser = "vbox";1637 sPassword = "password";1638 sDomain = "";1639 1627 sFile = "/bin/sh"; 1628 1629 # Use credential defaults. 1630 oCreds = tdCtxCreds(); 1631 oCreds.applyDefaultsIfNotSet(oTestVm); 1640 1632 1641 1633 # Number of stale guest files to create. … … 1645 1637 try: 1646 1638 oGuest = oSession.o.console.guest; 1647 oGuestSession = oGuest.createSession(sUser, sPassword, sDomain, \ 1648 "testGuestCtrlSessionFileRefs"); 1639 oGuestSession = oGuest.createSession(oCreds.sUser, oCreds.sPassword, oCreds.sDomain, "testGuestCtrlSessionFileRefs"); 1649 1640 fWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ]; 1650 1641 waitResult = oGuestSession.waitForArray(fWaitFor, 30 * 1000); … … 1769 1760 1770 1761 if oTestVm.isWindows(): 1771 sUser = "Administrator";1772 1762 sCmd = "C:\\windows\\system32\\cmd.exe"; 1773 1763 elif oTestVm.isLinux(): 1774 sUser = "vbox";1775 1764 sCmd = "/bin/sh"; 1776 sPassword = "password";1777 sDomain = "";1778 1765 aArgs = [sCmd,]; 1766 1767 # Use credential defaults. 1768 oCreds = tdCtxCreds(); 1769 oCreds.applyDefaultsIfNotSet(oTestVm); 1779 1770 1780 1771 # Number of stale guest processes to create. … … 1784 1775 try: 1785 1776 oGuest = oSession.o.console.guest; 1786 oGuestSession = oGuest.createSession(sUser, sPassword, sDomain, \ 1787 "testGuestCtrlSessionProcRefs"); 1777 oGuestSession = oGuest.createSession(oCreds.sUser, oCreds.sPassword, oCreds.sDomain, "testGuestCtrlSessionProcRefs"); 1788 1778 fWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ]; 1789 1779 waitResult = oGuestSession.waitForArray(fWaitFor, 30 * 1000); … … 1927 1917 1928 1918 if oTestVm.isWindows(): 1929 sUser = "Administrator";1930 else:1931 sUser = "vbox";1932 sPassword = "password";1933 1934 if oTestVm.isWindows():1935 1919 sImageOut = "C:\\windows\\system32\\cmd.exe"; 1936 1920 else: 1937 sImageOut = "/bin/ sh";1921 sImageOut = "/bin/ls"; 1938 1922 1939 1923 aaInvalid = [ 1940 1924 # Invalid parameters. 1941 [ tdTestExec(sUser = sUser, sPassword = sPassword), 1942 tdTestResultExec(fRc = False) ], 1925 [ tdTestExec(), tdTestResultExec() ], 1943 1926 # Non-existent / invalid image. 1944 [ tdTestExec(sCmd = "non-existent", sUser = sUser, sPassword = sPassword), 1945 tdTestResultExec(fRc = False) ], 1946 [ tdTestExec(sCmd = "non-existent2", sUser = sUser, sPassword = sPassword, fWaitForExit = True), 1947 tdTestResultExec(fRc = False) ], 1927 [ tdTestExec(sCmd = "non-existent"), tdTestResultExec() ], 1928 [ tdTestExec(sCmd = "non-existent2"), tdTestResultExec() ], 1948 1929 # Use an invalid format string. 1949 [ tdTestExec(sCmd = "%$%%%&", sUser = sUser, sPassword = sPassword), 1950 tdTestResultExec(fRc = False) ], 1930 [ tdTestExec(sCmd = "%$%%%&"), tdTestResultExec() ], 1951 1931 # More stuff. 1952 [ tdTestExec(sCmd = u"ƒ‰‹ˆ÷‹¸", sUser = sUser, sPassword = sPassword), 1953 tdTestResultExec(fRc = False) ], 1954 [ tdTestExec(sCmd = "???://!!!", sUser = sUser, sPassword = sPassword), 1955 tdTestResultExec(fRc = False) ], 1956 [ tdTestExec(sCmd = "<>!\\", sUser = sUser, sPassword = sPassword), 1957 tdTestResultExec(fRc = False) ] 1932 [ tdTestExec(sCmd = u"ƒ‰‹ˆ÷‹¸"), tdTestResultExec() ], 1933 [ tdTestExec(sCmd = "???://!!!"), tdTestResultExec() ], 1934 [ tdTestExec(sCmd = "<>!\\"), tdTestResultExec() ], 1958 1935 # Enable as soon as ERROR_BAD_DEVICE is implemented. 1959 #[ tdTestExec(sCmd = "CON", sUser = sUser, sPassword = sPassword), 1960 # tdTestResultExec(fRc = False) ] 1936 #[ tdTestExec(sCmd = "CON", tdTestResultExec() ], 1961 1937 ]; 1962 1938 … … 1965 1941 aaExec = [ 1966 1942 # Basic executon. 1967 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ], 1968 sUser = sUser, sPassword = sPassword), 1943 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ]), 1969 1944 tdTestResultExec(fRc = True) ], 1970 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32\\kernel32.dll' ], 1971 sUser = sUser, sPassword = sPassword), 1945 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32\\kernel32.dll' ]), 1972 1946 tdTestResultExec(fRc = True) ], 1973 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32\\nonexist.dll' ], 1974 sUser = sUser, sPassword = sPassword), 1947 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32\\nonexist.dll' ]), 1975 1948 tdTestResultExec(fRc = True, iExitCode = 1) ], 1976 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', '/wrongparam' ], 1977 sUser = sUser, sPassword = sPassword), 1949 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', '/wrongparam' ]), 1978 1950 tdTestResultExec(fRc = True, iExitCode = 1) ], 1979 1951 # Paths with spaces. 1980 1952 ## @todo Get path of installed Guest Additions. Later. 1981 [ tdTestExec(sCmd = sVBoxControl, aArgs = [ sVBoxControl, 'version' ], 1982 sUser = sUser, sPassword = sPassword), 1953 [ tdTestExec(sCmd = sVBoxControl, aArgs = [ sVBoxControl, 'version' ]), 1983 1954 tdTestResultExec(fRc = True) ], 1984 1955 # StdOut. 1985 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ], 1986 sUser = sUser, sPassword = sPassword), 1956 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ]), 1987 1957 tdTestResultExec(fRc = True) ], 1988 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stdout-non-existing' ], 1989 sUser = sUser, sPassword = sPassword), 1958 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stdout-non-existing' ]), 1990 1959 tdTestResultExec(fRc = True, iExitCode = 1) ], 1991 1960 # StdErr. 1992 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ], 1993 sUser = sUser, sPassword = sPassword), 1961 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ]), 1994 1962 tdTestResultExec(fRc = True) ], 1995 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stderr-non-existing' ], 1996 sUser = sUser, sPassword = sPassword), 1963 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stderr-non-existing' ]), 1997 1964 tdTestResultExec(fRc = True, iExitCode = 1) ], 1998 1965 # StdOut + StdErr. 1999 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ], 2000 sUser = sUser, sPassword = sPassword), 1966 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ]), 2001 1967 tdTestResultExec(fRc = True) ], 2002 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stdouterr-non-existing' ], 2003 sUser = sUser, sPassword = sPassword), 1968 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stdouterr-non-existing' ]), 2004 1969 tdTestResultExec(fRc = True, iExitCode = 1) ] 2005 1970 # FIXME: Failing tests. 2006 1971 # Environment variables. 2007 1972 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_NONEXIST' ], 2008 # sUser = sUser, sPassword = sPassword),2009 1973 # tdTestResultExec(fRc = True, iExitCode = 1) ] 2010 1974 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'windir' ], 2011 # sUser = sUser, sPassword = sPassword,2012 1975 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2013 1976 # tdTestResultExec(fRc = True, sBuf = 'windir=C:\\WINDOWS\r\n') ], 2014 1977 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_FOO' ], 2015 # sUser = sUser, sPassword = sPassword,2016 1978 # aEnv = [ 'TEST_FOO=BAR' ], 2017 1979 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2018 1980 # tdTestResultExec(fRc = True, sBuf = 'TEST_FOO=BAR\r\n') ], 2019 1981 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_FOO' ], 2020 # sUser = sUser, sPassword = sPassword,2021 1982 # aEnv = [ 'TEST_FOO=BAR', 'TEST_BAZ=BAR' ], 2022 1983 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), … … 2030 1991 aaExec = [ 2031 1992 # Basic executon. 2032 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls', '/R', 'etc' ], 2033 sUser = sUser, sPassword = sPassword), 1993 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-R', '/etc' ]), 1994 tdTestResultExec(fRc = True, iExitCode = 1) ], 1995 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/bin/sh' ]), 2034 1996 tdTestResultExec(fRc = True) ], 2035 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls /bin/sh' ], 2036 sUser = sUser, sPassword = sPassword), 2037 tdTestResultExec(fRc = True) ], 2038 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '--wrong-parameter' ], 2039 sUser = sUser, sPassword = sPassword), 1997 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '--wrong-parameter' ]), 2040 1998 tdTestResultExec(fRc = True, iExitCode = 2) ], 2041 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls /non/existent' ], 2042 sUser = sUser, sPassword = sPassword), 2043 tdTestResultExec(fRc = True, iExitCode = 2) ], 2044 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls /bin/sh /wrongparam' ], 2045 sUser = sUser, sPassword = sPassword), 1999 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/non/existent' ]), 2046 2000 tdTestResultExec(fRc = True, iExitCode = 2) ], 2047 2001 # Paths with spaces. 2048 2002 ## @todo Get path of installed Guest Additions. Later. 2049 [ tdTestExec(sCmd = sVBoxControl, aArgs = [ sVBoxControl, 'version' ], 2050 sUser = sUser, sPassword = sPassword), 2003 [ tdTestExec(sCmd = sVBoxControl, aArgs = [ sVBoxControl, 'version' ]), 2051 2004 tdTestResultExec(fRc = True) ], 2052 2005 # StdOut. 2053 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls /etc' ], 2054 sUser = sUser, sPassword = sPassword), 2006 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/etc' ]), 2055 2007 tdTestResultExec(fRc = True) ], 2056 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls stdout-non-existing' ], 2057 sUser = sUser, sPassword = sPassword), 2008 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, 'stdout-non-existing' ]), 2058 2009 tdTestResultExec(fRc = True, iExitCode = 2) ], 2059 2010 # StdErr. 2060 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls /etc' ], 2061 sUser = sUser, sPassword = sPassword), 2011 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/etc' ]), 2062 2012 tdTestResultExec(fRc = True) ], 2063 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls stderr-non-existing' ], 2064 sUser = sUser, sPassword = sPassword), 2013 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, 'stderr-non-existing' ]), 2065 2014 tdTestResultExec(fRc = True, iExitCode = 2) ], 2066 2015 # StdOut + StdErr. 2067 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls /etc' ], 2068 sUser = sUser, sPassword = sPassword), 2016 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/etc' ]), 2069 2017 tdTestResultExec(fRc = True) ], 2070 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '-c', 'ls stdouterr-non-existing' ], 2071 sUser = sUser, sPassword = sPassword), 2018 [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, 'stdouterr-non-existing' ]), 2072 2019 tdTestResultExec(fRc = True, iExitCode = 2) ] 2073 2020 # FIXME: Failing tests. 2074 2021 # Environment variables. 2075 2022 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_NONEXIST' ], 2076 # sUser = sUser, sPassword = sPassword),2077 2023 # tdTestResultExec(fRc = True, iExitCode = 1) ] 2078 2024 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'windir' ], 2079 # sUser = sUser, sPassword = sPassword,2025 # 2080 2026 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2081 2027 # tdTestResultExec(fRc = True, sBuf = 'windir=C:\\WINDOWS\r\n') ], 2082 2028 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_FOO' ], 2083 # sUser = sUser, sPassword = sPassword,2084 2029 # aEnv = [ 'TEST_FOO=BAR' ], 2085 2030 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2086 2031 # tdTestResultExec(fRc = True, sBuf = 'TEST_FOO=BAR\r\n') ], 2087 2032 # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_FOO' ], 2088 # sUser = sUser, sPassword = sPassword,2089 2033 # aEnv = [ 'TEST_FOO=BAR', 'TEST_BAZ=BAR' ], 2090 2034 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), … … 2094 2038 ## @todo Add task which gets killed at some random time while letting the guest output something. 2095 2039 ]; 2096 else:2097 reporter.log('No OS-specific tests for non-Windows yet!');2098 2040 2099 2041 # Build up the final test array for the first batch. … … 2125 2067 if fRc is False: 2126 2068 break; 2069 2070 reporter.log('Execution of all tests done, checking for stale sessions'); 2127 2071 2128 2072 # No sessions left? … … 2182 2126 reporter.logXcpt('Could not create one session:'); 2183 2127 2128 reporter.log('Execution of all tests done, checking for stale sessions again'); 2129 2184 2130 # No sessions left? 2185 2131 if fRc is True: … … 2197 2143 2198 2144 if oTestVm.isWindows(): 2199 sUser = "Administrator";2200 else:2201 sUser = "vbox";2202 sPassword = "password";2203 2204 if oTestVm.isWindows():2205 2145 sImage = "C:\\windows\\system32\\cmd.exe"; 2206 2146 else: … … 2211 2151 aaTests.extend([ 2212 2152 # Simple. 2213 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'wrongcommand' ], 2214 sUser = sUser, sPassword = sPassword), 2153 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'wrongcommand' ]), 2215 2154 tdTestResultExec(fRc = True, iExitCode = 1) ], 2216 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'exit', '22' ], 2217 sUser = sUser, sPassword = sPassword), 2155 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'exit', '22' ]), 2218 2156 tdTestResultExec(fRc = True, iExitCode = 22) ], 2219 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'set', 'ERRORLEVEL=234' ], 2220 sUser = sUser, sPassword = sPassword), 2157 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'set', 'ERRORLEVEL=234' ]), 2221 2158 tdTestResultExec(fRc = True, iExitCode = 0) ], 2222 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'echo', '%WINDIR%' ], 2223 sUser = sUser, sPassword = sPassword), 2159 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'echo', '%WINDIR%' ]), 2224 2160 tdTestResultExec(fRc = True, iExitCode = 0) ], 2225 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'set', 'ERRORLEVEL=0' ], 2226 sUser = sUser, sPassword = sPassword), 2161 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'set', 'ERRORLEVEL=0' ]), 2227 2162 tdTestResultExec(fRc = True, iExitCode = 0) ], 2228 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ], 2229 sUser = sUser, sPassword = sPassword), 2163 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ]), 2230 2164 tdTestResultExec(fRc = True, iExitCode = 0) ], 2231 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32\\kernel32.dll' ], 2232 sUser = sUser, sPassword = sPassword), 2165 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32\\kernel32.dll' ]), 2233 2166 tdTestResultExec(fRc = True, iExitCode = 0) ], 2234 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ], 2235 sUser = sUser, sPassword = sPassword), 2167 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ]), 2236 2168 tdTestResultExec(fRc = True, iExitCode = 1) ], 2237 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ], 2238 sUser = sUser, sPassword = sPassword), 2169 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ]), 2239 2170 tdTestResultExec(fRc = True, iExitCode = 1) ] 2240 2171 # FIXME: Failing tests. 2241 2172 # With stdout. 2242 2173 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ], 2243 # sUser = sUser, sPassword = sPassword,aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]),2174 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]), 2244 2175 # tdTestResultExec(fRc = True, iExitCode = 0) ], 2245 2176 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ], 2246 # sUser = sUser, sPassword = sPassword,aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]),2177 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]), 2247 2178 # tdTestResultExec(fRc = True, iExitCode = 1) ], 2248 2179 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ], 2249 # sUser = sUser, sPassword = sPassword,aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]),2180 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]), 2250 2181 # tdTestResultExec(fRc = True, iExitCode = 1) ], 2251 2182 # With stderr. 2252 2183 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ], 2253 # sUser = sUser, sPassword = sPassword,aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]),2184 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2254 2185 # tdTestResultExec(fRc = True, iExitCode = 0) ], 2255 2186 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ], 2256 # sUser = sUser, sPassword = sPassword,aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]),2187 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2257 2188 # tdTestResultExec(fRc = True, iExitCode = 1) ], 2258 2189 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ], 2259 # sUser = sUser, sPassword = sPassword,aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]),2190 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2260 2191 # tdTestResultExec(fRc = True, iExitCode = 1) ], 2261 2192 # With stdout/stderr. 2262 2193 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ], 2263 # sUser = sUser, sPassword = sPassword,2264 2194 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2265 2195 # tdTestResultExec(fRc = True, iExitCode = 0) ], 2266 2196 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ], 2267 # sUser = sUser, sPassword = sPassword,2268 2197 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2269 2198 # tdTestResultExec(fRc = True, iExitCode = 1) ], 2270 2199 # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ], 2271 # sUser = sUser, sPassword = sPassword,2272 2200 # aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]), 2273 2201 # tdTestResultExec(fRc = True, iExitCode = 1) ] … … 2277 2205 aaTests.extend([ 2278 2206 # Simple. 2279 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'wrongcommand' ], 2280 sUser = sUser, sPassword = sPassword), 2207 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'wrongcommand' ]), 2281 2208 tdTestResultExec(fRc = True, iExitCode = 127) ], 2282 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'exit 22' ], 2283 sUser = sUser, sPassword = sPassword), 2209 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'exit 22' ]), 2284 2210 tdTestResultExec(fRc = True, iExitCode = 22) ], 2285 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'echo $PWD' ], 2286 sUser = sUser, sPassword = sPassword), 2211 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'echo $PWD' ]), 2287 2212 tdTestResultExec(fRc = True, iExitCode = 0) ], 2288 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'export MY_ERRORLEVEL=0' ], 2289 sUser = sUser, sPassword = sPassword), 2213 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'export MY_ERRORLEVEL=0' ]), 2290 2214 tdTestResultExec(fRc = True, iExitCode = 0) ], 2291 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /etc' ], 2292 sUser = sUser, sPassword = sPassword), 2215 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /etc' ]), 2293 2216 tdTestResultExec(fRc = True, iExitCode = 0) ], 2294 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /bin/sh' ], 2295 sUser = sUser, sPassword = sPassword), 2217 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /bin/sh' ]), 2296 2218 tdTestResultExec(fRc = True, iExitCode = 0) ], 2297 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /non/existing/file' ], 2298 sUser = sUser, sPassword = sPassword), 2219 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /non/existing/file' ]), 2299 2220 tdTestResultExec(fRc = True, iExitCode = 2) ], 2300 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /non/existing/dir/' ], 2301 sUser = sUser, sPassword = sPassword), 2221 [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '-c', 'ls /non/existing/dir/' ]), 2302 2222 tdTestResultExec(fRc = True, iExitCode = 2) ] 2303 2223 ]); … … 2325 2245 2326 2246 if oTestVm.isWindows(): 2327 sUser = "Administrator";2328 else:2329 sUser = "vbox";2330 sPassword = "password";2331 sDomain = "";2332 2333 if oTestVm.isWindows():2334 2247 sImage = "C:\\windows\\system32\\cmd.exe"; 2335 2248 else: 2336 2249 sImage = "/bin/sh"; 2337 2250 2251 # Use credential defaults. 2252 oCreds = tdCtxCreds(); 2253 oCreds.applyDefaultsIfNotSet(oTestVm); 2254 2338 2255 fRc = True; 2339 2256 try: 2340 2257 oGuest = oSession.o.console.guest; 2341 oGuestSession = oGuest.createSession( sUser, sPassword,sDomain, "testGuestCtrlExecTimeout");2258 oGuestSession = oGuest.createSession(oCreds.sUser, oCreds.sPassword, oCreds.sDomain, "testGuestCtrlExecTimeout"); 2342 2259 oGuestSession.waitForArray([ vboxcon.GuestSessionWaitForFlag_Start ], 30 * 1000); 2343 2260 # Create a process which never terminates and should timeout when … … 2414 2331 2415 2332 if oTestVm.isWindows(): 2416 sUser = "Administrator";2417 else:2418 sUser = "vbox";2419 sPassword = "password";2420 2421 if oTestVm.isWindows():2422 2333 sScratch = "C:\\Temp\\vboxtest\\testGuestCtrlDirCreate\\"; 2423 2334 else: … … 2427 2338 aaTests.extend([ 2428 2339 # Invalid stuff. 2429 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '' ), 2430 tdTestResult(fRc = False) ], 2340 [ tdTestDirCreate(sDirectory = '' ), tdTestResult() ], 2431 2341 # More unusual stuff. 2432 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '..\\..\\' ), 2433 tdTestResult(fRc = False) ], 2434 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '../../' ), 2435 tdTestResult(fRc = False) ], 2436 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = 'z:\\' ), 2437 tdTestResult(fRc = False) ], 2438 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '\\\\uncrulez\\foo' ), 2439 tdTestResult(fRc = False) ], 2342 [ tdTestDirCreate(sDirectory = '..\\..\\' ), tdTestResult() ], 2343 [ tdTestDirCreate(sDirectory = '../../' ), tdTestResult() ], 2344 [ tdTestDirCreate(sDirectory = 'z:\\' ), tdTestResult() ], 2345 [ tdTestDirCreate(sDirectory = '\\\\uncrulez\\foo' ), tdTestResult() ], 2440 2346 # Creating directories. 2441 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = sScratch ), 2442 tdTestResult(fRc = False) ], 2443 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = os.path.join(sScratch, 'foo\\bar\\baz'), 2444 aFlags = [ vboxcon.DirectoryCreateFlag_Parents ] ), 2347 [ tdTestDirCreate(sDirectory = sScratch ), tdTestResult() ], 2348 [ tdTestDirCreate(sDirectory = os.path.join(sScratch, 'foo\\bar\\baz'), 2349 aFlags = [ vboxcon.DirectoryCreateFlag_Parents ] ), 2445 2350 tdTestResult(fRc = True) ], 2446 [ tdTestDirCreate(s User = sUser, sPassword = sPassword, sDirectory = os.path.join(sScratch, 'foo\\bar\\baz'),2447 2351 [ tdTestDirCreate(sDirectory = os.path.join(sScratch, 'foo\\bar\\baz'), 2352 aFlags = [ vboxcon.DirectoryCreateFlag_Parents ] ), 2448 2353 tdTestResult(fRc = True) ], 2449 2354 # Long (+ random) stuff. 2450 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, 2451 sDirectory = os.path.join(sScratch, 2355 [ tdTestDirCreate(sDirectory = os.path.join(sScratch, 2452 2356 "".join(random.choice(string.ascii_lowercase) for i in range(32))) ), 2453 2357 tdTestResult(fRc = True) ], 2454 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, 2455 sDirectory = os.path.join(sScratch, 2358 [ tdTestDirCreate(sDirectory = os.path.join(sScratch, 2456 2359 "".join(random.choice(string.ascii_lowercase) for i in range(128))) ), 2457 2360 tdTestResult(fRc = True) ], 2458 2361 # Following two should fail on Windows (paths too long). Both should timeout. 2459 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, 2460 sDirectory = os.path.join(sScratch, 2362 [ tdTestDirCreate(sDirectory = os.path.join(sScratch, 2461 2363 "".join(random.choice(string.ascii_lowercase) for i in range(255))) ), 2462 2364 tdTestResult(fRc = not oTestVm.isWindows()) ], 2463 [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, 2464 sDirectory = os.path.join(sScratch, 2465 "".join(random.choice(string.ascii_lowercase) for i in range(255))) 2466 ), 2365 [ tdTestDirCreate(sDirectory = os.path.join(sScratch, 2366 "".join(random.choice(string.ascii_lowercase) for i in range(255))) ), 2467 2367 tdTestResult(fRc = not oTestVm.isWindows()) ] 2468 2368 ]); … … 2492 2392 """ 2493 2393 2494 if oTestVm.isWindows():2495 sUser = "Administrator";2496 else:2497 sUser = "vbox";2498 sPassword = "password";2499 2500 2394 aaTests = []; 2501 2395 if oTestVm.isWindows(): 2502 2396 aaTests.extend([ 2503 2397 # Invalid stuff. 2504 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sDirectory = ''), 2505 tdTestResult(fRc = False) ], 2506 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sDirectory = 'C:\\Windows', 2507 fMode = 1234), 2508 tdTestResult(fRc = False) ], 2509 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = '', 2510 sDirectory = 'C:\\Windows', fMode = 1234), 2511 tdTestResult(fRc = False) ], 2512 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'xXx', 2513 sDirectory = 'C:\\Windows', fMode = 0o700), 2514 tdTestResult(fRc = False) ], 2515 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'xxx', 2516 sDirectory = 'C:\\Windows', fMode = 0o700), 2517 tdTestResult(fRc = False) ], 2398 [ tdTestDirCreateTemp(sDirectory = ''), tdTestResult() ], 2399 [ tdTestDirCreateTemp(sDirectory = 'C:\\Windows', fMode = 1234), tdTestResult() ], 2400 [ tdTestDirCreateTemp(sTemplate = '', sDirectory = 'C:\\Windows', fMode = 1234), tdTestResult() ], 2401 [ tdTestDirCreateTemp(sTemplate = 'xXx', sDirectory = 'C:\\Windows', fMode = 0o700), tdTestResult() ], 2402 [ tdTestDirCreateTemp(sTemplate = 'xxx', sDirectory = 'C:\\Windows', fMode = 0o700), tdTestResult() ], 2518 2403 # More unusual stuff. 2519 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'foo', 2520 sDirectory = 'z:\\'), 2521 tdTestResult(fRc = False) ], 2522 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'foo', 2523 sDirectory = '\\\\uncrulez\\foo'), 2524 tdTestResult(fRc = False) ], 2404 [ tdTestDirCreateTemp(sTemplate = 'foo', sDirectory = 'z:\\'), tdTestResult() ], 2405 [ tdTestDirCreateTemp(sTemplate = 'foo', sDirectory = '\\\\uncrulez\\foo'), tdTestResult() ], 2525 2406 # Non-existing stuff. 2526 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'bar', 2527 sDirectory = 'c:\\Apps\\nonexisting\\foo'), 2528 tdTestResult(fRc = False) ], 2407 [ tdTestDirCreateTemp(sTemplate = 'bar', sDirectory = 'c:\\Apps\\nonexisting\\foo'), tdTestResult() ], 2529 2408 # FIXME: Failing test. Non Windows path 2530 # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'bar', 2531 # sDirectory = '/tmp/non/existing'), 2532 # tdTestResult(fRc = False) ] 2409 # [ tdTestDirCreateTemp(sTemplate = 'bar', sDirectory = '/tmp/non/existing'), tdTestResult() ] 2533 2410 ]); 2534 2411 elif oTestVm.isLinux(): 2535 2412 aaTests.extend([ 2536 2413 # Invalid stuff. 2537 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sDirectory = ''), 2538 tdTestResult(fRc = False) ], 2539 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sDirectory = '/etc', 2540 fMode = 1234), 2541 tdTestResult(fRc = False) ], 2542 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = '', 2543 sDirectory = '/etc', fMode = 1234), 2544 tdTestResult(fRc = False) ], 2545 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'xXx', 2546 sDirectory = '/etc', fMode = 0o700), 2547 tdTestResult(fRc = False) ], 2548 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'xxx', 2549 sDirectory = '/etc', fMode = 0o700), 2550 tdTestResult(fRc = False) ], 2414 [ tdTestDirCreateTemp(sDirectory = ''), tdTestResult() ], 2415 [ tdTestDirCreateTemp(sDirectory = '/etc', fMode = 1234) ], 2416 [ tdTestDirCreateTemp(sTemplate = '', sDirectory = '/etc', fMode = 1234), tdTestResult() ], 2417 [ tdTestDirCreateTemp(sTemplate = 'xXx', sDirectory = '/etc', fMode = 0o700), tdTestResult() ], 2418 [ tdTestDirCreateTemp(sTemplate = 'xxx', sDirectory = '/etc', fMode = 0o700), tdTestResult() ], 2551 2419 # More unusual stuff. 2552 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'foo', 2553 sDirectory = 'z:\\'), 2554 tdTestResult(fRc = False) ], 2555 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'foo', 2556 sDirectory = '\\\\uncrulez\\foo'), 2557 tdTestResult(fRc = False) ], 2420 [ tdTestDirCreateTemp(sTemplate = 'foo', sDirectory = 'z:\\'), tdTestResult() ], 2421 [ tdTestDirCreateTemp(sTemplate = 'foo', sDirectory = '\\\\uncrulez\\foo'), tdTestResult() ], 2558 2422 # Non-existing stuff. 2559 [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'bar', 2560 sDirectory = '/non/existing'), 2561 tdTestResult(fRc = False) ] 2423 [ tdTestDirCreateTemp(sTemplate = 'bar', sDirectory = '/non/existing'), tdTestResult() ], 2562 2424 ]); 2563 2425 … … 2565 2427 # aaTests.extend([ 2566 2428 # Non-secure variants. 2567 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2429 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2568 2430 # sDirectory = sScratch), 2569 2431 # tdTestResult(fRc = True) ], 2570 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2432 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2571 2433 # sDirectory = sScratch), 2572 2434 # tdTestResult(fRc = True) ], 2573 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'X',2435 # [ tdTestDirCreateTemp(sTemplate = 'X', 2574 2436 # sDirectory = sScratch), 2575 2437 # tdTestResult(fRc = True) ], 2576 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'X',2438 # [ tdTestDirCreateTemp(sTemplate = 'X', 2577 2439 # sDirectory = sScratch), 2578 2440 # tdTestResult(fRc = True) ], 2579 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2441 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2580 2442 # sDirectory = sScratch, 2581 2443 # fMode = 0o700), 2582 2444 # tdTestResult(fRc = True) ], 2583 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2445 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2584 2446 # sDirectory = sScratch, 2585 2447 # fMode = 0o700), 2586 2448 # tdTestResult(fRc = True) ], 2587 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2449 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2588 2450 # sDirectory = sScratch, 2589 2451 # fMode = 0o755), 2590 2452 # tdTestResult(fRc = True) ], 2591 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2453 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2592 2454 # sDirectory = sScratch, 2593 2455 # fMode = 0o755), 2594 2456 # tdTestResult(fRc = True) ], 2595 2457 # Secure variants. 2596 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2458 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2597 2459 # sDirectory = sScratch, fSecure = True), 2598 2460 # tdTestResult(fRc = True) ], 2599 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2461 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2600 2462 # sDirectory = sScratch, fSecure = True), 2601 2463 # tdTestResult(fRc = True) ], 2602 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2464 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2603 2465 # sDirectory = sScratch, fSecure = True), 2604 2466 # tdTestResult(fRc = True) ], 2605 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2467 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2606 2468 # sDirectory = sScratch, fSecure = True), 2607 2469 # tdTestResult(fRc = True) ], 2608 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2470 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2609 2471 # sDirectory = sScratch, 2610 2472 # fSecure = True, fMode = 0o700), 2611 2473 # tdTestResult(fRc = True) ], 2612 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2474 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2613 2475 # sDirectory = sScratch, 2614 2476 # fSecure = True, fMode = 0o700), 2615 2477 # tdTestResult(fRc = True) ], 2616 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2478 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2617 2479 # sDirectory = sScratch, 2618 2480 # fSecure = True, fMode = 0o755), 2619 2481 # tdTestResult(fRc = True) ], 2620 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = 'XXX',2482 # [ tdTestDirCreateTemp(sTemplate = 'XXX', 2621 2483 # sDirectory = sScratch, 2622 2484 # fSecure = True, fMode = 0o755), 2623 2485 # tdTestResult(fRc = True) ], 2624 2486 # Random stuff. 2625 # [ tdTestDirCreateTemp( sUser = sUser, sPassword = sPassword,2487 # [ tdTestDirCreateTemp( 2626 2488 # sTemplate = "XXX-".join(random.choice(string.ascii_lowercase) for i in range(32)), 2627 2489 # sDirectory = sScratch, 2628 2490 # fSecure = True, fMode = 0o755), 2629 2491 # tdTestResult(fRc = True) ], 2630 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = "".join('X' for i in range(32)),2492 # [ tdTestDirCreateTemp(sTemplate = "".join('X' for i in range(32)), 2631 2493 # sDirectory = sScratch, 2632 2494 # fSecure = True, fMode = 0o755), 2633 2495 # tdTestResult(fRc = True) ], 2634 # [ tdTestDirCreateTemp(s User = sUser, sPassword = sPassword, sTemplate = "".join('X' for i in range(128)),2496 # [ tdTestDirCreateTemp(sTemplate = "".join('X' for i in range(128)), 2635 2497 # sDirectory = sScratch, 2636 2498 # fSecure = True, fMode = 0o755), … … 2678 2540 """ 2679 2541 2680 if oTestVm.isWindows():2681 sUser = "Administrator";2682 else:2683 sUser = "vbox";2684 sPassword = "password";2685 2686 2542 aaTests = []; 2687 2543 if oTestVm.isWindows(): 2688 2544 aaTests.extend([ 2689 2545 # Invalid stuff. 2690 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = ''), 2691 tdTestResultDirRead(fRc = False) ], 2692 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'C:\\Windows', aFlags = [ 1234 ]), 2693 tdTestResultDirRead(fRc = False) ], 2694 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'C:\\Windows', sFilter = '*.foo'), 2695 tdTestResultDirRead(fRc = False) ], 2546 [ tdTestDirRead(sDirectory = ''), tdTestResultDirRead(fRc = False) ], 2547 [ tdTestDirRead(sDirectory = 'C:\\Windows', aFlags = [ 1234 ]), tdTestResultDirRead() ], 2548 [ tdTestDirRead(sDirectory = 'C:\\Windows', sFilter = '*.foo'), tdTestResultDirRead() ], 2696 2549 # More unusual stuff. 2697 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'z:\\'), 2698 tdTestResultDirRead(fRc = False) ], 2699 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '\\\\uncrulez\\foo'), 2700 tdTestResultDirRead(fRc = False) ], 2550 [ tdTestDirRead(sDirectory = 'z:\\'), tdTestResultDirRead() ], 2551 [ tdTestDirRead(sDirectory = '\\\\uncrulez\\foo'), tdTestResultDirRead() ], 2701 2552 # Non-existing stuff. 2702 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'c:\\Apps\\nonexisting'), 2703 tdTestResultDirRead(fRc = False) ], 2704 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'c:\\Apps\\testDirRead'), 2705 tdTestResultDirRead(fRc = False) ] 2553 [ tdTestDirRead(sDirectory = 'c:\\Apps\\nonexisting'), tdTestResultDirRead() ], 2554 [ tdTestDirRead(sDirectory = 'c:\\Apps\\testDirRead'), tdTestResultDirRead() ] 2706 2555 ]); 2707 2556 … … 2709 2558 aaTests.extend([ 2710 2559 # Reading directories. 2711 [ tdTestDirRead(s User = sUser, sPassword = sPassword, sDirectory = '../../Windows/Media'),2560 [ tdTestDirRead(sDirectory = '../../Windows/Media'), 2712 2561 tdTestResultDirRead(fRc = True, numFiles = 38) ], 2713 [ tdTestDirRead(s User = sUser, sPassword = sPassword, sDirectory = 'c:\\Windows\\Help'),2562 [ tdTestDirRead(sDirectory = 'c:\\Windows\\Help'), 2714 2563 tdTestResultDirRead(fRc = True, numDirs = 13, numFiles = 574) ], 2715 [ tdTestDirRead(s User = sUser, sPassword = sPassword, sDirectory = 'c:\\Windows\\Web'),2564 [ tdTestDirRead(sDirectory = 'c:\\Windows\\Web'), 2716 2565 tdTestResultDirRead(fRc = True, numDirs = 3, numFiles = 49) ] 2717 2566 ]); … … 2719 2568 aaTests.extend([ 2720 2569 # Invalid stuff. 2721 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = ''), 2722 tdTestResultDirRead(fRc = False) ], 2723 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '/etc', aFlags = [ 1234 ]), 2724 tdTestResultDirRead(fRc = False) ], 2725 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '/etc', sFilter = '*.foo'), 2726 tdTestResultDirRead(fRc = False) ], 2570 [ tdTestDirRead(sDirectory = ''), tdTestResultDirRead() ], 2571 [ tdTestDirRead(sDirectory = '/etc', aFlags = [ 1234 ]), tdTestResultDirRead() ], 2572 [ tdTestDirRead(sDirectory = '/etc', sFilter = '*.foo'), tdTestResultDirRead() ], 2727 2573 # More unusual stuff. 2728 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'z:/'), 2729 tdTestResultDirRead(fRc = False) ], 2730 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '\\\\uncrulez\\foo'), 2731 tdTestResultDirRead(fRc = False) ], 2574 [ tdTestDirRead(sDirectory = 'z:/'), tdTestResultDirRead() ], 2575 [ tdTestDirRead(sDirectory = '\\\\uncrulez\\foo'), tdTestResultDirRead() ], 2732 2576 # Non-existing stuff. 2733 [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '/etc/non/existing'), 2734 tdTestResultDirRead(fRc = False) ] 2577 [ tdTestDirRead(sDirectory = '/etc/non/existing'), tdTestResultDirRead() ] 2735 2578 ]); 2736 2579 … … 2768 2611 2769 2612 if oTestVm.isWindows(): 2770 sUser = "Administrator";2771 2613 sFileToDelete = "c:\\Windows\\Media\\chord.wav"; 2772 2614 else: 2773 sUser = "vbox";2774 2615 sFileToDelete = "/home/vbox/.profile"; 2775 sPassword = "password";2776 2616 2777 2617 aaTests = []; … … 2779 2619 aaTests.extend([ 2780 2620 # Invalid stuff. 2781 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = ''), 2782 tdTestResult(fRc = False) ], 2783 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows'), 2784 tdTestResult(fRc = False) ], 2621 [ tdTestFileRemove(sFile = ''), tdTestResult() ], 2622 [ tdTestFileRemove(sFile = 'C:\\Windows'), tdTestResult() ], 2785 2623 # More unusual stuff. 2786 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'z:\\'), 2787 tdTestResult(fRc = False) ], 2788 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\foo'), 2789 tdTestResult(fRc = False) ], 2624 [ tdTestFileRemove(sFile = 'z:\\'), tdTestResult() ], 2625 [ tdTestFileRemove(sFile = '\\\\uncrulez\\foo'), tdTestResult() ], 2790 2626 # Non-existing stuff. 2791 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Apps\\nonexisting'), 2792 tdTestResult(fRc = False) ], 2627 [ tdTestFileRemove(sFile = 'c:\\Apps\\nonexisting'), tdTestResult() ], 2793 2628 # Try to delete system files. 2794 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\pagefile.sys'), 2795 tdTestResult(fRc = False) ], 2796 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\kernel32.sys'), 2797 tdTestResult(fRc = False) ] 2629 [ tdTestFileRemove(sFile = 'c:\\pagefile.sys'), tdTestResult() ], 2630 [ tdTestFileRemove(sFile = 'c:\\Windows\\kernel32.sys'), tdTestResult() ] 2798 2631 ]); 2799 2632 … … 2801 2634 aaTests.extend([ 2802 2635 # Try delete some unimportant media stuff. 2803 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Media\\chimes.wav'), 2804 tdTestResult(fRc = True) ], 2636 [ tdTestFileRemove(sFile = 'c:\\Windows\\Media\\chimes.wav'), tdTestResult(fRc = True) ], 2805 2637 # Second attempt should fail. 2806 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Media\\chimes.wav'), 2807 tdTestResult(fRc = False) ] 2638 [ tdTestFileRemove(sFile = 'c:\\Windows\\Media\\chimes.wav'), tdTestResult() ] 2808 2639 ]); 2809 2640 elif oTestVm.isLinux(): 2810 2641 aaTests.extend([ 2811 2642 # Invalid stuff. 2812 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = ''), 2813 tdTestResult(fRc = False) ], 2814 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows'), 2815 tdTestResult(fRc = False) ], 2643 [ tdTestFileRemove(sFile = ''), tdTestResult() ], 2644 [ tdTestFileRemove(sFile = 'C:\\Windows'), tdTestResult() ], 2816 2645 # More unusual stuff. 2817 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'z:/'), 2818 tdTestResult(fRc = False) ], 2819 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = '//uncrulez/foo'), 2820 tdTestResult(fRc = False) ], 2646 [ tdTestFileRemove(sFile = 'z:/'), tdTestResult() ], 2647 [ tdTestFileRemove(sFile = '//uncrulez/foo'), tdTestResult() ], 2821 2648 # Non-existing stuff. 2822 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = '/non/existing'), 2823 tdTestResult(fRc = False) ], 2649 [ tdTestFileRemove(sFile = '/non/existing'), tdTestResult() ], 2824 2650 # Try to delete system files. 2825 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = '/etc'), 2826 tdTestResult(fRc = False) ], 2827 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = '/bin/sh'), 2828 tdTestResult(fRc = False) ] 2651 [ tdTestFileRemove(sFile = '/etc'), tdTestResult() ], 2652 [ tdTestFileRemove(sFile = '/bin/sh'), tdTestResult() ] 2829 2653 ]); 2830 2654 2831 2655 aaTests.extend([ 2832 2656 # Try delete some unimportant stuff. 2833 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = sFileToDelete), 2834 tdTestResult(fRc = True) ], 2657 [ tdTestFileRemove(sFile = sFileToDelete), tdTestResult(fRc = True) ], 2835 2658 # Second attempt should fail. 2836 [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = sFileToDelete), 2837 tdTestResult(fRc = False) ] 2659 [ tdTestFileRemove(sFile = sFileToDelete), tdTestResult() ] 2838 2660 ]); 2839 2661 … … 2953 2775 """ 2954 2776 2955 if oTestVm.isWindows():2956 sUser = "Administrator";2957 else:2958 sUser = "vbox";2959 sPassword = "password";2960 2961 2777 if oTxsSession.syncMkDir('${SCRATCH}/testGuestCtrlFileRead') is False: 2962 2778 reporter.error('Could not create scratch directory on guest'); … … 2966 2782 aaTests.extend([ 2967 2783 # Invalid stuff. 2968 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, cbToReadWrite = 0), 2969 tdTestResultFileReadWrite(fRc = False) ], 2970 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = ''), 2971 tdTestResultFileReadWrite(fRc = False) ], 2972 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file'), 2973 tdTestResultFileReadWrite(fRc = False) ], 2784 [ tdTestFileReadWrite(cbToReadWrite = 0), tdTestResultFileReadWrite() ], 2785 [ tdTestFileReadWrite(sFile = ''), tdTestResultFileReadWrite() ], 2786 [ tdTestFileReadWrite(sFile = 'non-existing.file'), tdTestResultFileReadWrite() ], 2974 2787 # Wrong open mode. 2975 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file', \ 2976 sOpenMode = 'rt', sDisposition = 'oe'), 2977 tdTestResultFileReadWrite(fRc = False) ], 2978 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\non-existing.file', \ 2979 sOpenMode = 'tr', sDisposition = 'oe'), 2980 tdTestResultFileReadWrite(fRc = False) ], 2981 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '../../non-existing.file', \ 2982 sOpenMode = 'wr', sDisposition = 'oe'), 2983 tdTestResultFileReadWrite(fRc = False) ], 2788 [ tdTestFileReadWrite(sFile = 'non-existing.file', sOpenMode = 'rt', sDisposition = 'oe'), 2789 tdTestResultFileReadWrite() ], 2790 [ tdTestFileReadWrite(sFile = '\\\\uncrulez\\non-existing.file', sOpenMode = 'tr', sDisposition = 'oe'), 2791 tdTestResultFileReadWrite() ], 2792 [ tdTestFileReadWrite(sFile = '../../non-existing.file', sOpenMode = 'wr', sDisposition = 'oe'), 2793 tdTestResultFileReadWrite() ], 2984 2794 # Wrong disposition. 2985 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file', \ 2986 sOpenMode = 'r', sDisposition = 'e'), 2987 tdTestResultFileReadWrite(fRc = False) ], 2988 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\non-existing.file', \ 2989 sOpenMode = 'r', sDisposition = 'o'), 2990 tdTestResultFileReadWrite(fRc = False) ], 2991 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '../../non-existing.file', \ 2992 sOpenMode = 'r', sDisposition = 'c'), 2993 tdTestResultFileReadWrite(fRc = False) ], 2795 [ tdTestFileReadWrite(sFile = 'non-existing.file', sOpenMode = 'r', sDisposition = 'e'), 2796 tdTestResultFileReadWrite() ], 2797 [ tdTestFileReadWrite(sFile = '\\\\uncrulez\\non-existing.file', sOpenMode = 'r', sDisposition = 'o'), 2798 tdTestResultFileReadWrite() ], 2799 [ tdTestFileReadWrite(sFile = '../../non-existing.file', sOpenMode = 'r', sDisposition = 'c'), 2800 tdTestResultFileReadWrite() ], 2994 2801 # Opening non-existing file when it should exist. 2995 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file', \ 2996 sOpenMode = 'r', sDisposition = 'oe'), 2997 tdTestResultFileReadWrite(fRc = False) ], 2998 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\non-existing.file', \ 2999 sOpenMode = 'r', sDisposition = 'oe'), 3000 tdTestResultFileReadWrite(fRc = False) ], 3001 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '../../non-existing.file', \ 3002 sOpenMode = 'r', sDisposition = 'oe'), 3003 tdTestResultFileReadWrite(fRc = False) ] 2802 [ tdTestFileReadWrite(sFile = 'non-existing.file', sOpenMode = 'r', sDisposition = 'oe'), 2803 tdTestResultFileReadWrite() ], 2804 [ tdTestFileReadWrite(sFile = '\\\\uncrulez\\non-existing.file', sOpenMode = 'r', sDisposition = 'oe'), 2805 tdTestResultFileReadWrite() ], 2806 [ tdTestFileReadWrite(sFile = '../../non-existing.file', sOpenMode = 'r', sDisposition = 'oe'), 2807 tdTestResultFileReadWrite() ] 3004 2808 ]); 3005 2809 … … 3007 2811 aaTests.extend([ 3008 2812 # Create a file which must not exist (but it hopefully does). 3009 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\calc.exe', \ 3010 sOpenMode = 'w', sDisposition = 'ce'), 3011 tdTestResultFileReadWrite(fRc = False) ], 2813 [ tdTestFileReadWrite(sFile = 'C:\\Windows\\System32\\calc.exe', sOpenMode = 'w', sDisposition = 'ce'), 2814 tdTestResultFileReadWrite() ], 3012 2815 # Open a file which must exist. 3013 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\kernel32.dll', \ 3014 sOpenMode = 'r', sDisposition = 'oe'), 2816 [ tdTestFileReadWrite(sFile = 'C:\\Windows\\System32\\kernel32.dll', sOpenMode = 'r', sDisposition = 'oe'), 3015 2817 tdTestResultFileReadWrite(fRc = True) ], 3016 2818 # Try truncating a file which already is opened with a different sharing mode (and thus should fail). 3017 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\kernel32.dll', \ 3018 sOpenMode = 'w', sDisposition = 'ot'), 3019 tdTestResultFileReadWrite(fRc = False) ] 2819 [ tdTestFileReadWrite(sFile = 'C:\\Windows\\System32\\kernel32.dll', sOpenMode = 'w', sDisposition = 'ot'), 2820 tdTestResultFileReadWrite() ] 3020 2821 ]); 3021 2822 … … 3024 2825 aaTests.extend([ 3025 2826 # Reading from beginning. 3026 [ tdTestFileReadWrite(s User = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\eula.txt',2827 [ tdTestFileReadWrite(sFile = 'C:\\Windows\\System32\\eula.txt', 3027 2828 sOpenMode = 'r', sDisposition = 'oe', cbToReadWrite = 33), 3028 2829 tdTestResultFileReadWrite(fRc = True, aBuf = 'Microsoft(r) Windows(r) XP Profes', 3029 2830 cbProcessed = 33, cbOffset = 33) ], 3030 2831 # Reading from offset. 3031 [ tdTestFileReadWrite(s User = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\eula.txt',2832 [ tdTestFileReadWrite(sFile = 'C:\\Windows\\System32\\eula.txt', 3032 2833 sOpenMode = 'r', sDisposition = 'oe', cbOffset = 17769, cbToReadWrite = 31), 3033 2834 tdTestResultFileReadWrite(fRc = True, aBuf = 'only with the HARDWARE. If\x0d\x0a ', … … 3037 2838 aaTests.extend([ 3038 2839 # Create a file which must not exist (but it hopefully does). 3039 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '/etc/issue', \ 3040 sOpenMode = 'w', sDisposition = 'ce'), 3041 tdTestResultFileReadWrite(fRc = False) ], 2840 [ tdTestFileReadWrite(sFile = '/etc/issue', sOpenMode = 'w', sDisposition = 'ce'), 2841 tdTestResultFileReadWrite() ], 3042 2842 # Open a file which must exist. 3043 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '/etc/issue', \ 3044 sOpenMode = 'r', sDisposition = 'oe'), 2843 [ tdTestFileReadWrite(sFile = '/etc/issue', sOpenMode = 'r', sDisposition = 'oe'), 3045 2844 tdTestResultFileReadWrite(fRc = True) ], 3046 2845 # Try truncating a file which already is opened with a different sharing mode (and thus should fail). 3047 [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '/etc/issue', \ 3048 sOpenMode = 'w', sDisposition = 'ot'), 3049 tdTestResultFileReadWrite(fRc = False) ] 2846 [ tdTestFileReadWrite(sFile = '/etc/issue', sOpenMode = 'w', sDisposition = 'ot'), 2847 tdTestResultFileReadWrite() ] 3050 2848 ]); 3051 2849 … … 3130 2928 3131 2929 if oTestVm.isWindows(): 3132 sUser = "Administrator";3133 else:3134 sUser = "vbox";3135 sPassword = "password";3136 3137 if oTestVm.isWindows():3138 2930 sScratch = "C:\\Temp\\vboxtest\\testGuestCtrlFileWrite\\"; 3139 2931 else: … … 3150 2942 aaTests.extend([ 3151 2943 # Write to a non-existing file. 3152 [ tdTestFileReadWrite(s User = sUser, sPassword = sPassword, sFile = sScratch + 'testGuestCtrlFileWrite.txt',2944 [ tdTestFileReadWrite(sFile = sScratch + 'testGuestCtrlFileWrite.txt', 3153 2945 sOpenMode = 'w+', sDisposition = 'ce', cbToReadWrite = cScratchBuf, 3154 2946 aBuf = aScratchBuf), … … 3160 2952 aaTests.extend([ 3161 2953 # Append the same amount of data to the just created file. 3162 [ tdTestFileReadWrite(s User = sUser, sPassword = sPassword, sFile = sScratch + 'testGuestCtrlFileWrite.txt',2954 [ tdTestFileReadWrite(sFile = sScratch + 'testGuestCtrlFileWrite.txt', 3163 2955 sOpenMode = 'w+', sDisposition = 'oa', cbToReadWrite = cScratchBuf, 3164 2956 cbOffset = cScratchBuf, aBuf = aScratchBuf2), … … 3280 3072 3281 3073 if oTestVm.isWindows(): 3282 sUser = "Administrator";3283 3074 sScratchGst = "C:\\Temp\\vboxtest\\testGuestCtrlCopyTo\\"; 3284 3075 sScratchGstNotExist = "C:\\does-not-exist\\"; 3285 3076 sScratchGstInvalid = "?*|invalid-name?*|"; 3286 3077 else: 3287 sUser = "vbox";3288 3078 sScratchGst = "/tmp/"; ## @todo Use "${SCRATCH}/testGuestCtrlCopyTo" as soon as TXS CHMOD is implemented. 3289 3079 sScratchGstNotExist = "/tmp/does-not-exist/"; 3290 3080 sScratchGstInvalid = "/"; 3291 sPassword = "password";3292 3081 3293 3082 if oTxsSession.syncMkDir('${SCRATCH}/testGuestCtrlCopyTo') is False: … … 3312 3101 aaTests.extend([ 3313 3102 # Destination missing. 3314 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = ''), 3315 tdTestResult(fRc = False) ], 3316 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = '/placeholder', 3317 aFlags = [ 80 ] ), 3318 tdTestResult(fRc = False) ], 3103 [ tdTestCopyTo(sSrc = ''), tdTestResult() ], 3104 [ tdTestCopyTo(sSrc = '/placeholder', aFlags = [ 80 ] ), tdTestResult() ], 3319 3105 # Source missing. 3320 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sDst = ''), 3321 tdTestResult(fRc = False) ], 3322 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sDst = '/placeholder', 3323 aFlags = [ 80 ] ), 3324 tdTestResult(fRc = False) ], 3106 [ tdTestCopyTo(sDst = ''), tdTestResult() ], 3107 [ tdTestCopyTo(sDst = '/placeholder', aFlags = [ 80 ] ), tdTestResult() ], 3325 3108 # Testing DirectoryCopyFlag flags. 3326 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3327 sDst = sScratchGstInvalid, aFlags = [ 80 ] ), 3328 tdTestResult(fRc = False) ], 3109 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstInvalid, aFlags = [ 80 ] ), tdTestResult() ], 3329 3110 # Testing FileCopyFlag flags. 3330 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3331 sDst = sScratchGstInvalid, aFlags = [ 80 ] ), 3332 tdTestResult(fRc = False) ], 3111 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstInvalid, aFlags = [ 80 ] ), tdTestResult() ], 3333 3112 # Nothing to copy (source and/or destination is empty). 3334 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'z:\\'), 3335 tdTestResult(fRc = False) ], 3336 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = '\\\\uncrulez\\foo'), 3337 tdTestResult(fRc = False) ], 3338 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist', 3339 sDst = os.path.join(sScratchGst, 'non-exist.dll')), 3340 tdTestResult(fRc = False) ] 3113 [ tdTestCopyTo(sSrc = 'z:\\'), tdTestResult() ], 3114 [ tdTestCopyTo(sSrc = '\\\\uncrulez\\foo'), tdTestResult() ], 3115 [ tdTestCopyTo(sSrc = 'non-exist', sDst = os.path.join(sScratchGst, 'non-exist.dll')), tdTestResult() ] 3341 3116 ]); 3342 3117 … … 3346 3121 if self.oTstDrv.fpApiVer > 5.2: 3347 3122 aaTests.extend([ 3348 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3349 sDst = sScratchGstInvalid), 3350 tdTestResult(fRc = False) ], 3351 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3352 sDst = sScratchGstNotExist), 3353 tdTestResult(fRc = False) ], 3354 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3355 sDst = sScratchGstNotExist), 3356 tdTestResult(fRc = False) ], 3357 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3358 sDst = os.path.join(sScratchGstNotExist, 'renamedfile.dll')), 3359 tdTestResult(fRc = False) ], 3360 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3361 sDst = os.path.join(sScratchGst, 'HostGABig.dat')), 3123 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstInvalid), tdTestResult() ], 3124 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstNotExist), tdTestResult() ], 3125 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGstNotExist), tdTestResult() ], 3126 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGstNotExist, 'renamedfile.dll')), 3127 tdTestResult() ], 3128 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGst, 'HostGABig.dat')), 3362 3129 tdTestResult(fRc = True) ], 3363 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3364 sDst = os.path.join(sScratchGst, 'HostGABig.dat')), 3130 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGst, 'HostGABig.dat')), 3365 3131 tdTestResult(fRc = True) ], 3366 3132 # Note: Copying files into directories via Main is supported only in versions > 5.2. 3367 3133 # Destination is a directory. 3368 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3369 sDst = sScratchGst), 3134 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGst), 3370 3135 tdTestResult(fRc = True) ], 3371 3136 # Copy over file again into same directory (overwrite). 3372 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3373 sDst = sScratchGst), 3137 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = sScratchGst), 3374 3138 tdTestResult(fRc = True) ] 3375 3139 ]); … … 3379 3143 # Copy the same file over to the guest, but this time store the file into the former 3380 3144 # file's ADS (Alternate Data Stream). Only works on Windows, of course. 3381 [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sTestFileBig, 3382 sDst = os.path.join(sScratchGst, 'HostGABig.dat:ADS-Test')), 3145 [ tdTestCopyTo(sSrc = sTestFileBig, sDst = os.path.join(sScratchGst, 'HostGABig.dat:ADS-Test')), 3383 3146 tdTestResult(fRc = True) ] 3384 3147 ]); … … 3396 3159 ## additionally it's not really clear if this fails reliably on all Windows versions, even 3397 3160 ## the old ones like XP with a "proper" administrator. 3398 #[ tdTestCopyTo(s User = sUser, sPassword = sPassword, sSrc = os.path.join(sSystemRoot, 'security'),3161 #[ tdTestCopyTo(sSrc = os.path.join(sSystemRoot, 'security'), 3399 3162 # sDst = sScratchGst, aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3400 # tdTestResult(fRc = False) ],3163 # 3401 3164 # Copying directories with regular files. 3402 [ tdTestCopyTo(s User = sUser, sPassword = sPassword, sSrc = os.path.join(sSystemRoot, 'Help'),3165 [ tdTestCopyTo(sSrc = os.path.join(sSystemRoot, 'Help'), 3403 3166 sDst = sScratchGst, aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3404 3167 tdTestResult(fRc = True) ] … … 3457 3220 3458 3221 if oTestVm.isWindows(): 3459 sUser = "Administrator";3460 3222 sPathSep = "\\"; 3461 3223 sSrcDirExisting = "C:\\Windows\\Web"; 3462 3224 sSrcFileExisting = "C:\\Windows\\system32\\ole32.dll"; 3463 3225 else: 3464 sUser = "vbox";3465 3226 sPathSep = "/"; 3466 3227 sSrcDirExisting = "/bin"; 3467 3228 sSrcFileExisting = "/etc/issue"; 3468 sPassword = "password";3469 3229 3470 3230 sScratchHst = os.path.join(self.oTstDrv.sScratchPath, "testGctrlCopyFrom"); … … 3490 3250 aaTests.extend([ 3491 3251 # Destination missing. 3492 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = ''), 3493 tdTestResult(fRc = False) ], 3494 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'Something', 3495 aFlags = [ 80 ] ), 3496 tdTestResult(fRc = False) ], 3252 [ tdTestCopyFrom(sSrc = ''), tdTestResult() ], 3253 [ tdTestCopyFrom(sSrc = 'Something', aFlags = [ 80 ] ), tdTestResult() ], 3497 3254 # Source missing. 3498 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = ''), 3499 tdTestResult(fRc = False) ], 3500 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = 'Something', 3501 aFlags = [ 80 ] ), 3502 tdTestResult(fRc = False) ], 3255 [ tdTestCopyFrom(sDst = ''), tdTestResult() ], 3256 [ tdTestCopyFrom(sDst = 'Something', aFlags = [ 80 ] ), tdTestResult() ], 3503 3257 # Testing DirectoryCopyFlag flags. 3504 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcDirExisting, 3505 sDst = sScratchHstInvalid, aFlags = [ 80 ] ), 3506 tdTestResult(fRc = False) ], 3258 [ tdTestCopyFrom(sSrc = sSrcDirExisting, sDst = sScratchHstInvalid, aFlags = [ 80 ] ), tdTestResult() ], 3507 3259 # Testing FileCopyFlag flags. 3508 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3509 sDst = sScratchHstInvalid, aFlags = [ 80 ] ), 3510 tdTestResult(fRc = False) ], 3260 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = sScratchHstInvalid, aFlags = [ 80 ] ), tdTestResult() ], 3511 3261 # Nothing to copy (sDst is empty / unreachable). 3512 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'z:\\'), 3513 tdTestResult(fRc = False) ], 3514 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = '\\\\uncrulez\\foo'), 3515 tdTestResult(fRc = False) ], 3516 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist', 3517 sDst = os.path.join(sScratchHst, 'non-exist')), 3518 tdTestResult(fRc = False) ] 3262 [ tdTestCopyFrom(sSrc = 'z:\\'), tdTestResult() ], 3263 [ tdTestCopyFrom(sSrc = '\\\\uncrulez\\foo'), tdTestResult() ], 3264 [ tdTestCopyFrom(sSrc = 'non-exist', sDst = os.path.join(sScratchHst, 'non-exist')), tdTestResult() ] 3519 3265 ]); 3520 3266 … … 3526 3272 aaTests.extend([ 3527 3273 # Copying single files. 3528 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3529 sDst = sScratchHstInvalid), 3530 tdTestResult(fRc = False) ], 3531 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3532 sDst = os.path.join(sScratchHstInvalid, 'tstCopyFrom-renamedfile')), 3533 tdTestResult(fRc = False) ], 3274 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = sScratchHstInvalid), tdTestResult() ], 3275 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = os.path.join(sScratchHstInvalid, 'tstCopyFrom-renamedfile')), 3276 tdTestResult() ], 3534 3277 # Copy over file using a different destination name. 3535 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3536 sDst = os.path.join(sScratchHst, 'tstCopyFrom-renamedfile')), 3278 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = os.path.join(sScratchHst, 'tstCopyFrom-renamedfile')), 3537 3279 tdTestResult(fRc = True) ], 3538 3280 # Copy over same file (and overwrite existing one). 3539 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3540 sDst = os.path.join(sScratchHst, 'tstCopyFrom-renamedfile')), 3281 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = os.path.join(sScratchHst, 'tstCopyFrom-renamedfile')), 3541 3282 tdTestResult(fRc = True) ], 3542 3283 # Note: Copying files into directories via Main is supported only in versions > 5.2. 3543 3284 # Destination is a directory with a trailing slash (should work). 3544 3285 # See "cp" syntax. 3545 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3546 sDst = sScratchHst + "/"), 3286 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = sScratchHst + "/"), 3547 3287 tdTestResult(fRc = True) ], 3548 3288 # Destination is a directory (without a trailing slash, should also work). 3549 3289 # See "cp" syntax. 3550 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3551 sDst = sScratchHst), 3290 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = sScratchHst), 3552 3291 tdTestResult(fRc = True) ], 3553 3292 # Destination is a non-existing directory. 3554 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcFileExisting, 3555 sDst = sScratchHstNotExist), 3556 tdTestResult(fRc = False) ] 3293 [ tdTestCopyFrom(sSrc = sSrcFileExisting, sDst = sScratchHstNotExist), tdTestResult() ] 3557 3294 ]); 3558 3295 … … 3564 3301 aaTests.extend([ 3565 3302 # Copying entire directories (destination is "<sScratchHst>\Web"). 3566 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcDirExisting, 3567 sDst = sScratchHst), 3303 [ tdTestCopyFrom(sSrc = sSrcDirExisting, sDst = sScratchHst), 3568 3304 tdTestResult(fRc = True) ], 3569 3305 # Repeat -- this time it should fail, as the destination directory already exists (and 3570 3306 # DirectoryCopyFlag_CopyIntoExisting is not specified). 3571 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcDirExisting, 3572 sDst = sScratchHst), 3573 tdTestResult(fRc = False) ], 3307 [ tdTestCopyFrom(sSrc = sSrcDirExisting, sDst = sScratchHst), tdTestResult() ], 3574 3308 # Next try with the DirectoryCopyFlag_CopyIntoExisting flag being set. 3575 [ tdTestCopyFrom(s User = sUser, sPassword = sPassword, sSrc = sSrcDirExisting,3576 sDst = sScratchHst, aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]),3309 [ tdTestCopyFrom(sSrc = sSrcDirExisting, sDst = sScratchHst, 3310 aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ] ), 3577 3311 tdTestResult(fRc = True) ], 3578 3312 # Ditto, with trailing slash. 3579 [ tdTestCopyFrom(s User = sUser, sPassword = sPassword, sSrc = sSrcDirExisting,3313 [ tdTestCopyFrom(sSrc = sSrcDirExisting, 3580 3314 sDst = sScratchHst + "/", aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3581 3315 tdTestResult(fRc = True) ], 3582 3316 # Copying contents of directories into a non-existing directory chain on the host which fail. 3583 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcDirExisting + sPathSep, 3584 sDst = sScratchHstNotExistChain, 3585 aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3586 tdTestResult(fRc = False) ], 3317 [ tdTestCopyFrom(sSrc = sSrcDirExisting + sPathSep, sDst = sScratchHstNotExistChain, 3318 aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), tdTestResult() ], 3587 3319 # Copying contents of directories into a non-existing directory on the host, which should succeed. 3588 [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = sSrcDirExisting + sPathSep, 3589 sDst = sScratchHstNotExist, 3590 aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ]), 3320 [ tdTestCopyFrom(sSrc = sSrcDirExisting + sPathSep, sDst = sScratchHstNotExist, 3321 aFlags = [ vboxcon.DirectoryCopyFlag_CopyIntoExisting ] ), 3591 3322 tdTestResult(fRc = True) ] 3592 3323 ]); … … 3653 3384 """ 3654 3385 3655 if oTestVm.isWindows():3656 sUser = "Administrator";3657 else:3658 sUser = "vbox";3659 sPassword = "password";3660 3661 3386 # Some stupid trickery to guess the location of the iso. 3662 3387 sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso')); … … 3692 3417 aaTests.extend([ 3693 3418 # Source is missing. 3694 [ tdTestUpdateAdditions(s User = sUser, sPassword = sPassword, sSrc = ''),3695 tdTestResult(fRc = False) ], 3419 [ tdTestUpdateAdditions(sSrc = ''), tdTestResult() ], 3420 3696 3421 # Wrong aFlags. 3697 [ tdTestUpdateAdditions(s User = sUser, sPassword = sPassword, sSrc = self.oTstDrv.getGuestAdditionsIso(),3698 aFlags = [ 1234 ]), 3699 tdTestResult(fRc = False) ], 3422 [ tdTestUpdateAdditions(sSrc = self.oTstDrv.getGuestAdditionsIso(), 3423 aFlags = [ 1234 ]), tdTestResult() ], 3424 3700 3425 # Non-existing .ISO. 3701 [ tdTestUpdateAdditions(s User = sUser, sPassword = sPassword, sSrc = "non-existing.iso"),3702 tdTestResult(fRc = False) ], 3426 [ tdTestUpdateAdditions(sSrc = "non-existing.iso"), tdTestResult() ], 3427 3703 3428 # Wrong .ISO. 3704 [ tdTestUpdateAdditions(s User = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO),3705 tdTestResult(fRc = False) ], 3429 [ tdTestUpdateAdditions(sSrc = sVBoxValidationKitISO), tdTestResult() ], 3430 3706 3431 # The real thing. 3707 [ tdTestUpdateAdditions(s User = sUser, sPassword = sPassword, sSrc = self.oTstDrv.getGuestAdditionsIso()),3432 [ tdTestUpdateAdditions(sSrc = self.oTstDrv.getGuestAdditionsIso()), 3708 3433 tdTestResult(fRc = True) ], 3709 3434 # Test the (optional) installer arguments. This will extract the 3710 3435 # installer into our guest's scratch directory. 3711 [ tdTestUpdateAdditions(s User = sUser, sPassword = sPassword, sSrc = self.oTstDrv.getGuestAdditionsIso(),3436 [ tdTestUpdateAdditions(sSrc = self.oTstDrv.getGuestAdditionsIso(), 3712 3437 aArgs = [ '/extract', '/D=' + sScratch ]), 3713 3438 tdTestResult(fRc = True) ] 3714 3439 # Some debg ISO. Only enable locally. 3715 #[ tdTestUpdateAdditions( sUser = sUser, sPassword = sPassword,3440 #[ tdTestUpdateAdditions( 3716 3441 # sSrc = "V:\\Downloads\\VBoxGuestAdditions-r80354.iso"), 3717 3442 # tdTestResult(fRc = True) ]
Note:
See TracChangeset
for help on using the changeset viewer.