summaryrefslogtreecommitdiff
path: root/worker/tests/ping.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-12 21:00:16 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-12 21:00:16 +0000
commit6334b9cdfc47bd85b2ce236572e08406324d25cd (patch)
treebd0bd3cc279d8377efde2affc8dc223bfb858ca2 /worker/tests/ping.rb
Initial dump of code.
Diffstat (limited to 'worker/tests/ping.rb')
-rwxr-xr-xworker/tests/ping.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/worker/tests/ping.rb b/worker/tests/ping.rb
new file mode 100755
index 0000000..72769a6
--- /dev/null
+++ b/worker/tests/ping.rb
@@ -0,0 +1,36 @@
+
+#
+# Run a PING test.
+#
+#
+# Return value
+# TRUE: The host is up
+#
+# FALSE: The host is not up
+#
+def ping_test( params )
+
+ #
+ # Find the binary
+ #
+ binary = nil
+ binary = "./util/multi-ping" if ( File.exists?( "./util/multi-ping" ) )
+ binary = "../util/multi-ping" if ( File.exists?( "../util/multi-ping" ) )
+
+ if ( binary.nil? )
+ puts "Failed to find 'multi-ping'"
+ exit 1
+ end
+
+ #
+ # Is it IPv6 or IPv4a
+ #
+ host = params['target_host']
+ if ( system( "#{binary} #{host}" ) == true )
+ puts "PING OK"
+ return true
+ else
+ puts "PING FAILED"
+ return false
+ end
+end