[PATCH v6 0/8] progress: assert "global_progress" + test fixes / cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A minor but important fixup of v5[1], as pointed out by Carlo Arenas
the STDIN_FILENO I added in response to feedback in an earlier re-roll
had a pretty bad off-by-one bug.

As an aside that we have no tests for this "git bisect" code at all is
pretty bad, I'll try to address that separately from this series.

https://lore.kernel.org/git/cover-v5-0.8-00000000000-20211101T190630Z-avarab@xxxxxxxxx/

Ævar Arnfjörð Bjarmason (8):
  leak tests: fix a memory leaks in "test-progress" helper
  progress.c test helper: add missing braces
  progress.c tests: make start/stop commands on stdin
  progress.c tests: test some invalid usage
  progress.c: add temporary variable from progress struct
  pack-bitmap-write.c: don't return without stop_progress()
  various *.c: use isatty(0|2), not isatty(STDIN_FILENO|STDERR_FILENO)
  progress.c: add & assert a "global_progress" variable

 builtin/bisect--helper.c    |   2 +-
 builtin/bundle.c            |   2 +-
 compat/mingw.c              |   2 +-
 pack-bitmap-write.c         |   6 +--
 progress.c                  |  23 +++++++-
 t/helper/test-progress.c    |  52 +++++++++++++-----
 t/t0500-progress-display.sh | 105 ++++++++++++++++++++++++++++--------
 7 files changed, 150 insertions(+), 42 deletions(-)

Range-diff against v5:
1:  0c0e5bfc656 = 1:  88d89652831 leak tests: fix a memory leaks in "test-progress" helper
2:  0ae86e40e16 = 2:  2fa92e7db83 progress.c test helper: add missing braces
3:  767aa010026 = 3:  400b491449e progress.c tests: make start/stop commands on stdin
4:  9bcc8cfc9d2 = 4:  7557975a122 progress.c tests: test some invalid usage
5:  3a95613cd04 = 5:  61c8da31aeb progress.c: add temporary variable from progress struct
6:  0300b802dcb = 6:  f6a76b80e91 pack-bitmap-write.c: don't return without stop_progress()
7:  4795d4835b0 ! 7:  1a2eadf28d0 various *.c: use isatty(1|2), not isatty(STDIN_FILENO|STDERR_FILENO)
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
     
      ## Commit message ##
    -    various *.c: use isatty(1|2), not isatty(STDIN_FILENO|STDERR_FILENO)
    +    various *.c: use isatty(0|2), not isatty(STDIN_FILENO|STDERR_FILENO)
     
         We have over 50 uses of "isatty(1)" and "isatty(2)" in the codebase,
    -    only these two used the stdlib.h macros to refer to them.
    +    and around 10 "isatty(0)", but these used the
    +    {STDIN_FILENO,STD{OUT,ERR}_FILENO} macros in "stdlib.h" to refer to
    +    them.
     
         Let's change these for consistency, and because a subsequent commit's
         commit message outlines a recipe to change all of these for ad-hoc
    @@ builtin/bisect--helper.c: static int bisect_autostart(struct bisect_terms *terms
      			  "start\"\n"));
      
     -	if (!isatty(STDIN_FILENO))
    -+	if (!isatty(1))
    ++	if (!isatty(0))
      		return -1;
      
      	/*
8:  e58f4a0c1b9 = 8:  bff919994b5 progress.c: add & assert a "global_progress" variable
-- 
2.33.1.1570.g069344fdd45




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux