Skip to content

Commit ce50f1f

Browse files
dschogitster
authored andcommitted
t5351: avoid relying on core.fsyncMethod = batch to be supported
On FreeBSD, this mode is not supported. But since 3a251ba (trace2: only include "fsync" events if we git_fsync(), 2022-07-18) t5351 will fail if this mode is unsupported. Let's address this in the minimal fashion, by detecting that that mode is unsupported and expecting a different count of hardware flushes in that case. This fixes the CI/PR builds on FreeBSD again. Note: A better way would be to test only what is relevant in t5351.6 "unpack big object in stream (core.fsyncmethod=batch)" again instead of blindly comparing the output against some exact text. But that would pretty much revert the idea of above-mentioned commit, and that commit was _just_ accepted into Git's main branch so one must assume that it was intentional. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 23b219f commit ce50f1f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bulk-checkin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ void fsync_loose_object_bulk_checkin(int fd, const char *filename)
340340
*/
341341
if (!bulk_fsync_objdir ||
342342
git_fsync(fd, FSYNC_WRITEOUT_ONLY) < 0) {
343+
if (errno == ENOSYS)
344+
warning(_("core.fsyncMethod = batch is unsupported on this platform"));
343345
fsync_or_die(fd, filename);
344346
}
345347
}

t/t5351-unpack-large-objects.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,15 @@ test_expect_success 'unpack big object in stream (core.fsyncmethod=batch)' '
7070
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \
7171
GIT_TEST_FSYNC=true \
7272
git -C dest.git $BATCH_CONFIGURATION unpack-objects <pack-$PACK.pack &&
73-
check_fsync_events trace2.txt <<-\EOF &&
73+
if grep "core.fsyncMethod = batch is unsupported" trace2.txt
74+
then
75+
flush_count=7
76+
else
77+
flush_count=1
78+
fi &&
79+
check_fsync_events trace2.txt <<-EOF &&
7480
"key":"fsync/writeout-only","value":"6"
75-
"key":"fsync/hardware-flush","value":"1"
81+
"key":"fsync/hardware-flush","value":"$flush_count"
7682
EOF
7783
7884
test_dir_is_empty dest.git/objects/pack &&

0 commit comments

Comments
 (0)