\$(EATMYDATA) \$(PROVE) --state=save -bvw -j\$(N)
-@\$(check_manifest)
-# lightly-tested way to run tests, relies "--state=save" in check-each
-# for best performance
+# this relies "--state=save" in check-each for best performance
check-run :: pure_all check-man
\$(EATMYDATA) \$(PROVE) -bvw t/run.perl :: -j\$(N)
-@\$(check_manifest)
+check-debris :: pure_all
+ PERL5LIB="\$\$PWD"/blib/lib \$(PROVE) -bvw xt/\$@.t
+
check :: check-each
lib/PublicInbox/UserContent.pm :: contrib/css/216dark.css
use IO::Socket::INET;
use File::Spec;
use Scalar::Util qw(isvstring);
+use Carp ();
our @EXPORT;
my $lei_loud = $ENV{TEST_LEI_ERR_LOUD};
my $tail_cmd = $ENV{TAIL};
create_coderepo no_scm_rights
tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
test_httpd xbail require_cmd is_xdeeply tail_f
- ignore_inline_c_missing no_pollerfd);
+ ignore_inline_c_missing no_pollerfd no_coredump);
require Test::More;
my @methods = grep(!/\W/, @Test::More::EXPORT);
eval(join('', map { "*$_=\\&Test::More::$_;" } @methods));
}
}
+sub no_coredump (@) {
+ my @dirs = @_;
+ my $cwdfh;
+ if (@dirs) { opendir($cwdfh, '.') or die "opendir(.): $!" }
+ my @found;
+ for (@dirs, '.') {
+ chdir $_;
+ my @cores = glob('core.* *.core');
+ push @cores, 'core' if -d 'core';
+ push(@found, "@cores found in $_") if @cores;
+ chdir $cwdfh if $cwdfh;
+ }
+ return if !@found; # keep it quiet.
+ is(scalar(@found), 0, 'no core dumps found');
+ diag(join("\n", @found) . Carp::longmess());
+ if (-t STDIN) {
+ diag 'press ENTER to continue, (q) to quit';
+ chomp(my $line = <STDIN>);
+ xbail 'user quit' if $line =~ /\Aq/;
+ }
+}
+
sub run_script ($;$$) {
my ($cmd, $env, $opt) = @_;
+ no_coredump($opt->{-C} ? ($opt->{-C}) : ());
my ($key, @argv) = @$cmd;
my $run_mode = $ENV{TEST_RUN_MODE} // $opt->{run_mode} // 1;
my $sub = $run_mode == 0 ? undef : key2sub($key);
local $/;
$$redir = <$fh>;
}
+ no_coredump($opt->{-C} ? ($opt->{-C}) : ());
$? == 0;
}
File::Path::rmtree([glob("$home/*")]);
File::Path::rmtree("$home/.config");
} else {
+ no_coredump $tmpdir;
lei_ok(qw(daemon-pid), \"daemon-pid after $t");
chomp($daemon_pid = $lei_out);
if (!$daemon_pid) {
tick;
}
ok(!kill(0, $daemon_pid), "$t daemon stopped");
+ no_coredump $tmpdir;
my $f = "$daemon_xrd/lei/errors.log";
open my $fh, '<', $f or BAIL_OUT "$f: $!";
my @l = <$fh>;
--- /dev/null
+#!perl -w
+use v5.12;
+use autodie qw(open);
+use PublicInbox::TestCommon;
+use File::Spec;
+my $tmpdir = File::Spec->tmpdir;
+
+diag "note: writes to `$tmpdir' by others results in false-positives";
+
+my %cur = map { $_ => 1 } glob("$tmpdir/*");
+for my $t (@ARGV ? @ARGV : glob('t/*.t')) {
+ open my $fh, '-|', $^X, '-w', $t;
+ my @out;
+ while (<$fh>) {
+ chomp;
+ push @out, $_;
+ next if /^ok / || /\A[0-9]+\.\.[0-9]+\z/;
+ diag $_;
+ }
+ ok(close($fh), $t) or diag(explain(\@out));
+
+ no_coredump($tmpdir);
+
+ my @remain = grep { !$cur{$_}++ } glob("$tmpdir/*");
+ next if !@remain;
+ is_deeply(\@remain, [], "$t has no leftovers") or
+ diag "$t added: ",explain(\@remain);
+}
+
+done_testing;