From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7348014F70 for ; Mon, 28 Sep 2026 20:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790628418; cv=none; b=i9SXAOUnxLYgnKAV3i4MJEcNLNnIkdycIbyd0gWiR9eFNo17QwT0pW7YydvQQzniqeuswRKU7lBz2NJOCSGgs82z4JFcO8OBYdZUZH97IBTo2jQFRfw/xmZcN8/OnPUfSOujDoWaDJE/AdwFPmij2hTpPh0bnZOWvrcwf4PVBHs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790628418; c=relaxed/simple; bh=kwydsidGTnaP94vgFP/lsj141vkcaHcjmgLrJ12xS54=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=iPWodKJkv+GkA6PULc+zRAXB334l+vqBvF55bP7b7OAox5lESkm5ey/pFLtzjNz/vEdMaVB12dW/onIWpqia4mTFU3lDbluPPor5wh4SsEpaN8EvjWt6h2zpQRyaGEG39SPgAV3IgmIF+BiXuHixIw3a5jnZeIH0DMrqRSUZ0DY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=T5/3o+b0; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=KIvY30sQ; arc=none smtp.client-ip=202.12.124.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="T5/3o+b0"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="KIvY30sQ" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.stl.internal (Postfix) with ESMTP id 763321D00019; Mon, 28 Sep 2026 16:46:55 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-07.internal (MEProxy); Mon, 28 Sep 2026 16:46:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1790628415; x=1790714815; bh=KrQUNC7sxr KrzZPTHB5tvlnzLulbbb5S8WkeAz/ektw=; b=T5/3o+b0WFeWiEOiS5SnSWmWuu Ob1vn31VdxEO+EANleMmJQ/ttE2mZ9MV+/KOBPVVmy94tOX8RBSPskLYvah9T/BP LvKdOftmdswRUdpjZDQ4SKHF4PLTNc8dKTlQ3MNnIf+LuoAhvWKBwxn/7wY6AJcq uBGPrcqo0zpnWCW4G5B4fu1ndjx/nYlnryHPeu6EAinRPxaOEatwLwEb+XB29wnc tpC3Mn98cTKtKHwm+UJXkH102MQxyjRBsu0zZJmk2cQ+jPOPUH12Nsetp/4e+Muv xP/SW8I1tgl6lOGuxqCeirH5voc5yulMc/hHi3QgLwJ5Nbz7NAuXKnKZB4+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1790628415; x=1790714815; bh=KrQUNC7sxrKrzZPTHB5tvlnzLulbb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8gbH5TiC7dF+WJpdw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Sep 2026 16:46:54 -0400 (EDT) From: Junio C Hamano To: "Harald Nordgren via GitGitGadget" Cc: git@vger.kernel.org, Ben Knoble , Phillip Wood , Harald Nordgren Subject: Re: [PATCH v2 1/2] ci: annotate leaks and stop a leak-sanitizer script at its first failure In-Reply-To: <46e13a6e77f0c1c23a0dfe6183e8c3dac405da89.1790621693.git.gitgitgadget@gmail.com> (Harald Nordgren via GitGitGadget's message of "Mon, 28 Sep 2026 18:54:52 +0000") References: <46e13a6e77f0c1c23a0dfe6183e8c3dac405da89.1790621693.git.gitgitgadget@gmail.com> Date: Mon, 28 Sep 2026 13:46:53 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Harald Nordgren via GitGitGadget" writes: > From: Harald Nordgren > > A leak is only discovered once, at the end of a whole script, well > after every test has already reported ok, and it gets no annotation at > all, so a leak-sanitizer job's only visible failure is: > > Process completed with exit code 1. > > Give a leak its own annotation. Point it at the test script, the exact > line isn't known, only which script the leak turned up in, and put the > full sanitizer report in a log group next to it, so it stays visible > and isn't capped to a handful of lines. > > Once a script has one leak, it keeps running: the sanitizer log > directory is never cleared between tests, so every later test in the > same script sees the same leftover log entries and also reports "not > ok", burying the one real failure in copies of itself. Stop a > leak-sanitizer script at its first failure with --immediate instead. OK. So the idea is that we do not have sanitizer report per test_expect_* block but showing the single one over and over, whether the next test_expect_* block has leaks, is not helpful, so we just immediately kill the test script after the first leak? > @@ -53,4 +58,15 @@ finalize_test_case_output () { > echo >>$github_markup_output "::endgroup::" > } > > +finalize_test_leak_output () { > + # The exact line the leak turned up on isn't known, only the script, > + # so point at line 1. > + github_annotation_ error "t/$github_markup_script_name" 1 \ > + "memory leak logged in $this_test" > + > + echo >>$github_markup_output "::group::leak: $this_test.$test_count" > + cat "$TEST_RESULTS_SAN_FILE".* >>$github_markup_output > + echo >>$github_markup_output "::endgroup::" > +} > + > diff --git a/t/test-lib.sh b/t/test-lib.sh > index 1f0505e412..3552a19323 100644 > --- a/t/test-lib.sh > +++ b/t/test-lib.sh > @@ -199,6 +199,7 @@ mark_option_requires_arg () { > start_test_output () { :; } > start_test_case_output () { :; } > finalize_test_case_output () { :; } > +finalize_test_leak_output () { :; } > finalize_test_output () { :; } > > parse_option () { > @@ -822,20 +823,23 @@ test_failure_ () { > say_color error "not ok $test_count - ${pfx:+$pfx }$1" > shift > printf '%s\n' "$*" | sed -e 's/^/# /' > + if test -n "$immediate" && test -n "$invert_exit_code" > + then > + say_color error "1..$test_count" > + finalize_test_output > + _invert_exit_code_failure_end_blurb > + GIT_EXIT_OK=t > + exit 0 > + fi > + # Write the annotation before the --immediate exit paths below, > + # which call exit and would otherwise skip it. > + finalize_test_case_output failure "$failure_label" "$@" > if test -n "$immediate" > then > say_color error "1..$test_count" > - if test -n "$invert_exit_code" > - then > - finalize_test_output > - _invert_exit_code_failure_end_blurb > - GIT_EXIT_OK=t > - exit 0 > - fi > check_test_results_san_file_ "$test_failure" > _error_exit > fi The two-line comment in the middle made me puzzled to see "exit 0" just above it. If "--immediate" is asked and we are checking leaks, shouldn't we be doing finalize_test_case_output regardless of the "invert" setting? > - finalize_test_case_output failure "$failure_label" "$@" > } > > test_known_broken_ok_ () { > @@ -1218,6 +1222,7 @@ check_test_results_san_file_ () { > return > fi && > say_color >&4 error "$(cat "$TEST_RESULTS_SAN_FILE".*)" && > + finalize_test_leak_output && > > if test "$test_failure" = 0 > then