From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS20473 45.76.80.0/20 X-Spam-Status: No, score=-3.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from mail.smrk.net (mail.smrk.net [45.76.87.244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 804E91F78D for ; Wed, 24 Jul 2024 07:29:13 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=smrk.net header.i=@smrk.net header.a=rsa-sha256 header.s=20221002 header.b=bf+RKVik; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smrk.net; s=20221002; t=1721805749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Tr0uHSpXQezZBE6G2sFtQpcdpflQMrqkcAHOVf9Q1Q=; b=bf+RKVik/SbxvqxwwutHayjLSw6XPbdOdK/RURAte0C4+UdiF+2q0mJG1VDz2vpgY8MrGI 6dnaD3MRQGfivfL9q055v7BBbcYV0OEFF99sFG3eAo4InxL4dH11EYwYgkTJmvChJsi9Op uqYJ+vT4khhCg5NGWFJzt4xcVMUy8nf9zFG7VYCzRab912LFraCO5CjtIxRSm/SDfE80XP c/9tbykKOJDWvEyUr+ddBLKwS0rDFICemv9ItWID0eJmVnDAnGA7RCHhTpLJ9XvYkW52Yb dWC1/CqkKXqA7htDoNt9p1D7+DJ2ZteHaLChOibG0YVIihj/5XHh+7ap0MrF1g== Received: from localhost ( [192.168.5.2]) by smrk (OpenSMTPD) with ESMTPSA id 1f244611 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 24 Jul 2024 09:22:29 +0200 (CEST) From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [PATCH 2/4] msgmap: mid_insert: reraise on unexpected errors, [PATCH 3/4] t/v2writable: test ENOSPC from fast-import In-Reply-To: <20240723212837.3931413-3-e@80x24.org> (Eric Wong's message of "Tue, 23 Jul 2024 21:28:35 +0000, Tue, 23 Jul 2024 21:28:36 +0000") References: <20240723212837.3931413-1-e@80x24.org> <20240723212837.3931413-1-e@80x24.org> <20240723212837.3931413-3-e@80x24.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Wed, 24 Jul 2024 09:22:29 +0200 Message-ID: <20240724092229+0200.264800-stepnem@smrk.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: Just a few nits in the new test messages, if I may: [2/4]: On Tue, 23 Jul 2024 21:28:35 +0000 Eric Wong wrote: > SQLITE_CONSTRAINT is the only SQLite error we really expect under > normal circumstances. This avoids infinite loops when writing > to inboxes after hitting ENOSPC. [...] > diff --git a/t/msgmap.t b/t/msgmap.t [...] > @@ -70,4 +73,17 @@ is(eval { > 'ok' > }, 'ok', 'atfork_* work on tmp_clone'); >=20=20 > -done_testing(); > +SKIP: { > + my $strace =3D strace_inject; > + open my $fh, '>', my $trace =3D "$tmpdir/trace.out"; > + my $rd =3D popen_rd([ $strace, '-p', $$, '-o', $trace, > + '-e', 'inject=3Dpwrite64:error=3DENOSPC'], undef, { 2 =3D> 1 }); > + $rd->poll_in(10) or die 'strace not ready'; > + is eval { $d->mid_insert('this-better-trigger-ENOSPC@error') }, > + undef, 'insert fails w/ ENOSPC'; > + like $@, qr/ disk is full/, 'set $@ for ENOSPC'; ^^^^^^^^^^^^^^^^^ > + kill 'TERM', $rd->attached_pid; > + $rd->close; > +} > + > +done_testing; > diff --git a/t/v2writable.t b/t/v2writable.t [...] > @@ -335,4 +337,18 @@ ok($@, 'V2Writable fails on non-existent dir'); > is($mode, 0664, sprintf('0%03o', $mode).' is 0664'); > } >=20=20 > -done_testing(); > +SKIP: { > + my $strace =3D strace_inject; > + my $eml =3D eml_load 't/plack-qp.eml'; > + open my $fh, '>', my $trace =3D "$inboxdir/trace.out"; > + my $rd =3D popen_rd([ $strace, '-p', $$, '-o', $trace, > + '-e', 'inject=3Dpwrite64:error=3DENOSPC'], undef, { 2 =3D> 1 }); > + $rd->poll_in(10) or die 'strace not ready'; > + ok ! eval { $im->add($eml) }, 'v2w->add fails on ENOSPC'; > + like $@, qr/ disk is full/, 'set $@ for ENOSPC'; ^^^^^^^^^^^^^^^^^ [3/4]: On Tue, 23 Jul 2024 21:28:36 +0000 Eric Wong wrote: > This also ensures we can recover after the ENOSPC condition > is resolved. > --- > t/v2writable.t | 34 +++++++++++++++++++++++++++++++++- > 1 file changed, 33 insertions(+), 1 deletion(-) > > diff --git a/t/v2writable.t b/t/v2writable.t > index a062d1b3..93385456 100644 > --- a/t/v2writable.t > +++ b/t/v2writable.t [...] > @@ -340,15 +341,46 @@ ok($@, 'V2Writable fails on non-existent dir'); [...] > + $rd->poll_in(10) or die 'strace not ready'; > + ok !eval { $im->done }, 'done fails with ENOSPC'; > + ok $@, '$@ set on ENOSPC'; ^^^^^^^^^^^^^^^^ If I'm correct in assuming that no semantic nuance is intended between the 'set $@ for ENOSPC' and '$@ set on ENOSPC' variants, I suggest unifying on the latter (the unequivocal passive reads clearer than the imperative-looking 'set $@'). [...] > + $im->add($eml) or xbail '->add fail after fixing ENOSPC'; s/fail/fails/ ? > + $im->done; > + ok !$im->add($eml), '->add detects existing message'; > + $im->done; > + is -s $fh, 0, 'nothing new fast-import stderr'; s/new/new on/ ? Thanks. --=20 =C5=A0t=C4=9Bp=C3=A1n