diff options
author | dac <qt-info@nokia.com> | 2010-06-23 10:23:55 +1000 |
---|---|---|
committer | dac <qt-info@nokia.com> | 2010-06-23 10:23:55 +1000 |
commit | c69be1c39ae26098a2cb171e101bc44834e14308 (patch) | |
tree | dc1d6d75d2000e42f9537088b8e2853fc3551fa9 /scripts | |
parent | def40661e36f07ad5d8c6dad7c152ae80bb7956a (diff) |
Use storetest.pl with Linux as well as Windows. Use similar filename
structure for uploaded test results to what was used previously.
Diffstat (limited to 'scripts')
-rwxr-xr-x[-rw-r--r--] | scripts/storetest.pl | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/scripts/storetest.pl b/scripts/storetest.pl index c477d4f..77e486f 100644..100755 --- a/scripts/storetest.pl +++ b/scripts/storetest.pl @@ -1,4 +1,4 @@ -#!/bin/perl +#!/usr/bin/perl use File::Basename; use File::Temp; @@ -16,6 +16,12 @@ sub prompt { return $input; } +sub sanitizedForFilename { + my ($text) = @_; + $text =~ s/[^a-zA-Z0-9\-_\.]/_/g; + return $text; +} + if (`scp 2>&1` eq "") { die "ERROR: Check for scp failed - is it in PATH?\n"; } @@ -47,8 +53,14 @@ $TEMPDIR=($ENV{TMP} or $ENV{TMPDIR}); $RESULTSDIR=catfile($TEMPDIR, "qtuitest_results_$TIMESTAMP"); $RESULTSFILE=catfile($RESULTSDIR, "$TESTNAME.xml"); -$UPLOADFILENAME="qtuitest_upload_$TIMESTAMP.xml"; + +($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime($TIMESTAMP); +$datefmt = sprintf "%04u-%02u-%02u", $year+1900, $mon+1, $mday; +$timefmt = sprintf "%02u:%02u:%02u", $hour, $min, $sec; + +$UPLOADFILENAME=sanitizedForFilename("result_qtuitest_WITH_$TESTPLATFORM" . "_AT_$HOSTNAME" . "_ON_$datefmt" . "_$timefmt" . "_USING_$TESTBRANCH.xml"); $UPLOADFILE=catfile($RESULTSDIR, $UPLOADFILENAME); + mkdir $RESULTSDIR; print("Results directory is $RESULTSDIR\n"); @@ -57,10 +69,6 @@ system "qtuitestrunner $args -xml -o $RESULTSFILE"; -e $RESULTSFILE or die "ERROR: Results file $RESULTSFILE does not exist!"; print "upload file is $UPLOADFILE\n"; -($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = gmtime($TIMESTAMP); -$datefmt = sprintf "%04u-%02u-%02u", $year+1900, $mon+1, $mday; -$timefmt = sprintf "%02u:%02u:%02u", $hour, $min, $sec; - $header = <<EOF; <?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> <Testrun> @@ -78,6 +86,8 @@ open XMLOUT, ">$UPLOADFILE"; print XMLOUT $header; open XMLIN, "<$RESULTSFILE"; @results = <XMLIN>; +shift @results; +print XMLOUT "\n<!-- file 1 of 1: $RESULTSFILE -->\n"; print XMLOUT @results; print XMLOUT $footer; close XMLIN; |