From: Eric Wong Date: Fri, 15 Nov 2024 02:59:28 +0000 (+0000) Subject: test_common: disable fsync in git(1) commands X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5aebdb559f83843b9aaa37a6ef0e22b250cb732a;p=thirdparty%2Fpublic-inbox.git test_common: disable fsync in git(1) commands As with git itself, fsync(2) results in needless overhead and storage wear in test cases where data integrity is not an issue. I normally point TMPDIR to tmpfs when running tests, but this still affects initial setup of data for stuff in t/data-gen as well as improving life for users with too little RAM for a tmpfs TMPDIR. --- diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 6c3677d2d..b863ad6b7 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -18,6 +18,7 @@ our $tail_cmd = $ENV{TAIL}; our ($lei_opt, $lei_out, $lei_err); use autodie qw(chdir close fcntl mkdir open opendir seek unlink); $ENV{XDG_CACHE_HOME} //= "$ENV{HOME}/.cache"; # reuse C++ xap_helper builds +$ENV{GIT_TEST_FSYNC} = 0; # hopefully reduce wear $_ = File::Spec->rel2abs($_) for (grep(!m!^/!, @INC)); our $CURRENT_DAEMON; @@ -87,6 +88,7 @@ sub tmpdir (;$) { my ($base) = @_; require File::Temp; ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!) unless defined $base; + ($base) = ($0 =~ m!\b([^/]+)\z!) unless defined $base; my $tmpdir = File::Temp->newdir("pi-$base-$$-XXXX", TMPDIR => 1); wantarray ? ($tmpdir->dirname, $tmpdir) : $tmpdir; }