From d6cf9179306ca6704b6be4da7147941b6ce93587 Mon Sep 17 00:00:00 2001 From: Jonas Eriksson Date: Tue, 25 Mar 2014 09:05:25 +0100 Subject: [PATCH] pipetest application: Avoid building if available Tested by running: ipi_x2apic Signed-off-by: Jonas Eriksson --- qemu/tests/cfg/ipi_x2apic.cfg | 3 ++- qemu/tests/ipi_x2apic.py | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/qemu/tests/cfg/ipi_x2apic.cfg b/qemu/tests/cfg/ipi_x2apic.cfg index da836117..f65f2c8a 100644 --- a/qemu/tests/cfg/ipi_x2apic.cfg +++ b/qemu/tests/cfg/ipi_x2apic.cfg @@ -4,6 +4,7 @@ type = ipi_x2apic vms = "" check_x2apic_cmd = dmesg |grep x2apic - run_pipetest_cmd = "cd /tmp/ && gcc -o pipetest pipetest.c && ./pipetest && cd" + pipetest_cmd = "/tmp/pipetest" + build_pipetest_cmd = "cd /tmp/ && gcc -o pipetest pipetest.c" x2apic_check_string = Enabling x2apic, Enabled x2apic, Setting APIC routing to physical x2apic pre_command += " grep 'flags' /proc/cpuinfo|grep 'ept' && modprobe -r kvm_intel && modprobe kvm_intel ept=1 || echo ok;" diff --git a/qemu/tests/ipi_x2apic.py b/qemu/tests/ipi_x2apic.py index 6dd0c93f..43973a0c 100644 --- a/qemu/tests/ipi_x2apic.py +++ b/qemu/tests/ipi_x2apic.py @@ -61,12 +61,17 @@ def run(test, params, env): msg = "%s is not displayed in output" % check_string raise error.TestFail(msg) - file_link = os.path.join(test.virtdir, "scripts/pipetest.c") - vm.copy_files_to(file_link, "/tmp/pipetest.c") - run_pipetest_cmd = params.get("run_pipetest_cmd") + pipetest_cmd = params.get("pipetest_cmd") + if session.get_command_status("test -x %s" % pipetest_cmd): + file_link = os.path.join(test.virtdir, "scripts/pipetest.c") + vm.copy_files_to(file_link, "/tmp/pipetest.c") + build_pipetest_cmd = params.get("build_pipetest_cmd") + error.context("Build pipetest script in guest.", logging.info) + session.cmd(build_pipetest_cmd, timeout=180) + error.context("Run pipetest script in guest.", logging.info) try: - o = session.cmd(run_pipetest_cmd, timeout=180) + o = session.cmd(pipetest_cmd, timeout=180) except aexpect.ShellTimeoutError, e: o = e re_str = params.get("usec_re_str", "[0-9]*\.[0-9]+") @@ -88,7 +93,7 @@ def run(test, params, env): error.context("Run pipetest script in guest again.", logging.info) try: - o = session.cmd(run_pipetest_cmd, timeout=180) + o = session.cmd(pipetest_cmd, timeout=180) except aexpect.ShellTimeoutError, e: o = e val2 = get_re_average(o, re_str) -- GitLab