mbox series

[v3,0/4] test-lib: improve LSAN + ASAN stack traces

Message ID cover-v3-0.4-00000000000-20220221T155656Z-avarab@gmail.com (mailing list archive)
Headers show
Series test-lib: improve LSAN + ASAN stack traces | expand

Message

Ævar Arnfjörð Bjarmason Feb. 21, 2022, 3:58 p.m. UTC
A UX improvement for [AL]SAN stack traces. See
https://lore.kernel.org/git/cover-v2-0.4-00000000000-20220219T112653Z-avarab@gmail.com/
for the v2.

Changes:
 * Renamed GIT_XSAN_OPTIONS to GIT_SAN_OPTIONS per Junio's suggestion
 * Fixed grammar ("do do do...")" in commit message.

Ævar Arnfjörð Bjarmason (4):
  test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS
  test-lib: correct commentary on 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 | 45 +++++++++++++++++++++++++++++++++++----------
 1 file changed, 35 insertions(+), 10 deletions(-)

Range-diff against v2:
1:  01e63a72231 ! 1:  bf31efca464 test-lib: add GIT_XSAN_OPTIONS, inherit [AL]SAN_OPTIONS
    @@ Metadata
     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
     
      ## Commit message ##
    -    test-lib: add GIT_XSAN_OPTIONS, inherit [AL]SAN_OPTIONS
    +    test-lib: add GIT_SAN_OPTIONS, inherit [AL]SAN_OPTIONS
     
         Change our ASAN_OPTIONS and LSAN_OPTIONS to set defaults for those
         variables, rather than punting out entirely if we already have them in
         the environment.
     
    -    We do want to take any user-provided settings over our own, but we can
    -    do do that by prepending our defaults to the variable. The
    -    libsanitizer options parsing has "last option wins" semantics.
    +    We want to take any user-provided settings over our own, but we can do
    +    that by prepending our defaults to the variable. The libsanitizer
    +    options parsing has "last option wins" semantics.
     
         It's now possible to do e.g.:
     
    @@ t/test-lib.sh: then
     +}
     +
     +# If [AL]SAN is in effect we want to abort so that we notice
    -+# problems. The GIT_XSAN_OPTIONS variable can be used to set common
    ++# problems. The GIT_SAN_OPTIONS variable can be used to set common
     +# defaults shared between [AL]SAN_OPTIONS.
    -+prepend_var GIT_XSAN_OPTIONS : abort_on_error=1
    ++prepend_var GIT_SAN_OPTIONS : abort_on_error=1
     +
      # If we were built with ASAN, it may complain about leaks
      # of program-lifetime variables. Disable it by default to lower
    @@ t/test-lib.sh: then
      # before we even do our "did we build git yet" check (since we don't
      # want that one to complain to stderr).
     -: ${ASAN_OPTIONS=detect_leaks=0:abort_on_error=1}
    -+prepend_var ASAN_OPTIONS : $GIT_XSAN_OPTIONS
    ++prepend_var ASAN_OPTIONS : $GIT_SAN_OPTIONS
     +prepend_var ASAN_OPTIONS : detect_leaks=0
      export ASAN_OPTIONS
      
     -# If LSAN is in effect we _do_ want leak checking, but we still
     -# want to abort so that we notice the problems.
     -: ${LSAN_OPTIONS=abort_on_error=1}
    -+prepend_var LSAN_OPTIONS : $GIT_XSAN_OPTIONS
    ++prepend_var LSAN_OPTIONS : $GIT_SAN_OPTIONS
      export LSAN_OPTIONS
      
      if test ! -f "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
2:  0c2867e30dc = 2:  33a628e9c3a test-lib: correct commentary on TEST_DIRECTORY overriding
3:  229654027b8 ! 3:  b03ae29fc92 test-lib: make $GIT_BUILD_DIR an absolute path
    @@ t/test-lib.sh: then
      # Prepend a string to a VAR using an arbitrary ":" delimiter, not
      # adding the delimiter if VAR or VALUE is empty. I.e. a generalized:
     @@ t/test-lib.sh: prepend_var () {
    - # problems. The GIT_XSAN_OPTIONS variable can be used to set common
    + # problems. The GIT_SAN_OPTIONS variable can be used to set common
      # defaults shared between [AL]SAN_OPTIONS.
    - prepend_var GIT_XSAN_OPTIONS : abort_on_error=1
    -+prepend_var GIT_XSAN_OPTIONS : strip_path_prefix=\"$GIT_BUILD_DIR/\"
    + prepend_var GIT_SAN_OPTIONS : abort_on_error=1
    ++prepend_var GIT_SAN_OPTIONS : strip_path_prefix=\"$GIT_BUILD_DIR/\"
      
      # If we were built with ASAN, it may complain about leaks
      # of program-lifetime variables. Disable it by default to lower
4:  e6a48b6e4ce ! 4:  d212009e517 test-lib: add "fast_unwind_on_malloc=0" to LSAN_OPTIONS
    @@ t/test-lib.sh
     @@ t/test-lib.sh: prepend_var ASAN_OPTIONS : detect_leaks=0
      export ASAN_OPTIONS
      
    - prepend_var LSAN_OPTIONS : $GIT_XSAN_OPTIONS
    + prepend_var LSAN_OPTIONS : $GIT_SAN_OPTIONS
     +prepend_var LSAN_OPTIONS : fast_unwind_on_malloc=0
      export LSAN_OPTIONS

Comments

Junio C Hamano Feb. 21, 2022, 5:16 p.m. UTC | #1
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> A UX improvement for [AL]SAN stack traces. See
> https://lore.kernel.org/git/cover-v2-0.4-00000000000-20220219T112653Z-avarab@gmail.com/
> for the v2.
>
> Changes:
>  * Renamed GIT_XSAN_OPTIONS to GIT_SAN_OPTIONS per Junio's suggestion

Heh, I wasn't suggesting anything.  I am OK with or without X, or
with X but X replaced with anything else ;-)
Ævar Arnfjörð Bjarmason Feb. 21, 2022, 6:55 p.m. UTC | #2
On Mon, Feb 21 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> A UX improvement for [AL]SAN stack traces. See
>> https://lore.kernel.org/git/cover-v2-0.4-00000000000-20220219T112653Z-avarab@gmail.com/
>> for the v2.
>>
>> Changes:
>>  * Renamed GIT_XSAN_OPTIONS to GIT_SAN_OPTIONS per Junio's suggestion
>
> Heh, I wasn't suggesting anything.  I am OK with or without X, or
> with X but X replaced with anything else ;-)

Ah, anyway I'm happy with this version, so unless there's another reason
for a re-roll...