diff options
author | Cole Robinson <crobinso@redhat.com> | 2016-06-17 18:41:50 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2016-06-17 18:41:50 -0400 |
commit | df5c688c1156404d1b933bec7da7f0a5352bec5d (patch) | |
tree | 3e327b61323f108dd65eaeb82cacca64ef25863e | |
parent | cf3a1cc1f08a6f1afe9433cf07af1fb931117f2f (diff) | |
download | virt-manager-df5c688c1156404d1b933bec7da7f0a5352bec5d.tar.gz |
tests_inject: Update to use standard --only option
Rather than custom --distro option. And fix the URL list
-rwxr-xr-x | setup.py | 20 | ||||
-rw-r--r-- | tests/__init__.py | 3 | ||||
-rwxr-xr-x | tests/test_inject.py | 24 |
3 files changed, 12 insertions, 35 deletions
@@ -559,28 +559,8 @@ class TestURLFetch(TestBaseCommand): class TestInitrdInject(TestBaseCommand): description = "Test initrd inject with real kernels, fetched from URLs" - user_options = TestBaseCommand.user_options + [ - ("distro=", None, "Comma separated list of distros to test, from " - "the tests internal URL dictionary.") - ] - - def initialize_options(self): - TestBaseCommand.initialize_options(self) - self.distro = "" - - def finalize_options(self): - TestBaseCommand.finalize_options(self) - orig = str(self.distro) - if not orig: - self.distro = [] - else: - self.distro = orig.split(",") - def run(self): self._testfiles = ["tests.test_inject"] - if self.distro: - import tests - tests.INITRD_TEST_DISTROS += self.distro TestBaseCommand.run(self) diff --git a/tests/__init__.py b/tests/__init__.py index e86bdcbe..e2a5c375 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -68,6 +68,3 @@ virtxml = _import("virtxml", "virt-xml") # Variable used to store a local iso or dir path to check for a distro # Specified via 'python setup.py test_urls --path" URLTEST_LOCAL_MEDIA = [] - -# Used to implement test_initrd_inject --distro -INITRD_TEST_DISTROS = [] diff --git a/tests/test_inject.py b/tests/test_inject.py index 3fc6e4c9..370584fd 100755 --- a/tests/test_inject.py +++ b/tests/test_inject.py @@ -6,7 +6,6 @@ import os import sys import unittest -from tests import INITRD_TEST_DISTROS from tests import utils from virtinst import Guest @@ -23,8 +22,7 @@ guest.os.os_type = "hvm" guest.os.arch = "x86_64" meter = util.make_meter(quiet=False) -DEVFEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/development/%s/%s/os/" -OLD_FEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/releases/%s/Fedora/%s/os/" +DEVFEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/development/%s/Server/%s/os/" FEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/releases/%s/Server/%s/os/" (WARN_RHEL4, @@ -66,9 +64,8 @@ _add("centos-6-latest", "http://ftp.linux.ncsu.edu/pub/CentOS/6/os/x86_64/", warntype=WARN_RHEL5) _add("centos-7-latest", "http://ftp.linux.ncsu.edu/pub/CentOS/7/os/x86_64/", ks2=True) -_add("fedora-20", OLD_FEDORA_URL % ("20", "x86_64"), ks2=True) -_add("fedora-21", FEDORA_URL % ("21", "x86_64"), ks2=True) -_add("fedora-22", DEVFEDORA_URL % ("22", "x86_64"), ks2=True) +_add("fedora-23", FEDORA_URL % ("23", "x86_64"), ks2=True) +_add("fedora-24", DEVFEDORA_URL % ("24", "x86_64"), ks2=True) def exit_cleanup(): @@ -93,6 +90,8 @@ def _fetch_distro(distro): cleanup.append(initrd) distro.kernel = kernel distro.initrd = initrd + except Exception, e: + print "fetching distro=%s failed: %s" % (distro.name, e) finally: fetcher.cleanupLocation() if origenv: @@ -125,7 +124,7 @@ def _test_distro(distro): nic = distro.virtio and "virtio" or "rtl8139" append = "-append \"ks=file:/%s\"" % os.path.basename(injectfile) cmd = ("sudo qemu-kvm -enable-kvm -name %s " - "-cpu host -m 1500 -sdl " + "-cpu host -m 1500 -display gtk " "-net bridge,br=virbr0 -net nic,model=%s " "-kernel %s -initrd %s %s" % (distro.name, nic, kernel, newinitrd, append)) @@ -139,6 +138,7 @@ _printfetch = False class FetchTests(unittest.TestCase): def setUp(self): + self.failfast = True global _printfetch if _printfetch: return @@ -182,12 +182,12 @@ def _make_tests(): def _make_check_cb(_d): return lambda s: _test_distro(_d) - distros = INITRD_TEST_DISTROS or _alldistros.keys() idx = 0 - for d in distros: - dobj = _alldistros[d] + for dname, dobj in _alldistros.items(): idx += 1 - setattr(FetchTests, "testFetch%.3d" % idx, _make_fetch_cb(dobj)) - setattr(InjectTests, "testInitrd%.3d" % idx, _make_check_cb(dobj)) + setattr(FetchTests, "testFetch%.3d_%s" % + (idx, dname.replace("-", "_")), _make_fetch_cb(dobj)) + setattr(InjectTests, "testInitrd%.3d_%s" % + (idx, dname.replace("-", "_")), _make_check_cb(dobj)) _make_tests() |