Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions lib/Test/Smoke/Smoker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1101,18 +1101,13 @@ sub set_skip_tests {
if ( open SKIPTESTS, "< $self->{skip_tests}" ) {
my $action = $unset ? 'Unskip' : 'Skip';
$self->log_info("$action tests from '$self->{skip_tests}'");
my @libext;
my $raw;
while ( $raw = <SKIPTESTS> ) {
$raw =~ m/^\s*#/ and next;
$raw =~ s/(\S+).*/$1/s;
if ($raw !~ m/\.t$/ and $raw !~ m/test\.pl$/) {
next;
}
if ( $raw =~ m{^(?:lib|ext|cpan|dist)/} ) {
push @libext, $raw;
next;
}
my $tsrc = File::Spec->catfile( $self->{ddir}, $raw );
next if !-f $tsrc;
my $skip = qq[print "1..0 # SKIP Disabled by Test::Smoke\\n";\nexit 0;\n__END__\n];
Expand All @@ -1129,7 +1124,6 @@ sub set_skip_tests {
$self->log_info("\t%s: %sok%s\n", $raw, '', "");
}
close SKIPTESTS;
@libext and $self->change_manifest( \@libext, $unset );
} else {
require Carp;
Carp::carp("Cannot open($self->{skip_tests}): $!");
Expand Down
42 changes: 19 additions & 23 deletions t/smoker.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Cwd;
use lib 't';
use TestLib;

use Test::More tests => 76;
use Test::More tests => 82;
use_ok( 'Test::Smoke::Smoker' );

my $debug = exists $ENV{SMOKE_DEBUG} && $ENV{SMOKE_DEBUG};
Expand Down Expand Up @@ -889,43 +889,39 @@ EOOUT

SKIP: {
local *NOTESTS;
open NOTESTS, "> $skip_tests" or skip "Cannot create($skip_tests): $!", 7;
open NOTESTS, "> $skip_tests" or skip "Cannot create($skip_tests): $!", 13;
my @notest = qw{ t/op/skip.t lib/t/skip.t ext/t/skip.t cpan/t/skip.t dist/t/skip.t};
print NOTESTS "$_\n" for @notest;
close NOTESTS;

ok -f $skip_tests, "skip_tests file exists";

my $skip_test = catfile( $dst, 't', 'op', 'skip.t' );
my $skip = qq[print "1..0 # SKIP Disabled by Test::Smoke];
my $manifest = catfile $dst, 'MANIFEST';

$smoker->set_skip_tests;
ok -f catfile( $dst, 'MANIFEST.ORG'), "MANIFEST was copied";
ok ! -f catfile( $dst, 'MANIFEST.ORG'), "MANIFEST was not modified";

my $skip = qq[print "1..0 # SKIP Disabled by Test::Smoke];
ok get_file($skip_test) =~ /^\Q$skip\E/,
"t/op/skip.t had skip code added";
for my $tfile ( @notest ) {
my $tsrc = catfile( $dst, split m{/}, $tfile );
ok get_file($tsrc) =~ /^\Q$skip\E/,
"$tfile had skip code added";
}

my @libext = grep m{^(?:lib|ext|cpan|dist)/} => @notest;
my $manifest = catfile $dst, 'MANIFEST';
my $manifiles = get_file( $manifest );

my $ok = 1;
$ok &&= ! grep $manifiles =~ /^\Q$_\E/m => @libext;
ok $ok, "files removed from MANIFEST";
$ok &&= grep $manifiles =~ /^\Q$_\E/m => @notest;
ok $ok, "MANIFEST is unchanged";

$smoker->unset_skip_tests();

ok ! -f catfile( $dst, 'MANIFEST.ORG'), "MANIFEST.ORG was removed";

ok get_file($skip_test) !~ /^\Q$skip\E/,
"t/op/skip.t had skip code removed again";

my $files = get_file( $manifest );

$ok = 1;
$ok &&= grep $files =~ /^\Q$_\E/m => @libext;
ok $ok, "files back in MANIFEST";
for my $tfile ( @notest ) {
my $tsrc = catfile( $dst, split m{/}, $tfile );
ok get_file($tsrc) !~ /^\Q$skip\E/,
"$tfile had skip code removed";
}

1 while unlink $skip_tests;
1 while unlink $skip_tests;
}
rmtree $dst, $verbose;
}
Expand Down