summaryrefslogtreecommitdiff
path: root/scripts/lib/perl5
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-03-19 08:27:10 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-19 01:03:48 +0200
commit0f12b75c38dc39a949c8a45dfe51190df35844ca (patch)
tree2b0643fb7c45686d48650ee908abafbc0812e845 /scripts/lib/perl5
parent2e2062beced7dce396f5e1da7aca95449092324b (diff)
downloadqtqa-0f12b75c38dc39a949c8a45dfe51190df35844ca.tar.gz
Add testplanner, testscheduler.
testplanner and testscheduler implement a new way of running tests, outside of the `make' tool. Thus far, `make' has been used to run all autotests. Recently, the lack of flexibility in this approach has become apparent: it's quite difficult to have `make' do something intelligent with CONFIG+=parallel_test. Handling of CONFIG+=insignificant_test is also suboptimal. testscheduler has the immediate benefit over `make check' that it is able to correctly handle CONFIG+=parallel_test for running autotests in parallel. Change-Id: I75d3b804b90cf25271027a4226d4b64933ceb61e Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Diffstat (limited to 'scripts/lib/perl5')
-rw-r--r--scripts/lib/perl5/QtQA/QMake/t/01-QtQA-QMake-Project.t26
-rw-r--r--scripts/lib/perl5/QtQA/Test/More.pm64
2 files changed, 65 insertions, 25 deletions
diff --git a/scripts/lib/perl5/QtQA/QMake/t/01-QtQA-QMake-Project.t b/scripts/lib/perl5/QtQA/QMake/t/01-QtQA-QMake-Project.t
index df001fd..9a34a8b 100644
--- a/scripts/lib/perl5/QtQA/QMake/t/01-QtQA-QMake-Project.t
+++ b/scripts/lib/perl5/QtQA/QMake/t/01-QtQA-QMake-Project.t
@@ -12,6 +12,7 @@ use FindBin;
use lib "$FindBin::Bin/../../..";
use QtQA::QMake::Project;
+use QtQA::Test::More qw(find_qmake);
use English qw(-no_match_vars);
use File::Spec::Functions;
@@ -22,7 +23,6 @@ use Test::More;
use Test::Warn;
Readonly my $TESTDATA => catfile( $FindBin::Bin, 'test_projects' );
-Readonly my $QT_VERSION => 5;
Readonly my $QMAKE => find_qmake( );
Readonly my $ERROR_RE => qr/^QtQA::QMake::Project:/;
@@ -374,30 +374,6 @@ sub run_test
return;
}
-sub find_qmake
-{
- # Try to find the "right" qmake - not particularly easy.
- my $repo_base = catfile( $FindBin::Bin, qw(.. .. .. .. .. ..) );
- my $qmake = canonpath catfile( $repo_base, qw(.. qtbase bin qmake) );
- if ($OSNAME =~ m{win32}i) {
- $qmake .= '.exe';
- }
-
- if (-f $qmake) {
- diag "Using qmake from sibling qtbase: $qmake";
- return $qmake;
- }
-
- # OK, then just try to use qmake from PATH
- my $output = qx(qmake -v 2>&1);
- if ($? == 0 && $output =~ m{Using Qt version $QT_VERSION}) {
- diag "Using qmake from PATH";
- return 'qmake';
- }
-
- return;
-}
-
if (!caller) {
run_test;
done_testing;
diff --git a/scripts/lib/perl5/QtQA/Test/More.pm b/scripts/lib/perl5/QtQA/Test/More.pm
index 6a7a3a7..b0b118f 100644
--- a/scripts/lib/perl5/QtQA/Test/More.pm
+++ b/scripts/lib/perl5/QtQA/Test/More.pm
@@ -44,9 +44,12 @@ use strict;
use warnings;
use Carp;
+use Cwd qw(abs_path);
use Data::Dumper;
use IO::File;
use File::Basename;
+use File::Spec::Functions;
+use File::Which;
use List::MoreUtils qw( any );
use Params::Validate qw( :all );
use Readonly;
@@ -57,9 +60,12 @@ use base 'Exporter';
Readonly our @EXPORT_OK => qw(
is_or_like
create_mock_command
+ find_qmake
);
Readonly our %EXPORT_TAGS => ( all => \@EXPORT_OK );
+Readonly my $QT_VERSION => 5;
+
## no critic (Subroutines::RequireArgUnpacking)
# This policy does not work nicely with Params::Validate
@@ -264,6 +270,42 @@ die "no more test steps!\n"
return;
}
+sub find_qmake
+{
+ # Try to find the "right" qmake - not particularly easy.
+ my $this_dir = $INC{ 'QtQA/Test/More.pm' };
+ if (!$this_dir) {
+ diag "Warning: can't find QtQA/Test/More.pm in %INC. Included unusually?\n"
+ ."find_qmake() will probably fail.";
+ $this_dir = '.';
+ }
+ $this_dir = dirname( $this_dir );
+
+ my $repo_base = catfile( $this_dir, qw(.. .. .. .. ..) );
+ my $qmake = catfile( $repo_base, qw(.. qtbase bin qmake) );
+ if ($OSNAME =~ m{win32}i) {
+ $qmake .= '.exe';
+ }
+
+ if (-f $qmake) {
+ $qmake = abs_path $qmake;
+ diag "Using qmake from sibling qtbase: $qmake";
+ return $qmake;
+ }
+
+ # OK, then just try to use qmake from PATH
+ $qmake = which 'qmake';
+ my $output = qx("$qmake" -v 2>&1);
+ if ($? == 0 && $output =~ m{Using Qt version $QT_VERSION}) {
+ diag "Using qmake from PATH: $qmake\n$output";
+ return $qmake;
+ }
+
+ diag 'Warning: no qmake found';
+
+ return;
+}
+
=head1 NAME
@@ -436,6 +478,28 @@ will die, noisily).
=back
+=item B<find_qmake>
+
+Attempts to find and return a qmake command string suitable for running from
+within a test:
+
+=over
+
+=item *
+
+If the "qtqa" directory has a sibling "qtbase" directory, the qmake from that
+qtbase will be used, if available. The full path to qmake is returned.
+
+=item *
+
+Otherwise, if a qmake from Qt 5 is in PATH, it will be used.
+The string "qmake" is returned.
+
+=item *
+
+Otherwise, an undefined value is returned.
+
+=back
=back