summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorRuediger Meier2014-06-11 19:28:20 +0200
committerRuediger Meier2014-06-12 01:09:38 +0200
commita98de9696e1a898f925c9154e5693e73aec0779d (patch)
tree88d231109463e10c477298b527672d2dd9153867 /tests/functions.sh
parenttests: split last into dns and nodns subtests (diff)
downloadkernel-qcow2-util-linux-a98de9696e1a898f925c9154e5693e73aec0779d.tar.gz
kernel-qcow2-util-linux-a98de9696e1a898f925c9154e5693e73aec0779d.tar.xz
kernel-qcow2-util-linux-a98de9696e1a898f925c9154e5693e73aec0779d.zip
tests: skip some last tests if no dns support
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 31ad481f4..2a50de721 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -610,3 +610,20 @@ function ts_scsi_debug_init {
TS_DEVICE="/dev/${devname}"
}
+
+function ts_resolve_host {
+ local host="$1"
+ local tmp
+
+ # currently we just resolve default records (might be "A", ipv4 only)
+ if type "dig" >/dev/null 2>&1; then
+ tmp=$(dig "$host" +short 2>/dev/null) || return 1
+ elif type "nslookup" >/dev/null 2>&1; then
+ tmp=$(nslookup "$host" 2>/dev/null) || return 1
+ tmp=$(echo "$tmp"| grep -A1 "^Name:"| grep "^Address:"| cut -d" " -f2)
+ fi
+
+ # we return 1 if tmp is empty
+ test -n "$tmp" || return 1
+ echo "$tmp" | sort -R | head -n 1
+}