]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
TestSupport: Move `stashed files' earlier
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 30 Nov 2018 16:39:13 +0000 (16:39 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 30 Nov 2018 16:39:13 +0000 (16:39 +0000)
We are going to make more use of this in intervening code.

Pure code motion.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index 314172811b552fe86ea3d58ea7489f38d4b03a9b..cbb7b35f40733c917093329c58a7c4ecc938672b 100644 (file)
@@ -300,6 +300,39 @@ sub get_filecontents ($;$) {
     return $data;
 }
 
+#---------- 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;
+}
+
 #---------- runvars ----------
 
 sub store_runvar ($$) {
@@ -1252,39 +1285,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 ($) {