git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 0/4] test-lib: improve LSAN + ASAN stack traces

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 27, 2022, 10:25 UTC
Message-ID
<cover-v4-0.4-00000000000-20220227T102256Z-avarab@gmail.com>
In-Reply-To
<cover-v3-0.4-00000000000-20220221T155656Z-avarab@gmail.com>

A UX improvement for [AL]SAN stack traces. See https://lore.kernel.org/git/cover-v3-0.4-00000000000-20220221T155656Z-avarab@gmail.com/ for the v3.

Changes since v3:
 * Add a comment/assertion in 2/4 about what "t" directory we
   expect/must have.
 * The 3/4 "change" is only for rebasing on the new 2/4.
Ævar Arnfjörð Bjarmason (4):
  test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS
  test-lib: correct and assert TEST_DIRECTORY overriding
  test-lib: make $GIT_BUILD_DIR an absolute path
  test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS
 t/test-lib.sh | 50 ++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 40 insertions(+), 10 deletions(-)
Range-diff against v3:
1:  bf31efca464 = 1:  d1967ab34a5 test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS
2:  33a628e9c3a ! 2:  97586ad4541 test-lib: correct commentary on TEST_DIRECTORY overriding
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Commit message ##
    -    test-lib: correct commentary on TEST_DIRECTORY overriding
    +    test-lib: correct and assert TEST_DIRECTORY overriding
     
         Correct a misleading comment added by me in 62f539043c7 (test-lib:
    -    Allow overriding of TEST_DIRECTORY, 2010-08-19).
    +    Allow overriding of TEST_DIRECTORY, 2010-08-19), and add an assertion
    +    that TEST_DIRECTORY cannot point to any directory except the "t"
    +    directory in the top-level of git.git.
     
    -    Between that comment and the later addition of
    +    This assertion is in effect not new, since we'd already die if that
    +    wasn't the case[1], but it and the updated commentary help to make
    +    that clearer.
    +
    +    The existing comments were also on the wrong arms of the
    +    "if". I.e. the "allow tests to override this" was on the "test -z"
    +    arm. That came about due to a combination of 62f539043c7 and
         85176d72513 (test-lib.sh: convert $TEST_DIRECTORY to an absolute path,
    -    2013-11-17) the comments were on the wrong arms of the "if". I.e. the
    -    "allow tests to override this" was on the "test -z" arm.
    +    2013-11-17).
     
    -    But more importantly this could be read allowing the "$TEST_DIRECTORY"
    +    Those earlier comments could be read as allowing the "$TEST_DIRECTORY"
         to be some path outside of t/. As explained in the updated comment
         that's impossible, rather it was meant for *tests* that ran outside of
         t/, i.e. the "t0000-basic.sh" tests that use "lib-subtest.sh".
    @@ Commit message
         reflect that, and further comment on why we have a hard dependency on
         this.
     
    +    1. https://lore.kernel.org/git/220222.86o82z8als.gmgdl@evledraar.gmail.com/
    +
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## t/test-lib.sh ##
    @@ t/test-lib.sh
      	TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
      fi
      if test -z "$TEST_OUTPUT_DIRECTORY"
    +@@ t/test-lib.sh: then
    + 	TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
    + fi
    + GIT_BUILD_DIR="$TEST_DIRECTORY"/..
    ++if test "$TEST_DIRECTORY" = "${TEST_DIRECTORY%/t}"
    ++then
    ++	echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
    ++	exit 1
    ++fi
    + 
    + # Prepend a string to a VAR using an arbitrary ":" delimiter, not
    + # adding the delimiter if VAR or VALUE is empty. I.e. a generalized:
3:  b03ae29fc92 ! 3:  c25c4532c72 test-lib: make $GIT_BUILD_DIR an absolute path
    @@ t/test-lib.sh: then
      	TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
      fi
     -GIT_BUILD_DIR="$TEST_DIRECTORY"/..
    +-if test "$TEST_DIRECTORY" = "${TEST_DIRECTORY%/t}"
     +GIT_BUILD_DIR="${TEST_DIRECTORY%/t}"
    - 
    - # Prepend a string to a VAR using an arbitrary ":" delimiter, not
    - # adding the delimiter if VAR or VALUE is empty. I.e. a generalized:
    ++if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR"
    + then
    + 	echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
    + 	exit 1
     @@ t/test-lib.sh: prepend_var () {
      # problems. The GIT_SAN_OPTIONS variable can be used to set common
      # defaults shared between [AL]SAN_OPTIONS.
4:  d212009e517 = 4:  fa4946ce7ef test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS
-- 
2.35.1.1188.g137d9ee5e75
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 35 of 39 in “test-lib: improve LSAN + ASAN stack traces”
  1. 0/4 test-lib: improve LSAN + ASAN stack tracesÆvar Arnfjörð Bjarmason, Feb 18, 2022
  2. 1/4 test-lib: add XSAN_OPTIONS, inherit [AL]SAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 18, 2022
  3. Junio C HamanoFeb 18, 2022
  4. Taylor BlauFeb 19, 2022
  5. Ævar Arnfjörð BjarmasonFeb 19, 2022
  6. Taylor BlauFeb 19, 2022
  7. Ævar Arnfjörð BjarmasonFeb 19, 2022
  8. Taylor BlauFeb 19, 2022
  9. 2/4 test-lib: make $GIT_BUILD_DIR an absolute pathÆvar Arnfjörð Bjarmason, Feb 18, 2022
  10. Junio C HamanoFeb 18, 2022
  11. Ævar Arnfjörð BjarmasonFeb 19, 2022
  12. 0/4 test-lib: improve LSAN + ASAN stack tracesÆvar Arnfjörð Bjarmason, Feb 19, 2022
  13. 1/4 test-lib: add GIT_XSAN_OPTIONS, inherit [AL]SAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 19, 2022
  14. Junio C HamanoFeb 20, 2022
  15. 2/4 test-lib: correct commentary on TEST_DIRECTORY overridingÆvar Arnfjörð Bjarmason, Feb 19, 2022
  16. 3/4 test-lib: make $GIT_BUILD_DIR an absolute pathÆvar Arnfjörð Bjarmason, Feb 19, 2022
  17. 4/4 test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 19, 2022
  18. Taylor BlauFeb 21, 2022
  19. 0/4 test-lib: improve LSAN + ASAN stack tracesÆvar Arnfjörð Bjarmason, Feb 21, 2022
  20. 1/4 test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 21, 2022
  21. 2/4 test-lib: correct commentary on TEST_DIRECTORY overridingÆvar Arnfjörð Bjarmason, Feb 21, 2022
  22. 3/4 test-lib: make $GIT_BUILD_DIR an absolute pathÆvar Arnfjörð Bjarmason, Feb 21, 2022
  23. Taylor BlauFeb 21, 2022
  24. Ævar Arnfjörð BjarmasonFeb 21, 2022
  25. Junio C HamanoFeb 22, 2022
  26. Ævar Arnfjörð BjarmasonFeb 22, 2022
  27. Junio C HamanoFeb 23, 2022
  28. Ævar Arnfjörð BjarmasonFeb 24, 2022
  29. Junio C HamanoFeb 24, 2022
  30. 4/4 test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 21, 2022
  31. Taylor BlauFeb 21, 2022
  32. Ævar Arnfjörð BjarmasonFeb 21, 2022
  33. Junio C HamanoFeb 21, 2022
  34. Ævar Arnfjörð BjarmasonFeb 21, 2022
  35. 0/4 test-lib: improve LSAN + ASAN stack tracesÆvar Arnfjörð Bjarmason, Feb 27, 2022
  36. 1/4 test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 27, 2022
  37. 2/4 test-lib: correct and assert TEST_DIRECTORY overridingÆvar Arnfjörð Bjarmason, Feb 27, 2022
  38. 3/4 test-lib: make $GIT_BUILD_DIR an absolute pathÆvar Arnfjörð Bjarmason, Feb 27, 2022
  39. 4/4 test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONSÆvar Arnfjörð Bjarmason, Feb 27, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.