Merge branch 'ps/leakfixes-part-10' into ps/bisect-double-free-fix

* ps/leakfixes-part-10: (27 commits)
  t: remove TEST_PASSES_SANITIZE_LEAK annotations
  test-lib: unconditionally enable leak checking
  t: remove unneeded !SANITIZE_LEAK prerequisites
  t: mark some tests as leak free
  t5601: work around leak sanitizer issue
  git-compat-util: drop now-unused `UNLEAK()` macro
  global: drop `UNLEAK()` annotation
  t/helper: fix leaking commit graph in "read-graph" subcommand
  builtin/branch: fix leaking sorting options
  builtin/init-db: fix leaking directory paths
  builtin/help: fix leaks in `check_git_cmd()`
  help: fix leaking return value from `help_unknown_cmd()`
  help: fix leaking `struct cmdnames`
  help: refactor to not use globals for reading config
  builtin/sparse-checkout: fix leaking sanitized patterns
  split-index: fix memory leak in `move_cache_to_base_index()`
  git: refactor builtin handling to use a `struct strvec`
  git: refactor alias handling to use a `struct strvec`
  strvec: introduce new `strvec_splice()` function
  line-log: fix leak when rewriting commit parents
  ...
This commit is contained in:
Junio C Hamano
2024-11-26 10:21:58 +09:00
950 changed files with 360 additions and 1248 deletions

View File

@ -1180,23 +1180,7 @@ check_test_results_san_file_ () {
fi &&
say_color error "$(cat "$TEST_RESULTS_SAN_FILE".*)" &&
if test -n "$passes_sanitize_leak" && test "$test_failure" = 0
then
say "As TEST_PASSES_SANITIZE_LEAK=true and our logs show we're leaking, exit non-zero!" &&
invert_exit_code=t
elif test -n "$passes_sanitize_leak"
then
say "As TEST_PASSES_SANITIZE_LEAK=true and our logs show we're leaking, and we're failing for other reasons too..." &&
invert_exit_code=
elif test -n "$sanitize_leak_check" && test "$test_failure" = 0
then
say "As TEST_PASSES_SANITIZE_LEAK=true isn't set the above leak is 'ok' with GIT_TEST_PASSING_SANITIZE_LEAK=check" &&
invert_exit_code=
elif test -n "$sanitize_leak_check"
then
say "As TEST_PASSES_SANITIZE_LEAK=true isn't set the above leak is 'ok' with GIT_TEST_PASSING_SANITIZE_LEAK=check" &&
invert_exit_code=t
elif test "$test_failure" = 0
if test "$test_failure" = 0
then
say "Our logs revealed a memory leak, exit non-zero!" &&
invert_exit_code=t
@ -1227,11 +1211,6 @@ test_done () {
EOF
fi
if test -z "$passes_sanitize_leak" && test_bool_env TEST_PASSES_SANITIZE_LEAK false
then
BAIL_OUT "Please, set TEST_PASSES_SANITIZE_LEAK before sourcing test-lib.sh"
fi
if test "$test_fixed" != 0
then
say_color error "# $test_fixed known breakage(s) vanished; please update test(s)"
@ -1518,51 +1497,8 @@ then
test_done
fi
BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK () {
BAIL_OUT "$1 has no effect except when compiled with SANITIZE=leak"
}
if test -n "$SANITIZE_LEAK"
then
# Normalize with test_bool_env
passes_sanitize_leak=
# We need to see TEST_PASSES_SANITIZE_LEAK in "test-tool
# env-helper" (via test_bool_env)
export TEST_PASSES_SANITIZE_LEAK
if test_bool_env TEST_PASSES_SANITIZE_LEAK false
then
passes_sanitize_leak=t
fi
if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing"
then
if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing" &&
test -n "$passes_sanitize_leak"
then
skip_all="skipping leak-free $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=check-failing"
test_done
fi
sanitize_leak_check=t
if test -n "$invert_exit_code"
then
BAIL_OUT "cannot use --invert-exit-code under GIT_TEST_PASSING_SANITIZE_LEAK=check"
fi
if test -z "$passes_sanitize_leak"
then
say "in GIT_TEST_PASSING_SANITIZE_LEAK=check mode, setting --invert-exit-code for TEST_PASSES_SANITIZE_LEAK != true"
invert_exit_code=t
fi
elif test -z "$passes_sanitize_leak" &&
test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
then
skip_all="skipping $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=true"
test_done
fi
rm -rf "$TEST_RESULTS_SAN_DIR"
if ! mkdir -p "$TEST_RESULTS_SAN_DIR"
then
@ -1577,12 +1513,6 @@ then
prepend_var LSAN_OPTIONS : log_exe_name=1
prepend_var LSAN_OPTIONS : log_path="'$TEST_RESULTS_SAN_FILE'"
export LSAN_OPTIONS
elif test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing" ||
test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
then
BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK "GIT_TEST_PASSING_SANITIZE_LEAK=true"
fi
if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&