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

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

 



A UX improvement for [AL]SAN stack traces. See
https://lore.kernel.org/git/cover-v3-0.4-00000000000-20220221T155656Z-avarab@xxxxxxxxx/
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@xxxxxxxxx>
     
      ## 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@xxxxxxxxxxxxxxxxxxx/
    +
         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
     
      ## 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




[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