VirtualBox

Ignore:
Timestamp:
Jun 29, 2018 7:06:45 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
123273
Message:

tdAppliance1.py: Reverted nonsensical semicolon changes from r120609. If this happens again, commit privileges to ValKit will be revoked.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/api/tdAppliance1.py

    r70849 r72737  
    4343
    4444# Validation Kit imports.
    45 from testdriver import base
    46 from testdriver import reporter
    47 from testdriver import vboxwrappers
     45from testdriver import base;
     46from testdriver import reporter;
     47from testdriver import vboxwrappers;
    4848
    4949
     
    5454
    5555    def __init__(self, oTstDrv):
    56         base.SubTestDriverBase.__init__(self, 'appliance', oTstDrv)
     56        base.SubTestDriverBase.__init__(self, 'appliance', oTstDrv);
    5757
    5858    def testIt(self):
     
    6060        Execute the sub-testcase.
    6161        """
    62         fRc = True
     62        fRc = True;
    6363
    6464        # Import a set of simple OVAs.
     
    8888            'tdAppliance1-t7-bad-instance.ova',
    8989            ):
    90             reporter.testStart(sOva)
     90            reporter.testStart(sOva);
    9191            try:
    92                 fRc = self.testImportOva(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc
    93                 fRc = self.testImportOvaAsOvf(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc
     92                fRc = self.testImportOva(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc;
     93                fRc = self.testImportOvaAsOvf(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc;
    9494            except:
    95                 reporter.errorXcpt()
    96                 fRc = False
    97             fRc = reporter.testDone() and fRc
     95                reporter.errorXcpt();
     96                fRc = False;
     97            fRc = reporter.testDone() and fRc;
    9898
    9999        ## @todo more stuff
    100         return fRc
     100        return fRc;
    101101
    102102    #
     
    106106    def testImportOva(self, sOva):
    107107        """ xxx """
    108         oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
     108        oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox();
    109109
    110110        #
     
    112112        #
    113113        try:
    114             oAppliance = oVirtualBox.createAppliance()
    115         except:
    116             return reporter.errorXcpt('IVirtualBox::createAppliance failed')
     114            oAppliance = oVirtualBox.createAppliance();
     115        except:
     116            return reporter.errorXcpt('IVirtualBox::createAppliance failed');
    117117
    118118        try:
    119119            oProgress = vboxwrappers.ProgressWrapper(oAppliance.read(sOva), self.oTstDrv.oVBoxMgr, self.oTstDrv,
    120                                                      'read "%s"' % (sOva,))
    121         except:
    122             return reporter.errorXcpt('IAppliance::read("%s") failed' % (sOva,))
    123         oProgress.wait()
    124         if oProgress.logResult() is False:
    125             return False
    126 
    127         try:
    128             oAppliance.interpret()
    129         except:
    130             return reporter.errorXcpt('IAppliance::interpret() failed on "%s"' % (sOva,))
     120                                                     'read "%s"' % (sOva,));
     121        except:
     122            return reporter.errorXcpt('IAppliance::read("%s") failed' % (sOva,));
     123        oProgress.wait();
     124        if oProgress.logResult() is False:
     125            return False;
     126
     127        try:
     128            oAppliance.interpret();
     129        except:
     130            return reporter.errorXcpt('IAppliance::interpret() failed on "%s"' % (sOva,));
    131131
    132132        #
    133133        try:
    134134            oProgress = vboxwrappers.ProgressWrapper(oAppliance.importMachines([]),
    135                                                      self.oTstDrv.oVBoxMgr, self.oTstDrv, 'importMachines "%s"' % (sOva,))
    136         except:
    137             return reporter.errorXcpt('IAppliance::importMachines failed on "%s"' % (sOva,))
    138         oProgress.wait()
    139         if oProgress.logResult() is False:
    140             return False
     135                                                     self.oTstDrv.oVBoxMgr, self.oTstDrv, 'importMachines "%s"' % (sOva,));
     136        except:
     137            return reporter.errorXcpt('IAppliance::importMachines failed on "%s"' % (sOva,));
     138        oProgress.wait();
     139        if oProgress.logResult() is False:
     140            return False;
    141141
    142142        #
     
    145145        ## @todo do more with this OVA. Like untaring it and loading it as an OVF.  Export it and import it again.
    146146
    147         return True
     147        return True;
    148148
    149149    def testImportOvaAsOvf(self, sOva):
     
    151151        Unpacks the OVA into a subdirectory in the scratch area and imports it as an OVF.
    152152        """
    153         oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox()
    154 
    155         sTmpDir = os.path.join(self.oTstDrv.sScratchPath, os.path.split(sOva)[1] + '-ovf')
    156         sOvf    = os.path.join(sTmpDir, os.path.splitext(os.path.split(sOva)[1])[0] + '.ovf')
     153        oVirtualBox = self.oTstDrv.oVBoxMgr.getVirtualBox();
     154
     155        sTmpDir = os.path.join(self.oTstDrv.sScratchPath, os.path.split(sOva)[1] + '-ovf');
     156        sOvf    = os.path.join(sTmpDir, os.path.splitext(os.path.split(sOva)[1])[0] + '.ovf');
    157157
    158158        #
     
    160160        #
    161161        try:
    162             os.mkdir(sTmpDir, 0o755)
    163             oTarFile = tarfile.open(sOva, 'r:*')
    164             oTarFile.extractall(sTmpDir)
    165             oTarFile.close()
    166         except:
    167             return reporter.errorXcpt('Unpacking "%s" to "%s" for OVF style importing failed' % (sOvf, sTmpDir,))
     162            os.mkdir(sTmpDir, 0o755);
     163            oTarFile = tarfile.open(sOva, 'r:*');
     164            oTarFile.extractall(sTmpDir);
     165            oTarFile.close();
     166        except:
     167            return reporter.errorXcpt('Unpacking "%s" to "%s" for OVF style importing failed' % (sOvf, sTmpDir,));
    168168
    169169        #
     
    171171        #
    172172        try:
    173             oAppliance2 = oVirtualBox.createAppliance()
    174         except:
    175             return reporter.errorXcpt('IVirtualBox::createAppliance failed (#2)')
     173            oAppliance2 = oVirtualBox.createAppliance();
     174        except:
     175            return reporter.errorXcpt('IVirtualBox::createAppliance failed (#2)');
    176176
    177177        try:
    178178            oProgress = vboxwrappers.ProgressWrapper(oAppliance2.read(sOvf), self.oTstDrv.oVBoxMgr, self.oTstDrv,
    179                                                      'read "%s"' % (sOvf,))
    180         except:
    181             return reporter.errorXcpt('IAppliance::read("%s") failed' % (sOvf,))
    182         oProgress.wait()
    183         if oProgress.logResult() is False:
    184             return False
    185 
    186         try:
    187             oAppliance2.interpret()
    188         except:
    189             return reporter.errorXcpt('IAppliance::interpret() failed on "%s"' % (sOvf,))
     179                                                     'read "%s"' % (sOvf,));
     180        except:
     181            return reporter.errorXcpt('IAppliance::read("%s") failed' % (sOvf,));
     182        oProgress.wait();
     183        if oProgress.logResult() is False:
     184            return False;
     185
     186        try:
     187            oAppliance2.interpret();
     188        except:
     189            return reporter.errorXcpt('IAppliance::interpret() failed on "%s"' % (sOvf,));
    190190
    191191        try:
    192192            oProgress = vboxwrappers.ProgressWrapper(oAppliance2.importMachines([]),
    193                                                      self.oTstDrv.oVBoxMgr, self.oTstDrv, 'importMachines "%s"' % (sOvf,))
    194         except:
    195             return reporter.errorXcpt('IAppliance::importMachines failed on "%s"' % (sOvf,))
    196         oProgress.wait()
    197         if oProgress.logResult() is False:
    198             return False
    199 
    200         return True
     193                                                     self.oTstDrv.oVBoxMgr, self.oTstDrv, 'importMachines "%s"' % (sOvf,));
     194        except:
     195            return reporter.errorXcpt('IAppliance::importMachines failed on "%s"' % (sOvf,));
     196        oProgress.wait();
     197        if oProgress.logResult() is False:
     198            return False;
     199
     200        return True;
    201201
    202202
Note: See TracChangeset for help on using the changeset viewer.

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