From 571c94351f2bf4e5655a32b9141a7e1d31903744 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 16 Oct 2012 19:15:54 +0100 Subject: [PATCH] wip reorg fixups --- tcl/JobDB-Standalone.tcl | 3 ++- ts-debian-fixup | 5 +++-- ts-debian-install | 1 + ts-guest-destroy | 5 +++-- ts-guest-localmigrate | 4 ++-- ts-guest-migrate | 5 +++-- ts-guest-saverestore | 5 +++-- ts-guest-start | 5 +++-- ts-guest-stop | 5 +++-- ts-guests-nbd-mirror | 5 ++--- ts-host-fail | 4 ++-- ts-host-powercycle | 4 ++-- ts-host-reboot | 4 ++-- ts-hosts-allocate-Executive | 3 ++- ts-kernel-build | 5 +++-- ts-leak-check | 4 ++-- ts-logs-capture | 4 ++-- ts-redhat-install | 4 ++-- ts-remus-check | 5 +++-- ts-remus-start | 5 +++-- ts-windows-install | 4 ++-- ts-xen-build | 5 +++-- ts-xen-build-check | 4 +++- ts-xen-build-prep | 5 +++-- ts-xen-install | 6 +++--- 25 files changed, 62 insertions(+), 47 deletions(-) diff --git a/tcl/JobDB-Standalone.tcl b/tcl/JobDB-Standalone.tcl index f060c64f..2ff40e97 100644 --- a/tcl/JobDB-Standalone.tcl +++ b/tcl/JobDB-Standalone.tcl @@ -44,7 +44,8 @@ proc set-flight {} { } proc spawn-step-begin {flight job ts stepnovar} { - variable stepcounter 0 + variable stepcounter + if {![info exists stepcounter]} { set stepcounter 0 } upvar 1 $stepnovar stepno set stepno [incr stepcounter] } diff --git a/ts-debian-fixup b/ts-debian-fixup index 70142071..7f5479f6 100755 --- a/ts-debian-fixup +++ b/ts-debian-fixup @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($ho,$gho) = ts_get_host_guest(@ARGV); our ($cfgfile,$cfgstash,$cfg); diff --git a/ts-debian-install b/ts-debian-install index 74c0cce2..6dadfa8a 100755 --- a/ts-debian-install +++ b/ts-debian-install @@ -3,6 +3,7 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; tsreadconfig(); diff --git a/ts-guest-destroy b/ts-guest-destroy index cdfb9145..44f46c5d 100755 --- a/ts-guest-destroy +++ b/ts-guest-destroy @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($ho,$gho) = ts_get_host_guest(@ARGV); sub destroy () { diff --git a/ts-guest-localmigrate b/ts-guest-localmigrate index 4872b1c1..688a7362 100755 --- a/ts-guest-localmigrate +++ b/ts-guest-localmigrate @@ -3,11 +3,11 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; our %timeout= qw(Migrate 400); -readconfig(); -opendb_state(); +tsreadconfig(); our $reps= 1; diff --git a/ts-guest-migrate b/ts-guest-migrate index f804f6fa..9b68be52 100755 --- a/ts-guest-migrate +++ b/ts-guest-migrate @@ -3,11 +3,12 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; our %timeout= qw(Migrate 400); -readconfig(); -opendb_state(); +tsreadconfig(); + our $sho = selecthost($ARGV[0]); our $dho = selecthost($ARGV[1]); our $gho = selectguest($ARGV[2],$sho); diff --git a/ts-guest-saverestore b/ts-guest-saverestore index e3d50f65..1fe929c0 100755 --- a/ts-guest-saverestore +++ b/ts-guest-saverestore @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($ho,$gho) = ts_get_host_guest(@ARGV); sub save () { diff --git a/ts-guest-start b/ts-guest-start index 464f580b..314134e6 100755 --- a/ts-guest-start +++ b/ts-guest-start @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($ho,$gho) = ts_get_host_guest(@ARGV); sub start () { diff --git a/ts-guest-stop b/ts-guest-stop index 13799560..d8f26c3c 100755 --- a/ts-guest-stop +++ b/ts-guest-stop @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($ho,$gho) = ts_get_host_guest(@ARGV); sub stop () { diff --git a/ts-guests-nbd-mirror b/ts-guests-nbd-mirror index 7fda5c74..5ef3fc82 100755 --- a/ts-guests-nbd-mirror +++ b/ts-guests-nbd-mirror @@ -1,12 +1,11 @@ #!/usr/bin/perl -w - use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our ($srvhost,$clthost,@gns) = @ARGV; diff --git a/ts-host-fail b/ts-host-fail index 46e52902..918e25b1 100755 --- a/ts-host-fail +++ b/ts-host-fail @@ -3,9 +3,9 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our ($whhost) = @ARGV; our $ho= selecthost($whhost); diff --git a/ts-host-powercycle b/ts-host-powercycle index ff5fc2bf..974a34f7 100755 --- a/ts-host-powercycle +++ b/ts-host-powercycle @@ -3,9 +3,9 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); my $only; if (@ARGV && $ARGV[0] =~ m/^--power=([01])$/) { diff --git a/ts-host-reboot b/ts-host-reboot index 8f04db1c..354915ef 100755 --- a/ts-host-reboot +++ b/ts-host-reboot @@ -3,9 +3,9 @@ use strict qw(vars); use Osstest; use DBI; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our ($whhost) = @ARGV; $whhost ||= 'host'; diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive index b2b80467..8d0bebf8 100755 --- a/ts-hosts-allocate-Executive +++ b/ts-hosts-allocate-Executive @@ -7,8 +7,9 @@ use Data::Dumper; use POSIX; use JSON; use IO::Handle; +use Osstest::TestSupport; -readconfig(); +tsreadconfig(); opendb_state(); open DEBUG, ">/dev/null" or die $!; diff --git a/ts-kernel-build b/ts-kernel-build index a2bb2c53..257df389 100755 --- a/ts-kernel-build +++ b/ts-kernel-build @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($whhost) = @ARGV; $whhost ||= 'host'; our $ho= selecthost($whhost); diff --git a/ts-leak-check b/ts-leak-check index 8915b6ef..ea9e3b09 100755 --- a/ts-leak-check +++ b/ts-leak-check @@ -3,9 +3,9 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our ($mode, $whhost) = @ARGV; our $ho= selecthost($whhost); diff --git a/ts-logs-capture b/ts-logs-capture index 89aa5b07..b325058f 100755 --- a/ts-logs-capture +++ b/ts-logs-capture @@ -5,9 +5,9 @@ use Osstest; use DBI; use IO::File; use POSIX; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our ($whhost) = @ARGV; $whhost ||= 'host'; diff --git a/ts-redhat-install b/ts-redhat-install index 4e2fb21e..daf0c19a 100755 --- a/ts-redhat-install +++ b/ts-redhat-install @@ -3,9 +3,9 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our $stage=0; if (@ARGV && $ARGV[0] =~ m/^--stage(\d+)$/) { $stage=$1; shift @ARGV; } diff --git a/ts-remus-check b/ts-remus-check index 67bbc772..60334fdf 100755 --- a/ts-remus-check +++ b/ts-remus-check @@ -3,9 +3,10 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); my $gn= pop(@ARGV); our @ho= map { selecthost($_) } @ARGV; our $gho= selectguest($gn,$ho[0]); diff --git a/ts-remus-start b/ts-remus-start index 61b2a056..5594e233 100755 --- a/ts-remus-start +++ b/ts-remus-start @@ -3,11 +3,12 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; our %timeout= qw(Migrate 400); -readconfig(); -opendb_state(); +tsreadconfig(); + our $sho = selecthost($ARGV[0]); our $dho = selecthost($ARGV[1]); our $gho = selectguest($ARGV[2],$sho); diff --git a/ts-windows-install b/ts-windows-install index 3a6393f6..ccc0e507 100755 --- a/ts-windows-install +++ b/ts-windows-install @@ -3,9 +3,9 @@ use strict qw(vars); use DBI; use Osstest; +use Osstest::TestSupport; -readconfig(); -opendb_state(); +tsreadconfig(); our ($whhost) = @ARGV; $whhost ||= 'host'; diff --git a/ts-xen-build b/ts-xen-build index a657dcef..fa40cbcf 100755 --- a/ts-xen-build +++ b/ts-xen-build @@ -5,9 +5,10 @@ use DBI; use Osstest; use File::Path; use POSIX; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($whhost) = @ARGV; $whhost ||= 'host'; our $ho= selecthost($whhost); diff --git a/ts-xen-build-check b/ts-xen-build-check index 8bed45c6..29414e5c 100755 --- a/ts-xen-build-check +++ b/ts-xen-build-check @@ -1,7 +1,9 @@ #!/usr/bin/perl -w use Osstest; -readconfig(); +use Osstest::TestSupport; + +tsreadconfig(); die if @ARGV && $ARGV[0] =~ m/^-/; diff --git a/ts-xen-build-prep b/ts-xen-build-prep index 1caea0f8..a6251a90 100755 --- a/ts-xen-build-prep +++ b/ts-xen-build-prep @@ -4,9 +4,10 @@ use strict qw(vars); use DBI; use Osstest; use POSIX; +use Osstest::TestSupport; + +tsreadconfig(); -readconfig(); -opendb_state(); our ($whhost) = @ARGV; $whhost ||= 'host'; our $ho= selecthost($whhost); diff --git a/ts-xen-install b/ts-xen-install index 0475fa52..5ee97af7 100755 --- a/ts-xen-install +++ b/ts-xen-install @@ -5,12 +5,12 @@ use DBI; use Osstest; use File::Path; use POSIX; -use OsstestDebian; +use Osstest::Debian; +use Osstest::TestSupport; my $checkmode= 0; -readconfig(); -opendb_state(); +tsreadconfig(); our @hos; -- 2.39.5