Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s67f7-00AD2r-W4 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 May 2024 11:46:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s67f6-00Ag4k-AX for pgsql-hackers@arkaria.postgresql.org; Sun, 12 May 2024 11:46:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s67f4-00Ag4c-KQ for pgsql-hackers@lists.postgresql.org; Sun, 12 May 2024 11:46:40 +0000 Received: from wfhigh8-smtp.messagingengine.com ([64.147.123.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s67f0-000cya-W6 for pgsql-hackers@lists.postgresql.org; Sun, 12 May 2024 11:46:37 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id A523018000E4; Sun, 12 May 2024 07:46:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 12 May 2024 07:46:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding: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=fm2; t=1715514392; x=1715600792; bh=EoYhlUGS/jKuX8EFaLU1vZUD9yS5hUWmyaBe9hK/VUw=; b= kF3UNgyeHW6wugLUlMtLqK0BLXBWiHQIJn3PJpAbo1GArFdab8+NsvjdS9k1UTep +BGESnG2C+jWYs1XB8lJmMOcJzANS12EfXyOjXAJ3GK5ivNQaLiY9TiP2JZJOKlg l001u3upofa/kB3Mqjhj1l4q4JEsdYszqgMBFudPKxaKYeGg4YRcm6EYg8FcgWKm GhGaAPb/yK41Et2/6Y/PLnhgz3TIprkc9blu4QW+E3TmtuPYmVm+YG4tJgk7qlNC djxhsvPpuoVk0OIUiwUPxIqmbcEQDqA4pHCrV6DJ/uZhwk2sE27Wvrs4ZiYwxqqN OnKkmtkuXFaZ2oo/QEv1vw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715514392; x= 1715600792; bh=EoYhlUGS/jKuX8EFaLU1vZUD9yS5hUWmyaBe9hK/VUw=; b=S YpsA1QGJcW2ob65E24eRD6ehLmcq8LCtLjKjrxiW0wXwED6qJQKMkd/FvSeZb9fC wtp6FROIbv2QIIxPIRT+KYfUkpVkUVb97Y2M26iax9o5rn0Uj/iLBSBjyll9RtqL wW8ykeaQOFnBOhDXXmM0PuqgUxt8eXiR6C/bhP4JY6PlOp2onO8YpreCbrbcRcCn xfpjMlGTVl/Pw9l36RE1yVU5S/7PaHKNNz5Dka8sVLnL5CCdr12lvtN/WQkaEjhS 5Ez9k4/Kj5MMka1qADgiXGw2VEUdIbnrstUtAtqv3FE2p/I2bKe29odZXEayQruT NshurrvtCpBuLrxy/cuJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdegvddggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttddvjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqe enucggtffrrghtthgvrhhnpeehvddvvdevvdetieegheffieegtddtjedutdejgfdvheeu gffgteffteduvefhvdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdhgih hthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 May 2024 07:46:31 -0400 (EDT) Message-ID: <86ebc1d3-b1fc-4ad3-a976-2eb79d9bd424@eisentraut.org> Date: Sun, 12 May 2024 13:46:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add TAP tests for backtrace functionality (was Re: Add test module for verifying backtrace functionality) To: Bharath Rupireddy , PostgreSQL Hackers References: Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 16.03.24 05:25, Bharath Rupireddy wrote: >>> Postgres has a good amount of code for dealing with backtraces - two >>> GUCs backtrace_functions and backtrace_on_internal_error, >>> errbacktrace; all of which use core function set_backtrace from >>> elog.c. I've not seen this code being tested at all, see code coverage >>> report - https://coverage.postgresql.org/src/backend/utils/error/elog.c.gcov.html. >>> >>> I think adding a simple test module (containing no .c files) with only >>> TAP tests will help cover this code. I ended up having it as a >>> separate module under src/test/modules/test_backtrace as I was not >>> able to find an existing TAP file in src/test to add these tests. I'm >>> able to verify the backtrace related code with the attached patch >>> consistently. The TAP tests rely on the fact that the server emits >>> text "BACKTRACE: " to server logs before logging the backtrace, and >>> the backtrace contains the function name in which the error occurs. >>> I've turned off query statement logging (set log_statement = none, >>> log_min_error_statement = fatal) so that the tests get to see the >>> functions only in the backtrace. Although the CF bot is happy with the >>> attached patch https://github.com/BRupireddy2/postgres/tree/add_test_module_for_bcktrace_functionality_v1, >>> there might be some more flakiness to it. >>> >>> Thoughts? >> >> Ran pgperltidy on the new TAP test file added. Please see the attached v2 patch. > > I've now moved the new TAP test file to src/test/modules/test_misc/t > as opposed to a new test module to keep it simple. I was not sure why > I hadn't done that in the first place. Note that backtrace_on_internal_error has been removed, so this patch will need to be adjusted for that. I suggest you consider joining forces with thread [0] where a replacement for backtrace_on_internal_error would be discussed. Having some test coverage for whatever is being developed there might be useful. [0]: https://www.postgresql.org/message-id/flat/CAGECzQTpdujCEt2SH4DBwRLoDq4HJArGDaxJSsWX0G=tNnzaVA@mail.gmail.com