This script cover some sr-iov negative boot test case. Boot sr-iov device with invalid paramter.
Signed-off-by: Feng Yang <[email protected]> --- kvm/tests/sr_iov_boot_negative.py | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) create mode 100644 kvm/tests/sr_iov_boot_negative.py diff --git a/kvm/tests/sr_iov_boot_negative.py b/kvm/tests/sr_iov_boot_negative.py new file mode 100644 index 0000000..8716772 --- /dev/null +++ b/kvm/tests/sr_iov_boot_negative.py @@ -0,0 +1,36 @@ +import logging +from autotest.client.shared import error +from virttest import env_process + + [email protected]_aware +def run_sr_iov_boot_negative(test, params, env): + """ + KVM boot with negative paramter test: + 1) Try to boot VM with negative parameters. + 2) Verify that qemu could handle the negative paramters. + Check the negative message (optional) + + @param test: kvm test object + @param params: Dictionary with the test parameters + @param env: Dictionary with test environment. + """ + + neg_msg = params.get("negative_msg") + if params.get("start_vm") == "yes": + raise error.TestError("Please set start_vm to no") + params["start_vm"] = "yes" + try: + error.context("Try to boot VM with negative parameters", logging.info) + case_fail = False + env_process.preprocess_vm(test, params, env, params.get("main_vm")) + case_fail = True + except Exception, e: + if neg_msg: + error.context("Check qemu-kvm error message", logging.info) + if neg_msg not in str(e): + msg = "Could not find '%s' in error message '%s'" % (neg_msg, e) + raise error.TestFail(msg) + logging.debug("Could not boot up vm, %s" % e) + if case_fail: + raise error.TestFail("Did not raise exception during vm boot up") -- 1.7.1 _______________________________________________ Autotest-kernel mailing list [email protected] https://www.redhat.com/mailman/listinfo/autotest-kernel
