]> Sergey Matveev's repositories - public-inbox.git/commitdiff
test_common: clear XDG_CACHE_HOME before lei tests
authorEric Wong <e@80x24.org>
Thu, 28 Oct 2021 19:16:50 +0000 (19:16 +0000)
committerEric Wong <e@80x24.org>
Thu, 28 Oct 2021 20:21:09 +0000 (20:21 +0000)
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/
lib/PublicInbox/TestCommon.pm

index c3820d3a57463e44f19843541ec4003082a0874b..052d6e45e45b498809ec2a79cbc0731c66d78918 100644 (file)
@@ -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) {