|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 34/62] TestSupport: Move `stashed files' and `next_unique_name' earlier
We are going to make more use of this in intervening code.
Pure code motion.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
Osstest/TestSupport.pm | 78 +++++++++++++++++++++++++-------------------------
1 file changed, 39 insertions(+), 39 deletions(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 41f6f5f8..ce346097 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -300,6 +300,45 @@ sub get_filecontents ($;$) {
return $data;
}
+#---------- stashed files ----------
+
+sub next_unique_name ($) {
+ my ($fnref) = @_;
+ my $num = $$fnref =~ s/\+([1-9]\d*)$// ? $1 : 0;
+ $$fnref .= '+'.($num+1);
+}
+
+sub open_unique_stashfile ($) {
+ my ($leafref) = @_;
+ my $dh;
+ for (;;) {
+ my $df= $$leafref;
+ $dh= new IO::File "$stash/$df", O_RDWR|O_EXCL|O_CREAT;
+ last if $dh;
+ die "$df $!" unless $!==&EEXIST;
+ next_unique_name $leafref;
+ }
+ return $dh;
+}
+
+sub get_stashed ($$) {
+ my ($param, $otherflightjob) = @_;
+ # may be run outside transaction, or with flights locked
+ my ($oflight, $ojob) = otherflightjob($otherflightjob);
+ my $path= get_runvar($param, $otherflightjob);
+ die "$path $& " if
+ $path =~ m,[^-+._0-9a-zA-Z/], or
+ $path =~ m/\.\./;
+ return "$c{Stash}/$oflight/$ojob/$path";
+}
+
+sub compress_stashed($) {
+ my ($path) = @_;
+ return unless -e "$stash/$path";
+ my $r= system 'gzip','-9vf','--',"$stash/$path";
+ die "$r $!" if $r;
+}
+
#---------- runvars ----------
sub store_runvar ($$) {
@@ -597,12 +636,6 @@ sub target_file_exists ($$) {
die "$rfile $out ?";
}
-sub next_unique_name ($) {
- my ($fnref) = @_;
- my $num = $$fnref =~ s/\+([1-9]\d*)$// ? $1 : 0;
- $$fnref .= '+'.($num+1);
-}
-
our $target_editfile_cancel_exception =
bless { }, 'Osstest::TestSupport::TargetEditfileCancelException';
@@ -1369,39 +1402,6 @@ sub hostnamepath ($) {
join '_', reverse @l;
}
-#---------- stashed files ----------
-
-sub open_unique_stashfile ($) {
- my ($leafref) = @_;
- my $dh;
- for (;;) {
- my $df= $$leafref;
- $dh= new IO::File "$stash/$df", O_RDWR|O_EXCL|O_CREAT;
- last if $dh;
- die "$df $!" unless $!==&EEXIST;
- next_unique_name $leafref;
- }
- return $dh;
-}
-
-sub get_stashed ($$) {
- my ($param, $otherflightjob) = @_;
- # may be run outside transaction, or with flights locked
- my ($oflight, $ojob) = otherflightjob($otherflightjob);
- my $path= get_runvar($param, $otherflightjob);
- die "$path $& " if
- $path =~ m,[^-+._0-9a-zA-Z/], or
- $path =~ m/\.\./;
- return "$c{Stash}/$oflight/$ojob/$path";
-}
-
-sub compress_stashed($) {
- my ($path) = @_;
- return unless -e "$stash/$path";
- my $r= system 'gzip','-9vf','--',"$stash/$path";
- die "$r $!" if $r;
-}
-
#---------- other stuff ----------
sub common_toolstack ($) {
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |