summaryrefslogtreecommitdiff
path: root/worker/tests/ping.rb
diff options
context:
space:
mode:
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