[Tools 1/2] winetest: Get the work directory directly from the web server.

Francois Gouget fgouget at codeweavers.com
Wed Jun 7 04:07:22 CDT 2017


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

The goal of this patchset is to remove the need for winetest.conf's 
$workdir setting. This is one more step towards making it unnecessary to 
edit winetest.conf (which is checked into Git).

NOTE: This patch requires modifying the web server configuration to make
      sure $::workdir is set. vhost_winetest.conf shows how to do it for 
      Apache.

 winetest/vhost_winetest.conf | 1 +
 winetest/winetest.cgi        | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/winetest/vhost_winetest.conf b/winetest/vhost_winetest.conf
index 797aac3f..6d72ccc3 100644
--- a/winetest/vhost_winetest.conf
+++ b/winetest/vhost_winetest.conf
@@ -17,6 +17,7 @@
     BEGIN
     {
       unshift @INC, "/home/wine/tools/winetest";
+      $::workdir = "/home/winehq/sites/winetest";
     }
   </Perl>
 
diff --git a/winetest/winetest.cgi b/winetest/winetest.cgi
index 9a4ad717..a2aebef7 100755
--- a/winetest/winetest.cgi
+++ b/winetest/winetest.cgi
@@ -18,7 +18,7 @@
 
 use strict;
 use warnings;
-use vars qw/$workdir $maxfilesize/;
+use vars qw/$maxfilesize/;
 
 BEGIN {
     require "winetest.conf";
@@ -29,7 +29,7 @@ use File::Temp qw(tempdir);
 use CGI qw(:standard);
 # Cater for some overhead
 $CGI::POST_MAX = $maxfilesize + 1024;
-$ENV{TMPDIR} = "$workdir/queue";
+$ENV{TMPDIR} = "$::workdir/queue";
 
 my $name = param ("reportfile");
 my $error = cgi_error ();
@@ -47,7 +47,7 @@ sub move_file($)
 {
     my ($filename) = @_;
     my $orig = tmpFileName($filename);
-    my $tmpdir = tempdir ("repXXXXX", DIR => "$workdir/queue");
+    my $tmpdir = tempdir ("repXXXXX", DIR => "$::workdir/queue");
     chmod 0777, $tmpdir;
     chmod 0666&~umask, $orig;
     my $size = -s $orig;
-- 
2.11.0




More information about the wine-patches mailing list