aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-03-28 11:46:56 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-28 11:46:56 +0100
commit03e184b4741c0c182ed2446f41ab07926398634e (patch)
treef785d8f33f2ca8851d015f8e8346f3ed1a196511
parentecf497920d1f72949d093fa29fb1527bebe6a2e4 (diff)
downloaddrminfo-03e184b4741c0c182ed2446f41ab07926398634e.tar.gz
test tweaks
-rw-r--r--tests/README1
-rw-r--r--tests/basic.py14
-rw-r--r--tests/drminfo/__init__.py23
3 files changed, 34 insertions, 4 deletions
diff --git a/tests/README b/tests/README
index 0ad5ccb..da8182c 100644
--- a/tests/README
+++ b/tests/README
@@ -4,3 +4,4 @@ avocado framework tests for qemu display devices
usage:
export QEMU_BUILD_DIR=/path/to/qemu/build/tree
avocado run .
+
diff --git a/tests/basic.py b/tests/basic.py
index a7f5ca1..3cf762d 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -77,6 +77,12 @@ class BaseDRM(TestDRM):
self.wconsole.write('\n')
self.wconsole.flush()
+ def write_text(self, device, name, content):
+ outfile = '%s/%s-%s.txt' % (self.outputdir, name, device)
+ f = open(outfile, "w")
+ f.write(content)
+ f.close()
+
def run_one_test(self, device):
version = os.uname()[2]
kernel = "/boot/vmlinuz-%s" % version
@@ -104,7 +110,8 @@ class BaseDRM(TestDRM):
self.console_wait('---root---')
self.console_run('drminfo -a')
- self.console_wait('---root---')
+ txt = self.console_wait('---root---')
+ self.write_text(device, "drminfo", txt)
self.console_run('drminfo -F')
formats = self.console_wait('---root---')
@@ -130,8 +137,9 @@ class BaseDRM(TestDRM):
self.screen_dump(device, 'virtio')
self.console_wait('---root---')
- self.console_run('fbinfo -a')
- self.console_wait('---root---')
+ self.console_run('fbinfo')
+ txt = self.console_wait('---root---')
+ self.write_text(device, "fbinfo", txt)
self.console_run('fbtest -a -s 10')
self.console_wait('---ok---', '---root---', 'fbtest failed')
diff --git a/tests/drminfo/__init__.py b/tests/drminfo/__init__.py
index 015cd03..629afd5 100644
--- a/tests/drminfo/__init__.py
+++ b/tests/drminfo/__init__.py
@@ -6,9 +6,30 @@ QEMU_BUILD_DIR = os.environ.get("QEMU_BUILD_DIR");
sys.path.append(os.path.join(QEMU_BUILD_DIR, 'python'))
from qemu import QEMUMachine
+def find_qemu_binary():
+ """
+ Picks the path of a QEMU binary, starting either in the current working
+ directory or in the source tree root directory.
+ """
+ arch = os.uname()[4]
+ qemu_build = os.path.join(QEMU_BUILD_DIR,
+ "%s-softmmu" % arch,
+ "qemu-system-%s" % arch)
+ qemu_path = [
+ qemu_build,
+ "/usr/local/bin/qemu-system-%s" % arch,
+ "/usr/bin/qemu-system-%s" % arch,
+ "/usr/bin/qemu-kvm",
+ "/usr/libexec/qemu-kvm",
+ ]
+ for item in qemu_path:
+ if os.path.isfile(item):
+ return item;
+ return None
+
class TestDRM(avocado.Test):
def setUp(self):
- self.vm = QEMUMachine("/usr/local/bin/qemu-system-x86_64")
+ self.vm = QEMUMachine(find_qemu_binary())
def tearDown(self):
self.vm.shutdown()