656
test_cmp expect actual
657
'
658
659
+test_expect_success 'setup trace2' '
660
+ GIT_TRACE2_BRIEF=1 &&
661
+ export GIT_TRACE2_BRIEF
662
+'
663
+
664
test_expect_success TTY 'git returns SIGPIPE on early pager exit' '
660
- test_when_finished "rm pager-used" &&
665
+ test_when_finished "rm pager-used trace.normal" &&
666
test_config core.pager ">pager-used; head -n 1; exit 0" &&
667
+ GIT_TRACE2="$(pwd)/trace.normal" &&
668
+ export GIT_TRACE2 &&
669
+ test_when_finished "unset GIT_TRACE2" &&
670
671
if test_have_prereq !MINGW
672
then
675
else
676
test_terminal git log
677
fi &&
678
+
679
+ grep child_exit trace.normal >child-exits &&
680
+ test_line_count = 1 child-exits &&
681
+ grep " code:0 " child-exits &&
682
test_path_is_file pager-used
683
'
684
685
test_expect_success TTY 'git returns SIGPIPE on early pager non-zero exit' '
674
- test_when_finished "rm pager-used" &&
686
+ test_when_finished "rm pager-used trace.normal" &&
687
test_config core.pager ">pager-used; head -n 1; exit 1" &&
688
+ GIT_TRACE2="$(pwd)/trace.normal" &&
689
+ export GIT_TRACE2 &&
690
+ test_when_finished "unset GIT_TRACE2" &&
691
692
if test_have_prereq !MINGW
693
then
696
else
697
test_terminal git log
698
fi &&
699
+
700
+ grep child_exit trace.normal >child-exits &&
701
+ test_line_count = 1 child-exits &&
702
+ grep " code:1 " child-exits &&
703
test_path_is_file pager-used
704
'
705
706
test_expect_success TTY 'git discards pager non-zero exit without SIGPIPE' '
688
- test_when_finished "rm pager-used" &&
707
+ test_when_finished "rm pager-used trace.normal" &&
708
test_config core.pager "wc >pager-used; exit 1" &&
709
+ GIT_TRACE2="$(pwd)/trace.normal" &&
710
+ export GIT_TRACE2 &&
711
+ test_when_finished "unset GIT_TRACE2" &&
712
713
if test_have_prereq !MINGW
714
then
717
else
718
test_terminal git log
719
fi &&
720
+
721
+ grep child_exit trace.normal >child-exits &&
722
+ test_line_count = 1 child-exits &&
723
+ grep " code:1 " child-exits &&
724
test_path_is_file pager-used
725
'
726
727
test_expect_success TTY 'git discards nonexisting pager without SIGPIPE' '
702
- test_when_finished "rm pager-used" &&
728
+ test_when_finished "rm pager-used trace.normal" &&
729
test_config core.pager "wc >pager-used; does-not-exist" &&
730
+ GIT_TRACE2="$(pwd)/trace.normal" &&
731
+ export GIT_TRACE2 &&
732
+ test_when_finished "unset GIT_TRACE2" &&
733
734
if test_have_prereq !MINGW
735
then
738
else
739
test_terminal git log
740
fi &&
741
+
742
+ grep child_exit trace.normal >child-exits &&
743
+ test_line_count = 1 child-exits &&
744
+ grep " code:127 " child-exits &&
745
test_path_is_file pager-used
746
'
747
748
test_expect_success TTY 'git attempts to page to nonexisting pager command, gets SIGPIPE' '
749
+ test_when_finished "rm trace.normal" &&
750
test_config core.pager "does-not-exist" &&
751
+ GIT_TRACE2="$(pwd)/trace.normal" &&
752
+ export GIT_TRACE2 &&
753
+ test_when_finished "unset GIT_TRACE2" &&
754
755
if test_have_prereq !MINGW
756
then
758
test_match_signal 13 "$OUT"
759
else
760
test_terminal git log
724
- fi
761
+ fi &&
762
+
763
+ grep child_exit trace.normal >child-exits &&
764
+ test_line_count = 1 child-exits &&
765
+ grep " code:-1 " child-exits
766
'
767
768
test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
728
- test_when_finished "rm pager-used" &&
769
+ test_when_finished "rm pager-used trace.normal" &&
770
test_config core.pager ">pager-used; test-tool sigchain" &&
771
+ GIT_TRACE2="$(pwd)/trace.normal" &&
772
+ export GIT_TRACE2 &&
773
+ test_when_finished "unset GIT_TRACE2" &&
774
775
if test_have_prereq !MINGW
776
then
779
else
780
test_terminal git log
781
fi &&
782
+
783
+ grep child_exit trace.normal >child-exits &&
784
+ test_line_count = 1 child-exits &&
785
+ grep " code:143 " child-exits &&
786
test_path_is_file pager-used
787
'
788