user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 4/5] t/shared_kv: workaround old File::Spec
  2021-01-17  7:09  5% [PATCH 0/5] fixes for older Perls and Xapian Eric Wong
@ 2021-01-17  7:09  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-01-17  7:09 UTC (permalink / raw)
  To: meta

From: Eric Wong <e@yhbt.net>

The version of File::Spec shipped with Perl 5.16.3 memoizes the
value of File::Spec->tmpdir, causing changes to $ENV{TMPDIR}
after-the-fact to be ignored.

We'll only work around this in the test since it's innocuous and
unlikely to matter in real-world usage (and there's many places
where we'd have to workaround this in non-test code).
---
 t/shared_kv.t | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/t/shared_kv.t b/t/shared_kv.t
index e7a8e05e..6f6374f2 100644
--- a/t/shared_kv.t
+++ b/t/shared_kv.t
@@ -9,9 +9,8 @@ use_ok 'PublicInbox::SharedKV';
 my ($tmpdir, $for_destroy) = tmpdir();
 local $ENV{TMPDIR} = $tmpdir;
 my $skv = PublicInbox::SharedKV->new;
-opendir(my $dh, $tmpdir) or BAIL_OUT $!;
-my @ent = grep(!/\A\.\.?\z/, readdir($dh));
-is(scalar(@ent), 1, 'created a temporary dir');
+my $skv_tmpdir = $skv->{tmpdir};
+ok(-d $skv_tmpdir, 'created a temporary dir');
 $skv->dbh;
 my $dead = "\xde\xad";
 my $beef = "\xbe\xef";
@@ -48,10 +47,7 @@ is($skv->delete_by_val($dead), 2, 'delete_by_val hits');
 is($skv->delete_by_val($dead), 0, 'delete_by_val misses again');
 
 undef $skv;
-rewinddir($dh);
-@ent = grep(!/\A\.\.?\z/, readdir($dh));
-is(scalar(@ent), 0, 'temporary dir gone');
-undef $dh;
+ok(!-d $skv_tmpdir, 'temporary dir gone');
 $skv = PublicInbox::SharedKV->new("$tmpdir/dir", 'base');
 ok(-e "$tmpdir/dir/base.sqlite3", 'file created');
 

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] fixes for older Perls and Xapian
@ 2021-01-17  7:09  5% Eric Wong
  2021-01-17  7:09  7% ` [PATCH 4/5] t/shared_kv: workaround old File::Spec Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-01-17  7:09 UTC (permalink / raw)
  To: meta

Eric Wong (5):
  address: pairs: enable pure Perl version
  initialize scalar for `vec' perlop modification
  t/thread-index-gap: support older DBI
  t/shared_kv: workaround old File::Spec
  extindex: fix w/ Xapian 1.2.21..1.2.24

 lib/PublicInbox/Address.pm      |  1 +
 lib/PublicInbox/ExtSearchIdx.pm |  1 +
 lib/PublicInbox/LEI.pm          |  2 +-
 lib/PublicInbox/SearchIdx.pm    |  5 ++++-
 lib/PublicInbox/Syscall.pm      |  2 +-
 lib/PublicInbox/V2Writable.pm   | 12 ++++++++++--
 t/shared_kv.t                   | 10 +++-------
 t/thread-index-gap.t            |  7 +++++--
 8 files changed, 26 insertions(+), 14 deletions(-)

^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-01-17  7:09  5% [PATCH 0/5] fixes for older Perls and Xapian Eric Wong
2021-01-17  7:09  7% ` [PATCH 4/5] t/shared_kv: workaround old File::Spec Eric Wong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).