From patchwork Wed Nov 3 22:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 12601797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28C2BC433F5 for ; Wed, 3 Nov 2021 22:44:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA4F06052B for ; Wed, 3 Nov 2021 22:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbhKCWq6 (ORCPT ); Wed, 3 Nov 2021 18:46:58 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:56822 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbhKCWq5 (ORCPT ); Wed, 3 Nov 2021 18:46:57 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id AD881E5EB0; Wed, 3 Nov 2021 18:44:19 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=xPCDb4NfnrCM DZHwvcHv7/JQSXkRkT0kRA1sJ7acQOo=; b=yegn1zBxYsTvZZJEAaFE31tTZ/uB cL/+vjBrTCoiiYrOQ6PPjQ30RGoErF03wKhQLPqbFXkaXwvxDK5KbsyZb7AoA2pL 5dGkW2x/P/Y12cOhyTnfU0zjbvB9fJgjWz6c+Q06QI8GvxPMvuctQqoYCF2qt4UV q29XhoAB619cWAQ= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 92600E5EAF; Wed, 3 Nov 2021 18:44:19 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id D9AC5E5EAE; Wed, 3 Nov 2021 18:44:18 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: git@vger.kernel.org, Jeff King , Andrzej Hunt , =?utf-8?b?TMOpbmHDr2M=?= Huard , Derrick Stolee , Felipe Contreras , SZEDER =?utf-8?b?R8OhYm9y?= , =?utf-8?b?xJBvw6BuIFRy?= =?utf-8?b?4bqnbiBDw7RuZw==?= Danh , Carlo Marcelo Arenas =?utf-8?b?QmVsw7Nu?= Subject: Re* [PATCH v8 2/2] tests: add a test mode for SANITIZE=leak, run it in CI References: Date: Wed, 03 Nov 2021 15:44:17 -0700 In-Reply-To: ( =?utf-8?b?IsOGdmFyIEFybmZqw7Zyw7A=?= Bjarmason"'s message of "Thu, 23 Sep 2021 11:20:46 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Pobox-Relay-ID: 9496C79A-3CF7-11EC-827B-62A2C8D8090B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Ævar Arnfjörð Bjarmason writes: > The CI target uses a new GIT_TEST_PASSING_SANITIZE_LEAK=true test > mode. When running in that mode, we'll assert that we were compiled > with SANITIZE=leak. We'll then skip all tests, except those that we've > opted-in by setting "TEST_PASSES_SANITIZE_LEAK=true". > ... > This is how tests that don't set "TEST_PASSES_SANITIZE_LEAK=true" will > be skipped under GIT_TEST_PASSING_SANITIZE_LEAK=true: I've been playing with this locally, but cannot shake the nagging feeling that GIT_TEST_PASSING_SANITIZE_LEAK must default to true. Otherwise, it is one more thing they need to find out and set when they do make SANITYZE=leak test because they want to be a good developer and to ensure that they did not introduce new leaks. If we want to encourage folks to locally run the leak checks before declaring their own work "done", that is. Those who are hunting for and cleaning up existing leaks can and should set it to false, no? In any case, here is a small fallout out of my adventure into this corner. ----- >8 --------- >8 --------- >8 --------- >8 ----- Subject: t0006: date_mode can leak .strftime_fmt member As there is no date_mode_release() API function, and given the set of current callers it probably is not worth adding one, let's release the .strftime_fmt member that is obtained from strdup() before the caller of show_date() is done with it. This allows us to mark t0006 as passing under the leak sanitizer. Signed-off-by: Junio C Hamano --- t/helper/test-date.c | 2 ++ t/t0006-date.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git c/t/helper/test-date.c w/t/helper/test-date.c index 099eff4f0f..e15ea02626 100644 --- c/t/helper/test-date.c +++ w/t/helper/test-date.c @@ -53,6 +53,8 @@ static void show_dates(const char **argv, const char *format) printf("%s -> %s\n", *argv, show_date(t, tz, &mode)); } + + free((void *)mode.strftime_fmt); } static void parse_dates(const char **argv) diff --git c/t/t0006-date.sh w/t/t0006-date.sh index 6b757d7169..5d01f57b27 100755 --- c/t/t0006-date.sh +++ w/t/t0006-date.sh @@ -1,6 +1,8 @@ #!/bin/sh test_description='test date parsing and printing' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh # arbitrary reference time: 2009-08-30 19:20:00