summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius.storm-olsen@nokia.com>2012-06-05 22:29:43 +0200
committerMarius Storm-Olsen <marius.storm-olsen@nokia.com>2012-06-06 14:15:27 +0200
commit2615b78317409f7971b340f907eaface423e107f (patch)
tree516bab2d5ab685bf6612dce54cb5cc4aa2441783
parent2ca7869512388b7e3375872825b28e1e9a4e1c59 (diff)
Added working form for testing packages
-rw-r--r--CGI/FormBuilder/Mail/reltestmailer.pm191
-rw-r--r--css/reltest.css3
-rwxr-xr-xindex.pl73
-rwxr-xr-xrelease-testing43
-rw-r--r--reltest-form.conf448
5 files changed, 715 insertions, 43 deletions
diff --git a/CGI/FormBuilder/Mail/reltestmailer.pm b/CGI/FormBuilder/Mail/reltestmailer.pm
new file mode 100644
index 0000000..716d919
--- /dev/null
+++ b/CGI/FormBuilder/Mail/reltestmailer.pm
@@ -0,0 +1,191 @@
+#---------------------------------------------------------------------------------------------------
+# Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+# Contact: http://www.qt-project.org/
+#
+# You may use this file under the terms of the 3-clause BSD license.
+# See the file LICENSE from this package for details.
+#
+# Following Perl modules are needed
+# CGI::FormBuilder
+# CGI::FormBuilder::Source::File
+# CGI::FormBuilder::Mail::FormatMultiPart
+#---------------------------------------------------------------------------------------------------
+
+package CGI::FormBuilder::Mail::reltestmailer;
+
+use strict;
+use warnings;
+use Data::Dumper;
+
+require MIME::Types; # for MIME::Lite's AUTO type detection - required
+require MIME::Lite;
+
+our $VERSION = 1.000006;
+
+use English '-no_match_vars;';
+
+use CGI::FormBuilder::Util;
+use CGI::FormBuilder::Field;
+
+use Regexp::Common qw( net );
+
+sub new {
+ my $class = shift;
+ my $self = { @_ };
+
+ bless $self, $class;
+ return $self;
+}
+
+sub mailresults {
+ my ($self) = @_;
+
+ my $form = $self->{form};
+ puke "No CGI::FormBuilder passed as form arg"
+ if !$form || !$form->isa('CGI::FormBuilder');
+
+ my ($subject, $to, $cc, $bcc, $from, $smtp )
+ = @{$self}{qw( subject to cc bcc from smtp )};
+
+ puke "Address/subject args should all be scalars"
+ if scalar grep { defined && ref }
+ ( $to, $from, $smtp, $cc, $bcc, $subject );
+
+ puke "Cannot send mail without to, from, and smtp args"
+ if !$to || !$from || !$smtp;
+
+ puke "arg 'smtp' in bad format"
+ if !( $smtp eq 'localhost'
+ || $smtp =~ m{ \A $RE{net}{domain}{-nospace} \z }xms
+ || $smtp =~ m{ \A $RE{net}{IPv4} \z }xms
+ )
+ ;
+
+ # let MIME::Lite check e-mail address or address list format
+ # (VALIDATE pattern for multiple addresses too much of a pain)
+
+ my ($format, $skipfields, $skip ) = @{$self}{qw( format skipfields skip )};
+
+ # set up a hash of the individual CGI::FormBuilder::Field objects and
+ # put it into $self to pass around. it's useful.
+ my $fbflds = $self->{_fbflds} = { map { ( "$_" => $_ ) } $form->field };
+
+ my $msg = undef;
+ my %msg_args = (
+ From => $from,
+ To => $to,
+ Subject => $subject,
+ Type => "text/plain",
+ );
+ $msg_args{Cc} = $cc if defined $cc;
+ $msg_args{Bcc} = $bcc if defined $bcc;
+
+ $msg_args{Data} = $self->format_content();
+ $msg = MIME::Lite->new( %msg_args );
+
+ my $success = eval $msg->send_by_smtp( $smtp );
+# my $success = eval $msg->print(\*STDOUT);
+
+ if ($EVAL_ERROR || !$success) {
+ puke("Could not send mail. $EVAL_ERROR");
+ }
+
+ return;
+}
+
+sub format_content
+{
+ my ($self) = @_;
+
+ my $text = '';
+
+ my $data_form = $self->_data_form();
+
+ my $maxlen = 0;
+ for (@{$data_form}[ 1 .. $#{$data_form} ]) {
+ my @data = @{$_};
+ $maxlen = length($data[0]) if (length($data[0]) > $maxlen);
+ }
+
+ # +12 for column spacing and 'DD/MM/YYYY'
+ my $sep = '-' x ($maxlen + 12);
+
+ for (@{$data_form}[ 1 .. $#{$data_form} ]) {
+ my @data = @{$_};
+ if ($data[0] eq 'Comments') {
+ $text .= "$data[0]:\n$data[1]\n\n";
+ } elsif ($data[1] eq '') {
+ $data[0] =~ s/\<hr\>/$sep\n/;
+ $data[0] =~ s/\<\S+\>//g;
+ $text .= $data[0] . "\n$sep\n";
+ } else {
+ $data[0] =~ s/\<\S+\>//g;
+ $text .= "$data[0]:" . (' ' x ($maxlen - length($data[0]))) . " $data[1]\n";
+ }
+ }
+
+ my $http_host = $ENV{'HTTP_HOST'};
+ my $request_uri = $ENV{'REQUEST_URI'};
+ my $remote_addr = $ENV{'REMOTE_ADDR'};
+ $text .= "\n-- \nReport";
+ $text .= " form at http://$http_host$request_uri" if (defined $http_host && defined $request_uri);
+ $text .= " submitted from $remote_addr" if (defined $remote_addr);
+ $text .= " from unknown source" if (!defined $request_uri && !defined $remote_addr);
+ $text .= "\n";
+
+ return $text;
+}
+
+sub _data_resolve_options {
+ my ($self, $name, @options) = @_;
+ my @result;
+
+ my $form = $self->{'form'};
+ my $opts = $form->{'fieldopts'}->{$name}->{'options'};
+ return @result if (!defined $opts);
+
+ # Options are arrays of arrays
+ my %hash;
+ foreach my $item (@{$opts}) {
+ $hash{@{$item}[0]} = @{$item}[1];
+ }
+ foreach my $val (@options) {
+ push @result, $hash{$val};
+ }
+ return @result;
+}
+
+sub _data_form {
+ my ($self) = @_;
+ my ($form, $fbflds) = @{$self}{qw( form _fbflds )};
+ my @field_names = $form->fields;
+
+ my $data = [
+ [ 'Field' => 'Value' ]
+ ];
+
+ FIELD:
+ foreach my $name ( @field_names ) {
+ next FIELD if $fbflds->{$name}->type eq 'file';
+ my @values = $form->field($name);
+ @values = $self->_data_resolve_options($name, @values)
+ if(defined $form->{'fieldopts'}->{$name}->{'options'});
+ my $value = join(", ",@values);
+ $value = '' if (!$value);
+
+ my $labels = $form->{'fieldopts'}->{$name}->{'label'};
+ my $label = $labels;
+ if (ref($labels) eq 'ARRAY') {
+ $label = join (', ', @{$labels});
+ }
+ $label = $name if ($label eq '');
+
+ push @{$data}, [ $label => $value ];
+ }
+
+ # cache in self
+ $self->{_data_form} = $data;
+ return $data;
+}
+
+1;
diff --git a/css/reltest.css b/css/reltest.css
new file mode 100644
index 0000000..2826f59
--- /dev/null
+++ b/css/reltest.css
@@ -0,0 +1,3 @@
+.reltest_comment {
+ color: #ff0000;
+} \ No newline at end of file
diff --git a/index.pl b/index.pl
new file mode 100755
index 0000000..69d4f07
--- /dev/null
+++ b/index.pl
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+
+#---------------------------------------------------------------------------------------------------
+# Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+# Contact: http://www.qt-project.org/
+#
+# You may use this file under the terms of the 3-clause BSD license.
+# See the file LICENSE from this package for details.
+#
+# Following Perl modules are needed
+# CGI::FormBuilder
+# CGI::FormBuilder::Source::File
+# CGI::FormBuilder::Mail::FormatMultiPart
+#---------------------------------------------------------------------------------------------------
+
+# Add current dir to be able to load our own custom mailer 'reltestmailer'
+use Cwd;
+push @INC, cwd;
+
+use POSIX qw(strftime);
+use CGI::FormBuilder;
+use Data::Dumper;
+
+sub meaning
+{
+ my ($form, $field_name) = @_;
+
+ my $val = $form->field->{$field_name};
+ return $val if (!defined $form->{'fieldopts'}->{$field_name}->{'options'});
+
+ my $result = "Not tested";
+ $result = "Yes" if ($val = 2);
+ $result = "No" if ($val = 1);
+ return $result;
+}
+
+# First create our form
+my $form = CGI::FormBuilder->new(source => 'reltest-form.conf');
+
+# Check to see if we're submitted and valid
+if ($form->submitted && $form->validate) {
+
+ our $field = $form->fields;
+
+ # Translate options over to values
+ our %result;
+ for my $val (keys %{$field}) {
+ $result{$val} = meaning($form, $val);
+ }
+
+ # Show confirmation screen
+ print $form->confirm(header => 1);
+
+ # Mail off a copy to the mailing list
+ $form->mailresults(plugin => 'reltestmailer',
+ from => $field->{'report_name'} . '<releasing@qt-project.org>',
+ to => 'Releases Mailing List <releasing@qt-project.org>',
+ smtp => 'mx.qt-project.org',
+ subject => "Testing: $field->{'package_date'} + $field->{'mkspec_used'} " .
+ ($field->{'releasable'} == 2 ? '[success!]' : '[fail]')
+ );
+} else {
+ # Auto-fill with today's date
+
+ my $now = strftime("%d/%m/%Y", localtime);
+ $form->field(name => 'report_date',
+ value => $now);
+ $form->field(name => 'package_date',
+ value => $now);
+
+ # Print out the form
+ print $form->render(header => 1);
+}
diff --git a/release-testing b/release-testing
deleted file mode 100755
index 02fc261..0000000
--- a/release-testing
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/perl
-
-use CGI::FormBuilder;
-
-# First create our form
-my $form = CGI::FormBuilder->new(
- name => 'acctinfo',
- method => 'post',
- stylesheet => '/path/to/style.css'
- );
-
-# Now create form fields, in order
-# FormBuilder will automatically determine the type for you
-$form->field(name => 'fname', label => 'First Name');
-$form->field(name => 'lname', label => 'Last Name');
-
-# Setup gender field to have options
-$form->field(name => 'gender',
- options => [qw(Male Female)] );
-
-# Include validation for the email field
-$form->field(name => 'email',
- size => 60,
- validate => 'EMAIL',
- required => 1);
-
-# And the (optional) phone field
-$form->field(name => 'phone',
- size => 10,
- validate => '/^1?-?\d{3}-?\d{3}-?\d{4}$/',
- comment => '<i>optional</i>');
-
-# Check to see if we're submitted and valid
-if ($form->submitted && $form->validate) {
- # Get form fields as hashref
- my $field = $form->fields;
-
- # Show confirmation screen
- print $form->confirm(header => 1);
-} else {
- # Print out the form
- print $form->render(header => 1);
-}
diff --git a/reltest-form.conf b/reltest-form.conf
new file mode 100644
index 0000000..2623e10
--- /dev/null
+++ b/reltest-form.conf
@@ -0,0 +1,448 @@
+# Basics ------------------------------------------------------------------------------------------
+enctype: multipart/form-data
+method: POST
+header: 1
+reset: 1
+title: Release Testing Form
+
+# CSS ----------------------------------------------------------------------------------------------
+styleclass: reltest
+stylesheet: css/reltest.css
+
+# Fields -------------------------------------------------------------------------------------------
+fields:
+ report_date:
+ label: Report Date
+ type: date
+ size: 10
+ required: 1
+ validate: DATE
+ comment: <i>DD/MM/YYYY</i>
+
+ report_name:
+ label: Reporters Name
+ size: 40
+ required: 1
+ sticky: 1
+
+ package_date:
+ label: Package/Build date
+ type: date
+ size: 10
+ required: 1
+ validate: DATE
+ comment: <i>DD/MM/YYYY</i>
+
+ package_name:
+ label: Package name
+ size: 40
+ required: 1
+
+ package_type:
+ label: Package type
+ options: S=Source, IOff=Installer (Offline), IOn=Installer (Online)
+ multiple: 1
+ required: 1
+
+ mkspec_used:
+ label: Mkspec used
+ size: 40
+ required: 1
+
+ # ----------------------------------------------------------------------------------------------
+ ccheck_label:
+ label: <hr><h4>Build checks:</h4>
+ type: static
+
+ configure_checks:
+ label: Asks about license
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(when run without any license options)</i>
+
+ minimal_options:
+ label: Compiles with minimal options
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(eg. -opensource -confirm-license)</i>
+
+ static_build:
+ label: Compiles as static build (where supported)
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ namespace_build:
+ label: Compiles in namespace (where supported)
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ shadow_build:
+ label: Compiles with shadow build,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ xcompile:
+ label: Compiles cross-compiled (where supported)
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ build_comments:
+ label: Comments
+ type: textarea
+ cols: 60
+ rows: 15
+
+ # ----------------------------------------------------------------------------------------------
+ gcheck_label:
+ label: <hr><h4>General checks:</h4>
+ type: static
+
+ eols:
+ label: Text files have the correct EOL
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(for the type of package)</i>
+
+ permissions:
+ label: Files/dirs have sane perm. and timestamps
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ tags:
+ label: Tags have been replaced properly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(eg. %VERSION% & %SHORTVERSION%)</i>
+
+ readme:
+ label: README has valid information
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(for the platform tested)</i>
+
+ general_comments:
+ label: Comments
+ type: textarea
+ cols: 60
+ rows: 15
+
+ # ----------------------------------------------------------------------------------------------
+ icheck_label:
+ label: <hr><h4>Installer checks:</h4>
+ type: static
+
+ fresh:
+ label: Fresh install works correctly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ upgrave:
+ label: Upgrade install works correctly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ parallel:
+ label: Parallel install works correctly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ previnstall:
+ label: Previously installed package still works
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ warns:
+ label: Warns when installing over an installation
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ signed:
+ label: Is correctly signed
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(vendor/certificate, not untrusted)</i>
+
+ display:
+ label: Displays appropriate gfx & strings & version no.
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ licenses:
+ label: Offers the correct license(s)
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ defaultdir:
+ label: Offers sane default install directory
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(w/version number)</i>
+
+ instdefaultdir:
+ label: Correctly installs to default directory
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ instdir:
+ label: Correctly installs to non-default loc.
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(drive/directory)</i>
+
+ progress:
+ label: Sanely reports progress and completion
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ components:
+ label: Installs only selected components
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ compselector:
+ label: Component selector works sanely
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ shortcuts:
+ label: Shortcuts from last page of installer works
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ desktopshortcuts:
+ label: Correctly creates Desktop shortcuts
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ startmenu:
+ label: Correctly creates Start Menu shortcuts
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ environment:
+ label: Sets correct environment variables for shell
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ controlpanel:
+ label: Package shows up in Control Panel/Pkg. Manager
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(Check for Vendor name and correct Version)</i>
+
+ patching:
+ label: Patching of files is done correctly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ cancel:
+ label: Cancel button is available
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ cleanfail:
+ label: Cleans up after install failure
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ spacefail:
+ label: Cleanly fails on insufficient disk space
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ installer_comments:
+ label: Comments
+ type: textarea
+ cols: 60
+ rows: 15
+
+
+ # ----------------------------------------------------------------------------------------------
+ ucheck_label:
+ label: <hr><h4>Uninstaller checks:</h4>
+ type: static
+
+ uninstall:
+ label: Uninstalls properly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ removefiles:
+ label: Removes installed files properly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ removedirs:
+ label: Removes empty directories
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ removeregs:
+ label: Removes registry keys
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ revchanges:
+ label: Reverses any other changes
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ uninstaller_comments:
+ label: Comments
+ type: textarea
+ cols: 60
+ rows: 15
+
+
+ # ----------------------------------------------------------------------------------------------
+ pcheck_label:
+ label: <hr><h4>Both source/binary package checks:</h4>
+ type: static
+
+ license:
+ label: License is correct
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ assistant:
+ label: Assistant works correctly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ designer:
+ label: Designer works correctly
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ nocrash:
+ label: Demos and examples launch without crashing
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ funcaccept:
+ label: Demos and examples function acceptably
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ rebuild:
+ label: Demos and examples can be rebuilt
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ extapps:
+ label: External apps build
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(Qt Creator and other applications)</i>
+
+ dllswap:
+ label: "DLL Swapping" work on an application
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(Testing for BC)</i>
+
+ guistress:
+ label: GUI stress-testing works ok
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+ comment: <i>(clicking around randomly, for example)</i>
+
+# Old version, which is going to be removed from qt5.git, and only provided as an addon
+# phonon:
+# label: Audio/Video w/phonon works
+# options: 2=Yes, 1=No, 0=Not tested
+# value: 0
+
+ multimedia:
+ label: Audio/Video w/QtMultimedia works
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ raster:
+ label: Raster engine works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ imgformat:
+ label: Image formats work,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ gv:
+ label: GraphicsView works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ opengl:
+ label: OpenGL works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ printing:
+ label: Printing works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ qml1:
+ label: QML 1 apps work (qmlviewer)
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ qml2:
+ label: QML 2 apps work (qmlscene)
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ networking:
+ label: QtNetwork works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ sql:
+ label: QtSql works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ svg:
+ label: QtSvg works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ xml:
+ label: QtXml works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ webkit1:
+ label: QtWebKit 1 works,
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ webkit2:
+ label: QtWebkit 2 works
+ options: 2=Yes, 1=No, 0=Not tested
+ value: 0
+
+ test_comments:
+ label: Comments
+ type: textarea
+ cols: 60
+ rows: 15
+
+# Cannot get the file attachment to work properly in the emails sent out, feel free to fix this
+# screenshot:
+# label: Screenshot
+# type: file
+# growable: 1
+
+ # ----------------------------------------------------------------------------------------------
+# releasable_label:
+# label: <hr><h4>Releasable?</h4>
+# type: static
+
+ releasable:
+ label: <B>Is this package releasable?</B>
+ options: 2=Yes, 1=No
+ required: 1
+ comment: <i>(in your opinion)</i>
+