diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-07-27 16:16:52 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-07-27 16:16:52 (GMT) |
commit | 7c7719ac0e24d61fc82a47502f05f11f8ddceec6 (patch) | |
tree | b5fe9724baffb381e4fabcb5ec1c09acedf8e1f6 /t | |
parent | 36d7bd19cfe14f7f7ab546764c3879e037573069 (diff) | |
parent | 3a251bac0d1a05b3dd9df45c45b40e2747829ca3 (diff) | |
download | git-7c7719ac0e24d61fc82a47502f05f11f8ddceec6.zip git-7c7719ac0e24d61fc82a47502f05f11f8ddceec6.tar.gz git-7c7719ac0e24d61fc82a47502f05f11f8ddceec6.tar.bz2 |
Merge branch 'ab/squelch-empty-fsync-traces'
Omit fsync-related trace2 entries when their values are all zero.
* ab/squelch-empty-fsync-traces:
trace2: only include "fsync" events if we git_fsync()
Diffstat (limited to 't')
-rw-r--r-- | t/t0212/parse_events.perl | 19 | ||||
-rwxr-xr-x | t/t5351-unpack-large-objects.sh | 22 |
2 files changed, 34 insertions, 7 deletions
diff --git a/t/t0212/parse_events.perl b/t/t0212/parse_events.perl index b640856..30a9f51 100644 --- a/t/t0212/parse_events.perl +++ b/t/t0212/parse_events.perl @@ -216,12 +216,19 @@ while (<>) { elsif ($event eq 'data') { my $cat = $line->{'category'}; - if ($cat eq 'test_category') { - - my $key = $line->{'key'}; - my $value = $line->{'value'}; - $processes->{$sid}->{'data'}->{$cat}->{$key} = $value; - } + my $key = $line->{'key'}; + my $value = $line->{'value'}; + $processes->{$sid}->{'data'}->{$cat}->{$key} = $value; + } + + elsif ($event eq 'data_json') { + # NEEDSWORK: Ignore due to + # compat/win32/trace2_win32_process_info.c, which should log a + # "cmd_ancestry" event instead. + } + + else { + push @{$processes->{$sid}->{$event}} => $line->{value}; } # This trace2 target does not emit 'printf' events. diff --git a/t/t5351-unpack-large-objects.sh b/t/t5351-unpack-large-objects.sh index 8ce8aa3..f785cb0 100755 --- a/t/t5351-unpack-large-objects.sh +++ b/t/t5351-unpack-large-objects.sh @@ -48,13 +48,33 @@ test_expect_success 'unpack big object in stream' ' test_dir_is_empty dest.git/objects/pack ' +check_fsync_events () { + local trace="$1" && + shift && + + cat >expect && + sed -n \ + -e '/^{"event":"data",.*"category":"fsync",/ { + s/.*"category":"fsync",//; + s/}$//; + p; + }' \ + <"$trace" >actual && + test_cmp expect actual +} + BATCH_CONFIGURATION='-c core.fsync=loose-object -c core.fsyncmethod=batch' test_expect_success 'unpack big object in stream (core.fsyncmethod=batch)' ' prepare_dest 1m && GIT_TRACE2_EVENT="$(pwd)/trace2.txt" \ + GIT_TEST_FSYNC=true \ git -C dest.git $BATCH_CONFIGURATION unpack-objects <pack-$PACK.pack && - grep fsync/hardware-flush trace2.txt && + check_fsync_events trace2.txt <<-\EOF && + "key":"fsync/writeout-only","value":"6" + "key":"fsync/hardware-flush","value":"1" + EOF + test_dir_is_empty dest.git/objects/pack && git -C dest.git cat-file --batch-check="%(objectname)" <obj-list >current && cmp obj-list current |