[KVM-AUTOTEST PATCH 2/3] KVM test: use kvm_utils.find_command() where appropriate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of hardcoding binary paths, use kvm_utils.find_command().
This should make the KVM test a little more distro independent.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_preprocessing.py |    4 ++--
 client/tests/kvm/kvm_utils.py         |    7 ++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
index ee279bd..2f6994a 100644
--- a/client/tests/kvm/kvm_preprocessing.py
+++ b/client/tests/kvm/kvm_preprocessing.py
@@ -208,8 +208,8 @@ def preprocess(test, params, env):
         env["tcpdump"].close()
         del env["tcpdump"]
     if "tcpdump" not in env and params.get("run_tcpdump", "yes") == "yes":
-        command = "/usr/sbin/tcpdump -npvi any 'dst port 68'"
-        logging.debug("Starting tcpdump (%s)...", command)
+        cmd = "%s -npvi any 'dst port 68'" % kvm_utils.find_command("tcpdump")
+        logging.debug("Starting tcpdump (%s)...", cmd)
         env["tcpdump"] = kvm_subprocess.kvm_tail(
             command=command,
             output_func=_update_address_cache,
diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index a57a334..4183f1c 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -250,19 +250,20 @@ def verify_ip_address_ownership(ip, macs, timeout=10.0):
     regex = re.compile(r"\b%s\b.*\b(%s)\b" % (ip, mac_regex), re.IGNORECASE)
 
     # Check the ARP cache
-    o = commands.getoutput("/sbin/arp -n")
+    o = commands.getoutput("%s -n" % find_command("arp"))
     if regex.search(o):
         return True
 
     # Get the name of the bridge device for arping
-    o = commands.getoutput("/sbin/ip route get %s" % ip)
+    o = commands.getoutput("%s route get %s" % (find_command("ip"), ip))
     dev = re.findall("dev\s+\S+", o, re.IGNORECASE)
     if not dev:
         return False
     dev = dev[0].split()[-1]
 
     # Send an ARP request
-    o = commands.getoutput("/sbin/arping -f -c 3 -I %s %s" % (dev, ip))
+    o = commands.getoutput("%s -f -c 3 -I %s %s" %
+                           (find_command("arping"), dev, ip))
     return bool(regex.search(o))
 
 
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux