[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 07/24] cs-hosts-list: Support --arches and --kernels
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> --- cs-hosts-list | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/cs-hosts-list b/cs-hosts-list index 1fea3cd..92f44ee 100755 --- a/cs-hosts-list +++ b/cs-hosts-list @@ -29,9 +29,25 @@ use Osstest; csreadconfig(); +our @kernels = qw(xen linux); +our @arches; + +while (@ARGV && $ARGV[0] =~ m/^-/) { + $_ = shift @ARGV; + last if m/^--$/; + while (m/^-./) { + if (s/^--arches=(.*)/-/) { + @arches = split /\,/, $1; + } elsif (s/^--kernels=(.*)/-/) { + @kernels = split /\,/, $1; + } else { + die "bad option $_ ?"; + } + } +} + @ARGV == 1 or die $!; my ($flags) = @ARGV; -$flags =~ m/^-/ and die $!; my @qargs; my $qtxt= <<END; @@ -49,13 +65,36 @@ END } my $q= $dbh_tests->prepare($qtxt); + +my $flagq = $dbh_tests->prepare(<<END); + SELECT 1 + FROM hostflags + WHERE hostname=? AND hostflag=? +END + my $o; +sub report_arch ($) { + my ($host) = @_; + foreach my $kernel (@kernels) { + my $kernprefix = $kernel eq 'linux' ? '' : "$kernel-"; + foreach my $arch (@arches) { + $flagq->execute($host,"arch-$kernprefix$arch"); + if ($flagq->fetchrow_arrayref()) { + $o .= " $kernel $arch"; + return; + } + } + } + $o .= " NONE NONE"; +} + db_retry($dbh_tests,[],sub { $o=''; $q->execute(@qargs); while (my ($host) = $q->fetchrow_array()) { $o .= $host; + report_arch($host) if @arches; $o .= "\n"; } }); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |