summaryrefslogtreecommitdiff
path: root/tests/test_urls.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2018-10-18 13:01:59 -0400
committerCole Robinson <crobinso@redhat.com>2018-10-18 13:21:44 -0400
commitfe9aa7085ba89756a9a4a6cf530229fb691f775e (patch)
tree4cc2be7057b56e8cbbd36e20a3f95df062b6e748 /tests/test_urls.py
parentb8aff28087d593f570b13aabe337b659bc260ae3 (diff)
downloadvirt-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
Diffstat (limited to 'tests/test_urls.py')
-rw-r--r--tests/test_urls.py20
1 files changed, 14 insertions, 6 deletions
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())