use Fcntl qw(FD_CLOEXEC F_SETFD F_GETFD :seek);
use POSIX qw(dup2);
use IO::Socket::INET;
+use File::Spec;
our @EXPORT;
BEGIN {
@EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods
run_script start_script key2sub xsys xsys_e xqx eml_load tick
have_xapian_compact json_utf8 setup_public_inboxes
- tcp_host_port test_lei $lei $lei_out $lei_err $lei_opt);
+ tcp_host_port test_lei lei lei_ok
+ $lei $lei_out $lei_err $lei_opt);
require Test::More;
my @methods = grep(!/\W/, @Test::More::EXPORT);
eval(join('', map { "*$_=\\&Test::More::$_;" } @methods));
die "unable to deal with $ref $redir";
}
}
+ if ($key =~ /-(index|convert|extindex|convert|xcpdb)\z/) {
+ unshift @argv, '--no-fsync';
+ }
if ($run_mode == 0) {
# spawn an independent new process, like real-world use cases:
require PublicInbox::Spawn;
$res;
};
+sub lei (@) { $lei->(@_) }
+
+sub lei_ok (@) {
+ my $msg = ref($_[-1]) ? pop(@_) : undef;
+ # filter out anything that looks like a path name for consistent logs
+ my @msg = grep(!m!\A/!, @_);
+ ok($lei->(@_), "lei @msg". ($msg ? " ($$msg)" : ''));
+}
+
sub json_utf8 () {
state $x = ref(PublicInbox::Config->json)->new->utf8->canonical;
}
SKIP: {
my ($cb) = pop @_;
my $test_opt = shift // {};
- require_git(2.6) or skip('git 2.6+ required for lei test', 2);
+ require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2);
require_mods(qw(json DBD::SQLite Search::Xapian), 2);
require PublicInbox::Config;
delete local $ENV{XDG_DATA_HOME};
}
}; # SKIP for lei_daemon
unless ($test_opt->{daemon_only}) {
+ $ENV{TEST_LEI_DAEMON_ONLY} and
+ skip 'TEST_LEI_DAEMON_ONLY set', 1;
require_ok 'PublicInbox::LEI';
my $home = "$tmpdir/lei-oneshot";
mkdir($home, 0700) or BAIL_OUT "mkdir: $!";
my $end = $lk->lock_for_scope;
return @ret if -f $stamp;
- require PublicInbox::InboxWritable;
local $ENV{PI_CONFIG} = $pi_config;
for my $V (1, 2) {
run_script([qw(-init), "-V$V", "t$V",
"$test_home/t$V", "http://example.com/t$V",
"t$V\@example.com" ]) or BAIL_OUT "init v$V";
}
+ require PublicInbox::Config;
+ require PublicInbox::InboxWritable;
my $cfg = PublicInbox::Config->new;
my $seen = 0;
$cfg->each_inbox(sub {