##// END OF EJS Templates
Copyright header changes...
Copyright header changes Copyright header changes for Qt 5.5. Change-Id: I2b8e9356997de2c87a7436bcefd4d0948d566259 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2079:7d9cfff99e14
r2776:bc1f6aa59d42
Show More
run_tests.pl
95 lines | 2.6 KiB | text/plain | PerlLexer
Jani Honkonen
Add a script for running tests
r1134 use Cwd;
use Cwd 'abs_path';
use File::Basename;
use File::Copy;
Jani Honkonen
run_tests.pl: adding linux specific stuff
r1151 use feature "switch";
Jani Honkonen
Move scripts to tools folder
r1203 use lib 'tools';
Jani Honkonen
Add a script for running tests
r1134 use Jobs;
# read command line params
my $jobname = shift;
# read ini file
my $inifile = File::Basename::dirname($0) . "/jobs.ini";
my %job = Jobs::get($inifile, $jobname);
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136 # set/get paths
Jani Honkonen
run_tests.pl: try to fix auto test running in win7
r1135 my $root_path = abs_path();
Jani Honkonen
Update babmoo tools
r1981 my $bin_path = "$root_path/bin/" . $job{'Config'} . "/";
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136 my $reports_path = "test-reports";
# create reports path
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 mkdir $reports_path;
Jani Honkonen
run_tests.pl: try to fix auto test running in win7
r1135
Jani Honkonen
run_tests.pl: adding linux specific stuff
r1151 # setup environment for running tests
given ($job{'Platform'}) {
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079
Tero Ahola
Added QML_IMPORT_PATH to run_tests script for OSX
r2033 when ("Win7") {
# Add qtdir to path
$ENV{'PATH'} .= ";" . $job{'QtDir'} . "\\bin";
# replace / -> \
$ENV{'PATH'} =~ s/\//\\/g;
}
when ("Linux") {
# Add qtdir to path
$ENV{'PATH'} = $job{'QtDir'} . "/bin:" . $ENV{'PATH'};
# If this is not set we get "cannot connect to X server" errors
$ENV{'DISPLAY'} = ":0.0";
}
when ("Mac") {
# Set QML_IMPORT_PATH point to QML plugin dir
$ENV{'QML_IMPORT_PATH'} = $bin_path;
}
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079 }
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136
Jani Honkonen
Add a script for running tests
r1134 # Go through all the files in the test folder
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136 # autotest is an executable beginning with "tst_"
Jani Honkonen
run_tests.pl: adding linux specific stuff
r1151 my $script_exit_status = 0;
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 opendir (TESTAPPDIR, "$bin_path") or die "Couldn't open test app dir";
Jani Honkonen
Add a script for running tests
r1134 @files = <TESTAPPDIR>;
while ($testapp = readdir TESTAPPDIR) {
if (index($testapp, "tst_") == 0) {
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 if (-x "$bin_path$testapp") {
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136 my $status = executeTestApp($testapp);
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079 if ($status != 0) {
$script_exit_status = $status;
}
Jani Honkonen
Add a script for running tests
r1134 } else {
#print "file $testapp not executable\n";
}
}
}
closedir TESTAPPDIR;
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079 # Do not return error codes for bamboo.
# Bamboo will determine test failures by parsing the xml logs.
exit(0);
Jani Honkonen
Add a script for running tests
r1134
Jani Honkonen
run_tests.pl: adding linux specific stuff
r1151
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136 sub executeTestApp($) {
my $testapp = $_[0];
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079
# On OSX the actual test binary is in a sub folder
my $cmd_postfix = "";
if ($^O eq "darwin") {
$cmd_postfix = "/Contents/MacOS/$testapp";
$cmd_postfix = substr($cmd_postfix, 0, rindex($cmd_postfix, ".app"));
}
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 my $cmd = "$bin_path$testapp$cmd_postfix -xunitxml -o $reports_path/$testapp.xml";
Jani Honkonen
run_tests.pl: return an error code if a test fails
r1136 print "executing: $cmd\n";
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 system($cmd);
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079
# From http://perldoc.perl.org/perlvar.html about $?:
# The upper eight bits reflect specific error conditions encountered by the
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 # program (the program's exit() value). The lower eight bits reflect
# mode of failure, like signal death and core dump information.
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079 # See wait(2) for details.
Jani Honkonen
Add a script for running tests
r1134 my $exit_status = $? >> 8;
Jani Honkonen
Remove extra "test" folder. Put all binaries in the bin.
r1137 print "\texit status: $exit_status\n";
Jani Honkonen
run_tests.pl: do not return error code when there are failed tests
r2079 return $exit_status;
Jani Honkonen
Add a script for running tests
r1134 }