diff options
author | Cole Robinson <crobinso@redhat.com> | 2018-10-18 13:01:59 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2018-10-18 13:21:44 -0400 |
commit | fe9aa7085ba89756a9a4a6cf530229fb691f775e (patch) | |
tree | 4cc2be7057b56e8cbbd36e20a3f95df062b6e748 | |
parent | b8aff28087d593f570b13aabe337b659bc260ae3 (diff) | |
download | virt-manager-fe9aa7085ba89756a9a4a6cf530229fb691f775e.tar.gz |
test_urls: Add kernelregex= option
For verifying detected kernel paths. Add a few basic examples. I
will use this in my local iso test suite for checking debian
iso vs http-iso case
-rw-r--r-- | tests/test_urls.ini | 2 | ||||
-rw-r--r-- | tests/test_urls.py | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/tests/test_urls.ini b/tests/test_urls.ini index 0af408f1..96002257 100644 --- a/tests/test_urls.ini +++ b/tests/test_urls.ini @@ -141,6 +141,7 @@ url = https://d-i.debian.org/daily-images/amd64/ testxen = 1 distro = debiantesting kernelarg = None +kernelregex = daily/netboot/debian-installer/.* @@ -152,6 +153,7 @@ kernelarg = None [ubuntu8.04] url = http://old-releases.ubuntu.com/ubuntu/dists/hardy/main/installer-amd64 distro = ubuntu8.04 +kernelregex = current/images/netboot/ubuntu-installer/.* testshortcircuit = 1 [ubuntu8.04-i686] # Sneak a port parsing example in here diff --git a/tests/test_urls.py b/tests/test_urls.py index 098c5996..c7144979 100644 --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -35,13 +35,14 @@ class _URLTestData(object): Data is stored in test_urls.ini """ def __init__(self, name, url, detectdistro, - testxen, testshortcircuit, kernelarg): + testxen, testshortcircuit, kernelarg, kernelregex): self.name = name self.url = url self.detectdistro = detectdistro self.arch = self._find_arch() self.distroclass = self._distroclass_for_name(self.name) self.kernelarg = kernelarg + self.kernelregex = kernelregex self.testxen = testxen @@ -198,15 +199,21 @@ def _testURL(fetcher, testdata): # to fetch files for that part def fakeAcquireFile(filename): logging.debug("Fake acquiring %s", filename) - return fetcher.hasFile(filename) + if not fetcher.hasFile(filename): + return False + return filename fetcher.acquireFile = fakeAcquireFile # Fetch regular kernel kernel, initrd, kernelargs = hvmstore.acquireKernel() - if kernel is not True or initrd is not True: + if kernel is False or initrd is False: AssertionError("%s-%s: hvm kernel fetching failed" % (distname, arch)) + if testdata.kernelregex and not re.match(testdata.kernelregex, kernel): + raise AssertionError("kernel=%s but testdata.kernelregex='%s'" % + (kernel, testdata.kernelregex)) + if testdata.kernelarg == "None": if bool(kernelargs): raise AssertionError("kernelargs='%s' but testdata.kernelarg='%s'" @@ -219,8 +226,8 @@ def _testURL(fetcher, testdata): # Fetch xen kernel if xenstore: kernel, initrd, kernelargs = xenstore.acquireKernel() - if kernel is not True or initrd is not True: - raise AssertionError("%s-%s: xen kernel fetching" % + if kernel is False or initrd is False: + raise AssertionError("%s-%s: xen kernel fetching failed" % (distname, arch)) @@ -279,7 +286,8 @@ def _make_tests(): vals.get("distro", None), vals.get("testxen", "0") == "1", vals.get("testshortcircuit", "0") == "1", - vals.get("kernelarg", None)) + vals.get("kernelarg", None), + vals.get("kernelregex", None)) urls[d.name] = d keys = list(urls.keys()) |