summaryrefslogtreecommitdiff
path: root/scripts/qtest.py
AgeCommit message (Collapse)AuthorFilesLines
2017-09-15qtest.py: Few pylint/style fixesLukáš Doktor1-6/+5
No actual code changes, just few pylint/style fixes. Signed-off-by: Lukáš Doktor <ldoktor@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-Id: <20170818142613.32394-11-ldoktor@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2017-09-15qemu|qtest: Avoid dangerous argumentsLukáš Doktor1-1/+1
The list object is mutable in python and potentially might modify other object's arguments when used as default argument. Reproducer: >>> vm1 = QEMUMachine("qemu") >>> vm2 = QEMUMachine("qemu") >>> vm1._wrapper.append("foo") >>> print vm2._wrapper ['foo'] In this case the `args` is actually copied so it would be safe to keep it, but it's not a good practice to keep it. The same issue applies in inherited qtest module. Signed-off-by: Lukáš Doktor <ldoktor@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-Id: <20170818142613.32394-3-ldoktor@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2016-07-26iotest: fix python based IO testsDaniel P. Berrange1-7/+12
The previous commit refactoring iotests.py: commit 66613974468fb6e1609fb3eabf55981b1ee436cf Author: Daniel P. Berrange <berrange@redhat.com> Date: Wed Jul 20 14:23:10 2016 +0100 scripts: refactor the VM class in iotests for reuse was not properly tested and included a number of broken bits. - The 'event_match' method was not moved into qemu.py - The 'self._args' list parameter in QEMUMachine needs to be copied otherwise modifications will affect the global 'qemu_opts' variable in iotests.py - The QEMUQtestMachine class methods had inverted parameter order for the super() calls - The QEMUQtestMachine class forgot to add '-machine accel=qtest' - The QEMUQtestMachine class constructor needs to set a default 'name' value before using it as it may be None - The QEMUQtestMachine class constructor needs to use named parameters when calling the super constructor as it is leaving out some positional parameters. - The 'qemu_prog' variable should be a string not a list in iotests.py - The VM classs constructor needs to use named parameters when calling the super constructor as it is leaving out some positional parameters. - The path to the socket-scm-helper needs to be passed into the QEMUMachine class Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1469549767-27249-1-git-send-email-berrange@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-07-22scripts: refactor the VM class in iotests for reuseDaniel P. Berrange1-0/+34
The iotests module has a python class for controlling QEMU processes. Pull the generic functionality out of this file and create a scripts/qemu.py module containing a QEMUMachine class. Put the QTest integration support into a subclass QEMUQtestMachine. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1469020993-29426-4-git-send-email-berrange@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2015-02-16qtest: Add scripts/qtest.pyFam Zheng1-0/+71
This adds scripts/qtest.py as a python library for qtest protocol. This is a skeleton with a basic "cmd" method to execute a command, reading and parsing of qtest output could be added later on demand. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 1422586186-9925-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>