Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-29 03:15:52 +0300
committerJunio C Hamano <gitster@pobox.com>2021-10-29 20:22:40 +0300
commit412e4caee387d825903bf1252aefbd5cf995a599 (patch)
tree3a2104c1ac2fd9c9630d2ab02ea1dfc7ea8cadc8 /write-or-die.c
parentaf6d1d602a8f64164b266364339c4e936d5bbc33 (diff)
tests: disable fsync everywhere
The "GIT_TEST_FSYNC" environment variable now exists for disabling fsync() even on packfiles and other "critical" data. Running "make test -j8 NO_SVN_TESTS=1" on a noisy 8-core system on an HDD, test runtime drops from ~4 minutes down to ~3 minutes. Using "GIT_TEST_FSYNC=1" re-enables fsync() for comparison purposes. SVN interopability tests are minimally affected since SVN will still use fsync in various places. This will also be useful for 3rd-party tools which create throwaway git repositories of temporary data, but remains undocumented for end users. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'write-or-die.c')
-rw-r--r--write-or-die.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/write-or-die.c b/write-or-die.c
index d33e68f6ab..4e48194676 100644
--- a/write-or-die.c
+++ b/write-or-die.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "config.h"
#include "run-command.h"
/*
@@ -57,6 +58,10 @@ void fprintf_or_die(FILE *f, const char *fmt, ...)
void fsync_or_die(int fd, const char *msg)
{
+ if (use_fsync < 0)
+ use_fsync = git_env_bool("GIT_TEST_FSYNC", 1);
+ if (!use_fsync)
+ return;
while (fsync(fd) < 0) {
if (errno != EINTR)
die_errno("fsync error on '%s'", msg);