mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Bug 163494 - runtests.sh needs a switch to include optional modules
Tests now detect optional modules and only exclude optional files if optional module dependencies are not met. Also major indent cleanup r=timeless
This commit is contained in:
parent
edf3d2faf5
commit
1a7f1c2f85
@ -18,6 +18,7 @@
|
|||||||
# Rights Reserved.
|
# Rights Reserved.
|
||||||
#
|
#
|
||||||
# Contributor(s): Zach Lipton <zach@zachlipton.com>
|
# Contributor(s): Zach Lipton <zach@zachlipton.com>
|
||||||
|
# Joel Peshkin <bugreport@peshkin.net>
|
||||||
#
|
#
|
||||||
# Alternatively, the contents of this file may be used under the
|
# Alternatively, the contents of this file may be used under the
|
||||||
# terms of the GNU General Public License Version 2 or later (the
|
# terms of the GNU General Public License Version 2 or later (the
|
||||||
@ -34,34 +35,55 @@
|
|||||||
|
|
||||||
package Support::Files;
|
package Support::Files;
|
||||||
|
|
||||||
|
# exclude_deps is a hash of arrays listing the files to be excluded
|
||||||
|
# if a module is not available
|
||||||
|
#
|
||||||
@additional_files = ('syncshadowdb','processmail');
|
@additional_files = ('syncshadowdb','processmail');
|
||||||
@exclude_files = ('importxml.pl');
|
%exclude_deps = (
|
||||||
|
'XML::Parser' => ['importxml.pl'],
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
# XXX - this file should be rewritten to use File::Find or similar
|
# XXX - this file should be rewritten to use File::Find or similar
|
||||||
$file = '*';
|
$file = '*';
|
||||||
@files = (glob($file), glob('Bugzilla/*.pm'));
|
@files = (glob($file), glob('Bugzilla/*.pm'));
|
||||||
|
|
||||||
sub isTestingFile {
|
sub have_pkg {
|
||||||
my ($file) = @_;
|
my ($pkg) = @_;
|
||||||
my $exclude;
|
my ($msg, $vnum, $vstr);
|
||||||
foreach $exclude (@exclude_files) {
|
no strict 'refs';
|
||||||
if ($file eq $exclude) { return undef; } # get rid of excluded files.
|
eval { my $p; ($p = $pkg . ".pm") =~ s!::!/!g; require $p; };
|
||||||
}
|
return !($@);
|
||||||
|
}
|
||||||
|
|
||||||
if ($file =~ /\.cgi$|\.pl$|\.pm$/) {
|
@exclude_files = ();
|
||||||
return 1;
|
foreach $dep (keys(%exclude_deps)) {
|
||||||
}
|
if (!have_pkg($dep)) {
|
||||||
my $additional;
|
push @exclude_files, @{$exclude_deps{$dep}};
|
||||||
foreach $additional (@additional_files) {
|
}
|
||||||
if ($file eq $additional) { return 1; }
|
}
|
||||||
}
|
|
||||||
return undef;
|
sub isTestingFile {
|
||||||
|
my ($file) = @_;
|
||||||
|
my $exclude;
|
||||||
|
foreach $exclude (@exclude_files) {
|
||||||
|
if ($file eq $exclude) { return undef; } # get rid of excluded files.
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($file =~ /\.cgi$|\.pl$|\.pm$/) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
my $additional;
|
||||||
|
foreach $additional (@additional_files) {
|
||||||
|
if ($file eq $additional) { return 1; }
|
||||||
|
}
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach $currentfile (@files) {
|
foreach $currentfile (@files) {
|
||||||
if (isTestingFile($currentfile)) {
|
if (isTestingFile($currentfile)) {
|
||||||
push(@testitems,$currentfile);
|
push(@testitems,$currentfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user