Module: tools
Branch: master
Commit: 063320d223569d9be83d5a0f72ec4d400a8d6a72
URL: http://source.winehq.org/git/tools.git/?a=commit;h=063320d223569d9be83d5a0f…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Jul 24 16:31:40 2014 +0200
winetest: Whitespace cleanups.
---
winetest/dissect | 8 ++++----
winetest/error.cgi | 3 +--
winetest/gather | 2 +-
winetest/service.cgi | 8 ++++----
winetest/site | 2 +-
5 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/winetest/dissect b/winetest/dissect
index bbd156b..676f089 100755
--- a/winetest/dissect
+++ b/winetest/dissect
@@ -82,7 +82,7 @@ sub create_box($$$)
return $box;
}
-($report,undef) = glob "$queuedir/rep*/report";
+($report, undef) = glob "$queuedir/rep*/report";
exit 2 unless defined $report;
($tmpdir = $report) =~ s|^(.+)/report$|$1|;
@@ -206,7 +206,7 @@ if ($plid==1 && $major==4) {
} elsif ($minor == 2) {
$version = "win8";
}
- }
+ }
} elsif ($plid==3) {
#$version = "ce$major$minor";
}
@@ -340,9 +340,9 @@ while (<IN>) {
if (defined $dll) {
# Either winetest crashed or the report file was cut off
if ($filesize == $maxfilesize) {
- mydie "report reached file limit (runaway test?)\n";
+ mydie "report reached file limit (runaway test?)\n";
} else {
- mydie "report truncated (winetest crash?)\n";
+ mydie "report truncated (winetest crash?)\n";
}
}
close SUM or mydie "error writing to '$tmpdir/summary.txt': $!\n";
diff --git a/winetest/error.cgi b/winetest/error.cgi
index b9692ac..ea77204 100755
--- a/winetest/error.cgi
+++ b/winetest/error.cgi
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-#
+#
# This script replays errors to the wine-tests-results mailing list
#
# Copyright (C) 2004 Brian Vincent
@@ -43,4 +43,3 @@ if ($error) {
print "OK\n";
}
-
diff --git a/winetest/gather b/winetest/gather
index f469fb1..5b56b61 100755
--- a/winetest/gather
+++ b/winetest/gather
@@ -513,7 +513,7 @@ sub singletest($$$) {
else
{
my $report = $group->{reports} ? $group->{reports}->[0] : $group;
- $label = "$groupname $report->{tag}";
+ $label = "$groupname $report->{tag}";
if (-r "$datadir/$build/$report->{dir}/$testname.html")
{
$href = "$report->{dir}/$testname.html";
diff --git a/winetest/service.cgi b/winetest/service.cgi
index 10e3c18..53e5f10 100755
--- a/winetest/service.cgi
+++ b/winetest/service.cgi
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-#
+#
# This script acts as the middle man between people who build
# tests to be distributed to Windows clients and the actual
# Windows clients
@@ -32,8 +32,8 @@
# winetest/
# <name>.url contains url to find latest winetests at, must be
# writable
-# url.mask contains a reg ex to match against, only needs to
-# be read-only, in the above example it might be
+# url.mask contains a reg ex to match against, only needs to
+# be read-only, in the above example it might be
# something like: http://myserver/com/path/to
# <name>.cookie contains a unique identifier of a program that
# winrash clients can download, must be writable
@@ -99,7 +99,7 @@ sub read_one_line($)
##########################################################################
#
# When we publish, we:
-# 1) Look for <publish key value>/url.mask that had to have been
+# 1) Look for <publish key value>/url.mask that had to have been
# created by a web server admin thus ensuring this program is
# approved for testing
# 2) Download the cookie for the program from that web server
diff --git a/winetest/site b/winetest/site
index a942491..16ab682 100755
--- a/winetest/site
+++ b/winetest/site
@@ -54,6 +54,6 @@ if ($q->param('testing')) {
# redirect to data dir when no vars present
my $base = $q->url(-base => 1);
print $q->redirect($base . "/data/" . $build);
-
+
# done
exit();
Module: tools
Branch: master
Commit: 991c6c6eb454252342ed5d8d9a56f3966bddd453
URL: http://source.winehq.org/git/tools.git/?a=commit;h=991c6c6eb454252342ed5d8d…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Thu Jul 24 16:24:01 2014 +0200
winetest: Standardize handling of service.cgi's arguments and add prototypes.
The prototypes let Perl detect when the wrong number of parameters is passed to these functions.
The functions have also been reordered so forward declarations are not necessary and are now called normally.
---
winetest/service.cgi | 196 ++++++++++++++++++++++++++++-----------------------
1 file changed, 107 insertions(+), 89 deletions(-)
diff --git a/winetest/service.cgi b/winetest/service.cgi
index 1ec83b6..10e3c18 100755
--- a/winetest/service.cgi
+++ b/winetest/service.cgi
@@ -46,57 +46,56 @@ $data_root="/home/winehq/opt/winetest";
$lynx="/usr/bin/lynx";
@valid_programs=("winrash", "winetest");
-&main;
-sub main {
- my ($build, $urls, $cookies);
-
- print "Content-type: text/plain\n\n";
+##########################################################################
+#
+# Some convenience functions. Debug gives us output if debug=1. &read_one_line
+# just opens files and returns one line, with trailing new lines removed.
+#
+##########################################################################
- # first check for errors
- my $error = cgi_error ();
- if ($error) {
- print $error;
- exit;
+# print a message if debugging is enabled
+sub debug($)
+{
+ my ($msg) = @_;
+ if (param('debug')) {
+ print "$msg\n";
}
+}
- my $publish = param('publish');
- if ($publish) {
- my $response = &releases_make($publish);
- print "$response\n";
- exit;
- }
+# computes the MD5 sum of the arument
+sub md5sum($)
+{
+ my ($string) = @_;
+ local $md5 = Digest::MD5->new;
+ $md5->add($string);
+ return $md5->hexdigest;
+}
- # for each of the programs we know about, see if they need an update
- foreach $program (@valid_programs) {
- ($build, $urls, $cookies) = &releases_read($program);
- if (param($program)) {
- my @history = split(/,/, param("$program" . "_history"));
- push (@history, param($program));
- my @newhist = ();
- foreach (@history) {
- my ($prg, $rel) = split(/-/, $_);
- if (($prg eq $program) and ($rel eq $build)) {
- delete $$urls{$_};
- delete $$cookies{$_};
- push (@newhist, $_);
- }
- }
- $winetest_history = join ',', @newhist;
- }
- if (scalar(%$urls)) {
- &send_upgrade($urls, $winetest_history);
- $update_sent = 1;
- last;
- }
- }
- if (!$update_sent) {
- print "sleep 3600\n";
- return;
- }
+# write a string to a file
+sub write_file($$)
+{
+ my ($filename, $content) = @_;
+ open(GENERIC_FH, $filename)
+ or ( debug("Can't open $filename for writing.") && die );
+ print GENERIC_FH $content;
+ close(GENERIC_FH);
+}
+# read the content of a file
+sub read_one_line($)
+{
+ my ($filename) = @_;
+ open(GENERIC_FH, $filename)
+ or ( debug("Can't open $filename."), die );
+ $this_line = <GENERIC_FH>;
+ close(GENERIC_FH);
+ chomp $this_line;
+
+ return $this_line;
}
+
##########################################################################
#
# When we publish, we:
@@ -110,7 +109,8 @@ sub main {
##########################################################################
# removes the current release from disk
-sub releases_purge {
+sub releases_purge($)
+{
my ($project) = @_;
system("rm -f $data_root/*/$project/*.cookie");
system("rm -f $data_root/*/$project/*.url");
@@ -119,7 +119,8 @@ sub releases_purge {
# this function reads the current release information from disk
# and returns ($thisrelease, %url, %cookies)
# where the two maps are keyed by the full file name of the release
-sub releases_read {
+sub releases_read($)
+{
my ($project) = @_;
my (%urls, %cookies, $thisrelease);
@@ -143,7 +144,7 @@ sub releases_read {
if (scalar(%urls) == 0) {
$thisrelease = $release;
} elsif ($thisrelease ne $release) {
- &debug("Invalid release state!") && die;
+ debug("Invalid release state!") && die;
}
$urls{$key} = $url;
$cookies{$key} = $this_line;
@@ -154,7 +155,8 @@ sub releases_read {
}
# try to add a new release to our portfolio
-sub releases_make {
+sub releases_make($)
+{
my ($url) = @_;
my ($name, $program, $build, $publisher);
my ($urls, $cookies, $current_build, @other);
@@ -186,43 +188,43 @@ sub releases_make {
}
# get current release info
- ($current_build, $urls, $cookies) = &releases_read($program);
+ ($current_build, $urls, $cookies) = releases_read($program);
# check to see how we should handle it
if ($build lt $current_build) {
return "Build is old, current build is $current_build";
}
if ($build ne $current_build) {
- &releases_purge($program);
+ releases_purge($program);
}
# check to see that the URL has the right format
$base_path = "$data_root/$publisher/$program";
- $url_mask = &read_one_line("<$base_path/url.mask");
+ $url_mask = read_one_line("<$base_path/url.mask");
if (!($url =~ $url_mask)) {
return "Unrecognized URL format";
}
# get the cookie now
- $cookie = &read_one_line("$lynx -source $url.sig |");
+ $cookie = read_one_line("$lynx -source $url.sig |");
# all is good, store the cookie, and URL now, this activetes the release
- &write_file(">$base_path/$name.cookie", &md5sum($cookie));
- &write_file(">$base_path/$name.url", $url);
+ write_file(">$base_path/$name.cookie", md5sum($cookie));
+ write_file(">$base_path/$name.url", $url);
return "OK";
}
-
##########################################################################
-#
+#
# Issue commands understood by winrash. Try to be somewhat intelligent
-# in figuring out what needs to be sent.
+# in figuring out what needs to be sent.
#
##########################################################################
-sub send_upgrade {
+sub send_upgrade($$)
+{
my ($urls, $history) = @_;
my (@names, $name, $url, $program);
my ($build, $publisher, $id, @other);
@@ -235,7 +237,7 @@ sub send_upgrade {
$url = $$urls{$name};
($program, $build, $publisher, @other) = split(/-/, $name);
- &debug("Send upgrade received: $url");
+ debug("Send upgrade received: $url");
print "error_url http://test.winehq.org/error\n";
print "error_sleep 3600\n";
@@ -262,45 +264,61 @@ sub send_upgrade {
print "sleep 300\n";
}
+
##########################################################################
#
-# Some convenience functions. Debug gives us output if debug=1. &read_one_line
-# just opens files and returns one line, with trailing new lines removed.
-#
+# Main
+#
##########################################################################
-# print a message if debugging is enabled
-sub debug {
- if (param('debug')) {
- print "$_[0]\n";
- }
-}
+sub main()
+{
+ my ($build, $urls, $cookies);
-# computes the MD5 sum of the arument
-sub md5sum {
+ print "Content-type: text/plain\n\n";
- local $md5 = Digest::MD5->new;
- $md5->add($_[0]);
- return $md5->hexdigest;
-}
+ # first check for errors
+ my $error = cgi_error ();
+ if ($error) {
+ print $error;
+ exit;
+ }
-# write a string to a file
-sub write_file {
- my ($filename, $content) = @_;
- open(GENERIC_FH, $filename)
- or ( &debug("Can't open $filename for writing.") && die );
- print GENERIC_FH $content;
- close(GENERIC_FH);
-}
+ my $publish = param('publish');
+ if ($publish) {
+ my $response = releases_make($publish);
+ print "$response\n";
+ exit;
+ }
-# read the content of a file
-sub read_one_line {
- open(GENERIC_FH, $_[0])
- or ( &debug("Can't open $_[0]."), die );
- $this_line = <GENERIC_FH>;
- close(GENERIC_FH);
- chomp $this_line;
+ # for each of the programs we know about, see if they need an update
+ foreach $program (@valid_programs) {
+ ($build, $urls, $cookies) = releases_read($program);
+ if (param($program)) {
+ my @history = split(/,/, param("$program" . "_history"));
+ push (@history, param($program));
+ my @newhist = ();
+ foreach (@history) {
+ my ($prg, $rel) = split(/-/, $_);
+ if (($prg eq $program) and ($rel eq $build)) {
+ delete $$urls{$_};
+ delete $$cookies{$_};
+ push (@newhist, $_);
+ }
+ }
+ $winetest_history = join ',', @newhist;
+ }
+ if (scalar(%$urls)) {
+ send_upgrade($urls, $winetest_history);
+ $update_sent = 1;
+ last;
+ }
+ }
+ if (!$update_sent) {
+ print "sleep 3600\n";
+ return;
+ }
- return $this_line;
}
+main();