|
|
|
|
@ -2064,6 +2064,17 @@ HOME |
|
|
|
|
return 'Makefile'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Runs the testsuite for the given module. |
|
|
|
|
# Returns true if a testsuite is present and all tests passed, false otherwise. |
|
|
|
|
sub runTestsuite |
|
|
|
|
{ |
|
|
|
|
my $self = shift; |
|
|
|
|
my $module = $self->module(); |
|
|
|
|
|
|
|
|
|
info ("\ty[$module] does not support the b[run-tests] option"); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Subroutine to clean the build system for the given module. Works by |
|
|
|
|
# recursively deleting the directory and then recreating it. |
|
|
|
|
# Returns 0 for failure, non-zero for success. |
|
|
|
|
@ -2297,6 +2308,55 @@ HOME |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub runTestsuite |
|
|
|
|
{ |
|
|
|
|
my $self = assert_isa(shift, 'KDEBuildSystem'); |
|
|
|
|
my $module = $self->module(); |
|
|
|
|
|
|
|
|
|
# Note that we do not run safe_make, which should really be called |
|
|
|
|
# safe_compile at this point. |
|
|
|
|
|
|
|
|
|
# Step 1: Ensure the tests are built, oh wait we already did that when we ran |
|
|
|
|
# CMake :) |
|
|
|
|
|
|
|
|
|
my $make_target = 'test'; |
|
|
|
|
if ($module->getOption('run-tests') eq 'upload') { |
|
|
|
|
$make_target = 'Experimental'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
info ("\tRunning test suite..."); |
|
|
|
|
|
|
|
|
|
# Step 2: Run the tests. |
|
|
|
|
# We scrape the output of the commands, so force the locale to be |
|
|
|
|
# untranslated. |
|
|
|
|
local $ENV{'LC_ALL'} = 'C'; |
|
|
|
|
my $result = main::log_command($module, 'test-results', [ 'make', $make_target ]); |
|
|
|
|
|
|
|
|
|
if ($result != 0) { |
|
|
|
|
my $logdir = $module->getLogDir(); |
|
|
|
|
my $logfile = "$logdir/test-results.log"; |
|
|
|
|
my $numTests = -1; |
|
|
|
|
|
|
|
|
|
# Extract the number of failed tests |
|
|
|
|
if (open (my $logf, '<', "$logfile")) { |
|
|
|
|
while (my $line = <$logf>) { |
|
|
|
|
last if (($numTests) = $line =~ m/([0-9]+) tests failed out of/); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($numTests > -1 ) { |
|
|
|
|
warning ("\t$numTests tests failed for y[$module], consult $logdir/test-results.log for info"); |
|
|
|
|
} else { |
|
|
|
|
warning ("\tSome tests failed for y[$module], consult $logdir/test-results.log for info"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} else { |
|
|
|
|
info ("\tAll tests ran successfully."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub configureInternal |
|
|
|
|
{ |
|
|
|
|
@ -2700,7 +2760,7 @@ EOF |
|
|
|
|
# TODO: This should be a simple phase to run. |
|
|
|
|
if ($self->getOption('run-tests')) |
|
|
|
|
{ |
|
|
|
|
main::run_tests($self); # Don't fail if this fails... yet |
|
|
|
|
$self->buildSystem()->runTestsuite(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# TODO: Likewise this should be a phase to run. |
|
|
|
|
@ -6715,61 +6775,6 @@ EOF |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Subroutine to run the testsuite for a given module. |
|
|
|
|
# |
|
|
|
|
# First parameter is the module to run tests for. |
|
|
|
|
# Returns true if all tests passed, false if some failed or there was an |
|
|
|
|
# error running tests. |
|
|
|
|
sub run_tests |
|
|
|
|
{ |
|
|
|
|
my $module = assert_isa(shift, 'Module'); |
|
|
|
|
|
|
|
|
|
if (!module_uses_cmake($module)) { |
|
|
|
|
warning "Cannot run test suite for r[$module] as it does not use CMake"; |
|
|
|
|
return 1; # But return true anyways |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Note that we do not run safe_make, which should really be called |
|
|
|
|
# safe_compile at this point. |
|
|
|
|
|
|
|
|
|
# Step 1: Ensure the tests are built, oh wait we already did that when we ran |
|
|
|
|
# CMake :) |
|
|
|
|
|
|
|
|
|
my $make_target = 'test'; |
|
|
|
|
if ($module->getOption('run-tests') eq 'upload') { |
|
|
|
|
$make_target = 'Experimental'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Step 2: Run the tests. |
|
|
|
|
# We scrape the output of the commands, so force the locale to be |
|
|
|
|
# untranslated. |
|
|
|
|
local $ENV{'LC_ALL'} = 'C'; |
|
|
|
|
my $result = log_command($module, 'test-results', [ 'make', $make_target ]); |
|
|
|
|
if ($result != 0) { |
|
|
|
|
my $logdir = $module->getLogDir(); |
|
|
|
|
my $logfile = "$logdir/test-results.log"; |
|
|
|
|
my $numTests = -1; |
|
|
|
|
# Extract the number of failed tests |
|
|
|
|
if (open(my $logf, "<$logfile")) { |
|
|
|
|
my @lines = <$logf>; |
|
|
|
|
my @matches = grep (/failed out of/, @lines); |
|
|
|
|
if (scalar(@matches)) { |
|
|
|
|
($numTests) = $matches[0] =~ /([0-9]+) tests failed out of/; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($numTests > -1 ) { |
|
|
|
|
warning "\t$numTests tests failed for y[$module], consult $logdir/test-results.log for info"; |
|
|
|
|
} else { |
|
|
|
|
warning "\tSome tests failed for y[$module], consult $logdir/test-results.log for info"; |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} else { |
|
|
|
|
info "\tAll tests ran successfully."; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# kdesrc-build supports putting the l10n module on the command line, but it is |
|
|
|
|
# rather weird in that l10n isn't used as a module internally, instead the |
|
|
|
|
# l10n/$lang are treated for the most part as modules. |
|
|
|
|
|