]> xenbits.xensource.com Git - people/dariof/osstest.git/commitdiff
ts-host-ping-check: New ubiquitous test step
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 31 Mar 2015 13:50:43 +0000 (13:50 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 31 Mar 2015 13:50:43 +0000 (13:50 +0000)
Check that packet loss is within acceptable levels.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
sg-run-job
ts-host-ping-check [new file with mode: 0755]

index a1ff24bf6a32b4e6669500babd75a2ea4e4e4fa3..3bdb5aa294d518bbbefc55d05f2f1b9e2b35c441 100755 (executable)
@@ -51,8 +51,10 @@ proc run-job {job} {
     if {$ok} { setstatus running                                          }
 
     per-host-ts broken  host-install/@(*) ts-host-install-twice
+    per-host-ts .       host-ping-check-native/@ ts-host-ping-check
     per-host-ts .       xen-install/@     ts-xen-install
     per-host-ts .       xen-boot/@        ts-host-reboot
+    per-host-ts .       host-ping-check-xen/@ ts-host-ping-check
 
     per-host-ts .       =(*)             {ts-leak-check basis}
 
diff --git a/ts-host-ping-check b/ts-host-ping-check
new file mode 100755 (executable)
index 0000000..74c008c
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use Osstest;
+use DBI;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($whhost) = @ARGV;
+$whhost ||= 'host';
+our $ho= selecthost($whhost);
+
+$_ = `ping -D -i 0.2 -c 100 $ho->{Ip} | tee /dev/stderr`;
+
+m/\b([0-9.]+)% packet loss\b/ or die "$_ ?";
+
+my $loss= $1;
+
+logm("packet loss $loss\%");
+
+die if $loss > 1;
+
+logm("ok.");