user/dev discussion of public-inbox itself
 help / color / mirror / Atom feed
* [PATCH 0/3] test fixes
@ 2020-07-29  8:43 Eric Wong
  2020-07-29  8:43 ` [PATCH 1/3] t/imap_searchqp: fix test dependencies Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2020-07-29  8:43 UTC (permalink / raw)
  To: meta

Some new features had tests which failed on new VMs.

Eric Wong (3):
  t/imap_searchqp: fix test dependencies
  t/init: fix test when ~/.public-inbox/ does not exist
  emergency: create full path to PI_EMERGENCY

 lib/PublicInbox/Emergency.pm | 6 ++++--
 t/imap_searchqp.t            | 3 ++-
 t/init.t                     | 4 ++++
 3 files changed, 10 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] t/imap_searchqp: fix test dependencies
  2020-07-29  8:43 [PATCH 0/3] test fixes Eric Wong
@ 2020-07-29  8:43 ` Eric Wong
  2020-07-29  8:43 ` [PATCH 2/3] t/init: fix test when ~/.public-inbox/ does not exist Eric Wong
  2020-07-29  8:43 ` [PATCH 3/3] emergency: create full path to PI_EMERGENCY Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-07-29  8:43 UTC (permalink / raw)
  To: meta; +Cc: Eric Wong

From: Eric Wong <e@80x24.org>

The query parser test pulls in all of the IMAP stuff, so it
has the same dependencies.
---
 t/imap_searchqp.t | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/imap_searchqp.t b/t/imap_searchqp.t
index d73600b3..d62f314a 100644
--- a/t/imap_searchqp.t
+++ b/t/imap_searchqp.t
@@ -5,7 +5,8 @@ use strict;
 use Test::More;
 use Time::Local qw(timegm);
 use PublicInbox::TestCommon;
-require_mods(qw(Parse::RecDescent));
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address
+	Parse::RecDescent));
 use_ok 'PublicInbox::IMAPsearchqp';
 use_ok 'PublicInbox::IMAP';
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] t/init: fix test when ~/.public-inbox/ does not exist
  2020-07-29  8:43 [PATCH 0/3] test fixes Eric Wong
  2020-07-29  8:43 ` [PATCH 1/3] t/imap_searchqp: fix test dependencies Eric Wong
@ 2020-07-29  8:43 ` Eric Wong
  2020-07-29  8:43 ` [PATCH 3/3] emergency: create full path to PI_EMERGENCY Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-07-29  8:43 UTC (permalink / raw)
  To: meta; +Cc: Eric Wong

From: Eric Wong <e@80x24.org>

We'll just set the documented PI_EMERGENCY env to
a writable location.
---
 t/init.t | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/t/init.t b/t/init.t
index 16581955..6211bb58 100644
--- a/t/init.t
+++ b/t/init.t
@@ -66,6 +66,7 @@ SKIP: {
 	require_git(2.6, 1) or skip "git 2.6+ required", 2;
 	use_ok 'PublicInbox::Msgmap';
 	local $ENV{PI_DIR} = "$tmpdir/.public-inbox/";
+	local $ENV{PI_EMERGENCY} = "$tmpdir/.public-inbox/emergency";
 	my $cfgfile = "$ENV{PI_DIR}/config";
 	my $cmd = [ '-init', '-V2', 'v2list', "$tmpdir/v2list",
 		   qw(http://example.com/v2list v2list@example.com) ];
@@ -123,6 +124,7 @@ SKIP: {
 	my $msg = "Message-ID: <$mid>\n\n";
 	my $rdr = { 0 => \$msg, 2 => \(my $err = '')  };
 	ok(run_script([qw(-mda --no-precheck)], $env, $rdr), 'deliver V1');
+	diag "err=$err" if $err;
 	my $mm = PublicInbox::Msgmap->new_file("$tmpdir/skip3/msgmap.sqlite3");
 	my $n = $mm->num_for($mid);
 	is($n, 13, 'V2 NNTP article numbers skipped via --skip-artnum');
@@ -132,7 +134,9 @@ SKIP: {
 	$cmd = [ qw(-init -V1 -N12 -Lmedium skip4), "$tmpdir/skip4",
 		   qw(http://example.com/skip4), $addr ];
 	ok(run_script($cmd), '--skip-artnum -V1');
+	$err = '';
 	ok(run_script([qw(-mda --no-precheck)], $env, $rdr), 'deliver V1');
+	diag "err=$err" if $err;
 	$mm = PublicInbox::Msgmap->new("$tmpdir/skip4");
 	$n = $mm->num_for($mid);
 	is($n, 13, 'V1 NNTP article numbers skipped via --skip-artnum');

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] emergency: create full path to PI_EMERGENCY
  2020-07-29  8:43 [PATCH 0/3] test fixes Eric Wong
  2020-07-29  8:43 ` [PATCH 1/3] t/imap_searchqp: fix test dependencies Eric Wong
  2020-07-29  8:43 ` [PATCH 2/3] t/init: fix test when ~/.public-inbox/ does not exist Eric Wong
@ 2020-07-29  8:43 ` Eric Wong
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-07-29  8:43 UTC (permalink / raw)
  To: meta

It's possible for ~/.public-inbox/ to not exist if PI_CONFIG
points to an alternate location.  Only noticed from the previous
patch fixing t/init.t behavior.
---
 lib/PublicInbox/Emergency.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Emergency.pm b/lib/PublicInbox/Emergency.pm
index 02900bb1..b705e776 100644
--- a/lib/PublicInbox/Emergency.pm
+++ b/lib/PublicInbox/Emergency.pm
@@ -12,11 +12,13 @@ use IO::Handle; # ->flush, ->autoflush
 sub new {
 	my ($class, $dir) = @_;
 
-	-d $dir or mkdir($dir) or die "failed to mkdir($dir): $!\n";
 	foreach (qw(new tmp cur)) {
 		my $d = "$dir/$_";
 		next if -d $d;
-		-d $d or mkdir($d) or die "failed to mkdir($d): $!\n";
+		require File::Path;
+		if (!File::Path::mkpath($d) && !-d $d) {
+			die "failed to mkpath($d): $!\n";
+		}
 	}
 	bless { dir => $dir, files => {}, t => 0, cnt => 0, pid => $$ }, $class;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-29  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  8:43 [PATCH 0/3] test fixes Eric Wong
2020-07-29  8:43 ` [PATCH 1/3] t/imap_searchqp: fix test dependencies Eric Wong
2020-07-29  8:43 ` [PATCH 2/3] t/init: fix test when ~/.public-inbox/ does not exist Eric Wong
2020-07-29  8:43 ` [PATCH 3/3] emergency: create full path to PI_EMERGENCY Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git