Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyc50-0006ha-Au for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 15:24:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyc4z-000050-9j for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jun 2021 15:24:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyc4z-00004r-1g for pgsql-hackers@lists.postgresql.org; Wed, 30 Jun 2021 15:24:45 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyc4t-000413-11 for pgsql-hackers@lists.postgresql.org; Wed, 30 Jun 2021 15:24:44 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6365F5C0217 for ; Wed, 30 Jun 2021 11:24:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 30 Jun 2021 11:24:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=wDt9OP pnY1hjoZcKtYu/mUgxI2lndaFazm2tNsUCy9M=; b=S0t4N/Ck4O4Qxzz1CkoBLs djDfNZ525vCjmYdskLJ12kVNN3zvRVr+tQdzSrTwBNJz/vdjTCxNrzteCJlm0fx7 0oqE+LvDxNwaTDJrsDYOp8Cke8+WoOd/g7jmiCdrc+uqhs6ehLjuR+XTIrxg9Rys fpN55qbFonB3GnkpUCUW+lkK9AtNe5pSPsPAzvtCI+VPKQzXpMwM8bprsFXY6q9R OWS2W/soj6dKb7RH6BRnqIlKmr1j1mL9/+DNsypZkuvDPhRFC1Yq7nUe3XPsvJha lPJP8hIBCLZl4qfg2lKQ3oGtZIe0u+mQOR2LT140saR32i7T23mVwlFQaTYXqOnQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeeivddgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfesmhekreertddtudenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepkeekvdevudetieevgfethffgffdtfedtvefftddtveejleek jedvffejtdeiueffnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 30 Jun 2021 11:24:36 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E95352A085A; Wed, 30 Jun 2021 11:24:33 -0400 (-04) Date: Wed, 30 Jun 2021 11:24:33 -0400 From: Alvaro Herrera To: Pg Hackers Subject: trivial improvement to system_or_bail Message-ID: <202106301524.eq5pblzstapj@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yuz3qblvk75nj6k6" Content-Disposition: inline Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --yuz3qblvk75nj6k6 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit When PostgresNode::system_or_bail() fails, it's quite opaque as to what is happening. This patch improves things by printing some detail, as suggested in Perl's doc for system(). -- Álvaro Herrera 39°49'30"S 73°17'W https://www.EnterpriseDB.com/ --yuz3qblvk75nj6k6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="system_or_bail.patch" AuthorDate: Tue Jun 15 12:46:42 2021 -0400 CommitDate: Tue Jun 15 12:46:54 2021 -0400 improve TestLib::system_or_bail reporting of system() failures diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 26fbe08d4b..eb49923b42 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -375,7 +375,18 @@ sub system_or_bail { if (system_log(@_) != 0) { - BAIL_OUT("system $_[0] failed"); + if ($? == -1) + { + BAIL_OUT("system $_[0] failed: $!\n"); + } + elsif ($? & 127) + { + BAIL_OUT(sprintf("system $_[0] died with signal %d\n", $? & 127)); + } + else + { + BAIL_OUT(sprintf("system $_[0] exited with value %d\n", $? >> 8)); + } } return; } --yuz3qblvk75nj6k6--