From: Ian Jackson Subject: [OSSTEST PATCH 5/6] ts-host-ping-check: New ubiquitous test step Date: Tue, 31 Mar 2015 15:18:44 +0100 Message-ID: <1427811525-14259-6-git-send-email-ian.jackson@eu.citrix.com> References: <1427811525-14259-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Ycx5u-0005yD-D1 for xen-devel@lists.xenproject.org; Tue, 31 Mar 2015 14:24:42 +0000 In-Reply-To: <1427811525-14259-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Check that packet loss is within acceptable levels. Signed-off-by: Ian Jackson --- sg-run-job | 2 ++ ts-host-ping-check | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 ts-host-ping-check diff --git a/sg-run-job b/sg-run-job index a1ff24b..3bdb5aa 100755 --- a/sg-run-job +++ b/sg-run-job @@ -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 index 0000000..74c008c --- /dev/null +++ b/ts-host-ping-check @@ -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 . + +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."); -- 1.7.10.4