]> Sergey Matveev's repositories - public-inbox.git/blobdiff - xt/imapd-mbsync-oimap.t
No ext_urls
[public-inbox.git] / xt / imapd-mbsync-oimap.t
index edf111fde3eca3a859abae89d206e7ed174b6025..b02811055e5336a8e4124c08f636a8a15aeaf639 100644 (file)
@@ -1,13 +1,13 @@
 #!perl -w
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 # ensure mbsync and offlineimap compatibility
 use strict;
-use Test::More;
+use v5.10.1;
 use File::Path qw(mkpath);
 use PublicInbox::TestCommon;
-use PublicInbox::Spawn qw(which spawn);
-require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
+use PublicInbox::Spawn qw(spawn);
+require_mods(qw(-imapd));
 my $inboxdir = $ENV{GIANT_INBOX_DIR};
 (defined($inboxdir) && -d $inboxdir) or
        plan skip_all => "GIANT_INBOX_DIR not defined for $0";
@@ -35,12 +35,15 @@ my $td = start_script($cmd, $env, { 3 => $sock }) or BAIL_OUT "-imapd: $?";
        my $c = tcp_connect($sock);
        like(readline($c), qr/CAPABILITY /, 'got greeting');
 }
+
+my $host_port = tcp_host_port($sock);
 my ($host, $port) = ($sock->sockhost, $sock->sockport);
 my %pids;
 
 SKIP: {
        mkpath([map { "$tmpdir/oimapdir/$_" } qw(cur new tmp)]);
-       my $oimap = which('offlineimap') or skip 'no offlineimap(1)', 1;
+       my $oimap = require_cmd('offlineimap', 1) or
+               skip 'no offlineimap(1)', 1;
        open my $fh, '>', "$tmpdir/.offlineimaprc" or BAIL_OUT "open: $!";
        print $fh <<EOF or BAIL_OUT "print: $!";
 [general]
@@ -76,7 +79,7 @@ EOF
 
 SKIP: {
        mkpath([map { "$tmpdir/mbsyncdir/test/$_" } qw(cur new tmp)]);
-       my $mbsync = which('mbsync') or skip 'no mbsync(1)', 1;
+       my $mbsync = require_cmd('mbsync', 1) or skip 'no mbsync(1)', 1;
        open my $fh, '>', "$tmpdir/.mbsyncrc" or BAIL_OUT "open: $!";
        print $fh <<EOF or BAIL_OUT "print: $!";
 Create Slave
@@ -99,7 +102,7 @@ UseNamespace no
 # DisableExtension COMPRESS=DEFLATE
 
 Channel "test"
-Master ":remote:inbox"
+Master ":remote:INBOX"
 Slave ":local:test"
 Expunge None
 Sync PullNew
@@ -120,7 +123,7 @@ while (scalar keys %pids) {
 my $sec = $ENV{TEST_PERSIST} // 0;
 diag "TEST_PERSIST=$sec";
 if ($sec) {
-       diag "sleeping ${sec}s, imap://$host:$port/$mailbox available";
+       diag "sleeping ${sec}s, imap://$host_port/$mailbox available";
        diag "tmpdir=$tmpdir (Maildirs available)";
        diag "stdout=$out";
        diag "stderr=$err";