about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-28 19:16:50 +0000
committerEric Wong <e@80x24.org>2021-10-28 20:21:09 +0000
commit0bb44530cbc51488240df5027f9f00808dcc13ce (patch)
treeab40ac2ece34ab437added96b7a567afe472b04e
parent2e15f8d28228d96485891d3bfd19e09a7ba776a1 (diff)
downloadpublic-inbox-0bb44530cbc51488240df5027f9f00808dcc13ce.tar.gz
We don't want to read a users'
$XDG_CACHE_HOME/lei/all_locals_ever.git during tests.

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Tested-by: Thomas Weißschuh <thomas@t-8ch.de>
Link: https://public-inbox.org/meta/f239abac-4aee-4573-a0d6-e533c7a32662@t-8ch.de/
-rw-r--r--lib/PublicInbox/TestCommon.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index c3820d3a..052d6e45 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -556,16 +556,20 @@ SKIP: {
         require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2);
         my $mods = $test_opt->{mods} // [ 'lei' ];
         require_mods(@$mods, 2);
+
+        # set PERL_INLINE_DIRECTORY before clobbering XDG_CACHE_HOME
+        require PublicInbox::Spawn;
         require PublicInbox::Config;
         require File::Path;
+
         local %ENV = %ENV;
         delete $ENV{XDG_DATA_HOME};
         delete $ENV{XDG_CONFIG_HOME};
+        delete $ENV{XDG_CACHE_HOME};
         $ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com';
         $ENV{GIT_COMMITTER_NAME} = 'lei user';
         my (undef, $fn, $lineno) = caller(0);
         my $t = "$fn:$lineno";
-        require PublicInbox::Spawn;
         state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') ||
                                 eval { require Socket::MsgHdr; 1 };
         unless ($lei_daemon) {