VirtualBox

Ignore:
Timestamp:
May 22, 2020 12:04:17 PM (5 years ago)
Author:
vboxsync
Message:

Validation Kit/testdriver: Moved more path handling code to the testdriver base class to unify path handling more.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testdriver/vbox.py

    r84413 r84454  
    25722572        return SessionWrapper(oSession, oVM, self.oVBox, self.oVBoxMgr, self, False);
    25732573
     2574    #
     2575    # Guest locations.
     2576    #
     2577
     2578    @staticmethod
     2579    def getGuestTempDir(oTestVm):
     2580        """
     2581        Helper for finding a temporary directory in the test VM.
     2582
     2583        Note! It may be necessary to create it!
     2584        """
     2585        if oTestVm.isWindows():
     2586            return "C:\\Temp";
     2587        if oTestVm.isOS2():
     2588            return "C:\\Temp";
     2589        return '/var/tmp';
     2590
     2591    @staticmethod
     2592    def getGuestSystemDir(oTestVm, sPathPrefix = ''):
     2593        """
     2594        Helper for finding a system directory in the test VM that we can play around with.
     2595        sPathPrefix can be used to specify other directories, such as /usr/local/bin/ or /usr/bin, for instance.
     2596
     2597        On Windows this is always the System32 directory, so this function can be used as
     2598        basis for locating other files in or under that directory.
     2599        """
     2600        if oTestVm.isWindows():
     2601            if oTestVm.sKind in ['WindowsNT4', 'WindowsNT3x',]:
     2602                return 'C:\\Winnt\\System32';
     2603            return 'C:\\Windows\\System32';
     2604        if oTestVm.isOS2():
     2605            return 'C:\\OS2\\DLL';
     2606        return sPathPrefix + "/bin";
     2607
     2608    @staticmethod
     2609    def getGuestSystemAdminDir(oTestVm, sPathPrefix = ''):
     2610        """
     2611        Helper for finding a system admin directory ("sbin") in the test VM that we can play around with.
     2612        sPathPrefix can be used to specify other directories, such as /usr/local/sbin/ or /usr/sbin, for instance.
     2613
     2614        On Windows this is always the System32 directory, so this function can be used as
     2615        basis for locating other files in or under that directory.
     2616        On UNIX-y systems this always is the "sh" shell to guarantee a common shell syntax.
     2617        """
     2618        if oTestVm.isWindows():
     2619            if oTestVm.sKind in ['WindowsNT4', 'WindowsNT3x',]:
     2620                return 'C:\\Winnt\\System32';
     2621            return 'C:\\Windows\\System32';
     2622        if oTestVm.isOS2():
     2623            return 'C:\\OS2\\DLL'; ## @todo r=andy Not sure here.
     2624        return sPathPrefix + "/sbin";
     2625
     2626    @staticmethod
     2627    def getGuestSystemShell(oTestVm):
     2628        """
     2629        Helper for finding the default system shell in the test VM.
     2630        """
     2631        if oTestVm.isWindows():
     2632            return TestDriver.getGuestSystemDir(oTestVm) + '\\cmd.exe';
     2633        if oTestVm.isOS2():
     2634            return TestDriver.getGuestSystemDir(oTestVm) + '\\..\\CMD.EXE';
     2635        return "/bin/sh";
     2636
     2637    @staticmethod
     2638    def getGuestSystemFileForReading(oTestVm):
     2639        """
     2640        Helper for finding a file in the test VM that we can read.
     2641        """
     2642        if oTestVm.isWindows():
     2643            return TestDriver.getGuestSystemDir(oTestVm) + '\\ntdll.dll';
     2644        if oTestVm.isOS2():
     2645            return TestDriver.getGuestSystemDir(oTestVm) + '\\DOSCALL1.DLL';
     2646        return "/bin/sh";
     2647
    25742648    def getVmByName(self, sName):
    25752649        """
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette