VirtualBox

Changeset 59556 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Feb 2, 2016 2:06:22 AM (9 years ago)
Author:
vboxsync
Message:

tdAppliance1.py: Quick import test of the tiny checked in OVAs.

File:
1 edited

Legend:

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

    r59535 r59556  
    3434import os
    3535import sys
    36 import time
    37 import threading
    38 import types
    3936
    4037# Only the main script needs to modify the path.
     
    4845from testdriver import base;
    4946from testdriver import vbox;
     47from testdriver import vboxwrappers;
    5048
    5149
     
    7977
    8078        # Import a set of simple OVAs.
    81         for sOVA in [,]:
    82             pass;  ## @todo
     79        # Note! Manifests generated by ovftool 4.0.0 does not include the ovf, while the ones b 4.1.0 does.
     80        for sOva in (
     81            # t1 is a plain VM without any disks, ovftool 4.0 export from fusion
     82            'tdAppliance1-t1.ova',
     83            # t2 is a plain VM with one disk. Both 4.0 and 4.1.0 exports.
     84            'tdAppliance1-t2.ova',
     85            'tdAppliance1-t2-ovftool-4.1.0.ova',
     86            # t3 is a VM with one gzipped disk and selecting SHA256 on the ovftool cmdline (--compress=9 --shaAlgorithm=sha256).
     87            'tdAppliance1-t3.ova',
     88            'tdAppliance1-t3-ovftool-4.1.0.ova',
     89            # t4 is a VM with with two gzipped disk, SHA256 and a signed manifest (--privateKey=./tdAppliance1-t4.pem).
     90            'tdAppliance1-t4.ova',
     91            'tdAppliance1-t4-ovftool-4.1.0.ova',
     92            ):
     93            reporter.testStart(sOva);
     94            try:
     95                fRc = self.testImportOva(os.path.join(g_ksValidationKitDir, 'tests', 'api', sOva)) and fRc;
     96            except:
     97                reporter.errorXcpt();
     98                fRc = False;
     99            fRc = reporter.testDone() and fRc;
    83100
     101        ## @todo more stuff
    84102        return fRc;
    85103
     
    88106    #
    89107
     108    def testImportOva(self, sOva):
     109        """ xxx """
     110        oVirtualBox = self.oVBoxMgr.getVirtualBox();
     111
     112        try:
     113            oAppliance = oVirtualBox.createAppliance();
     114        except:
     115            return reporter.errorXcpt('IVirtualBox::createAppliance failed');
     116        print "oAppliance=%s" % (oAppliance,)
     117
     118        try:
     119            oProgress = vboxwrappers.ProgressWrapper(oAppliance.read(sOva), self.oVBoxMgr, self, 'read "%s"' % (sOva,));
     120        except:
     121            return reporter.errorXcpt('IAppliance::read("%s") failed' % (sOva,));
     122        oProgress.wait();
     123        if oProgress.logResult() is False:
     124            return False;
     125
     126        try:
     127            oAppliance.interpret();
     128        except:
     129            return reporter.errorXcpt('IAppliance::interpret() failed on "%s"' % (sOva,));
     130
     131        #
     132        try:
     133            oProgress = vboxwrappers.ProgressWrapper(oAppliance.importMachines([]),
     134                                                     self.oVBoxMgr, self, 'importMachines "%s"' % (sOva,));
     135        except:
     136            return reporter.errorXcpt('IAppliance::importMachines failed on "%s"' % (sOva,));
     137        oProgress.wait();
     138        if oProgress.logResult() is False:
     139            return False;
     140
     141        ## @todo do more with this OVA. Like untaring it and loading it as an OVF.  Export it and import it again.
     142
     143        return True;
     144
    90145
    91146if __name__ == '__main__':
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