From patchwork Wed Nov 1 13:02:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13442814 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 BA02C134A0 for ; Wed, 1 Nov 2023 13:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="DCtDHzwk"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kQvLYYSd" Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49F7FDC for ; Wed, 1 Nov 2023 06:03:00 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A79195C0269; Wed, 1 Nov 2023 09:02:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 01 Nov 2023 09:02:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1698843779; x=1698930179; bh=TN gHE3eW3QgP29f/nRrshY84o6/TYHcWEg//ZXA83nc=; b=DCtDHzwkj6Z30MtDgg uYumjiykYxcpevdGoaLUW1LDPAiPWsVndTSs9mW8PdIzG9uD8sGWujJR5Kk6xopE 3xCNcy+blXO4OeyTsjNCyxOA2dfNgJcwrvNK263a+/U2wJUuj9Q3/W97nE2wMngx ypgn6ewj+J3+SbB01Udhg+9+tjeZFyA7Tqf2CqmCFq1I0QT/6rP85Z9Y2/rw1E7r 9OyzibJtnefc8Vcp/LlOlkd61q4eP7NQnL1155Kr3TVo0XfcnkQwykfFWJXymN+0 lVujqi6JPtOeAIGxeullDtcNnZTorm1NMgCUuKc+wefN3AeROg01ZXegScz5aeVf /Bog== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698843779; x=1698930179; bh=TNgHE3eW3QgP2 9f/nRrshY84o6/TYHcWEg//ZXA83nc=; b=kQvLYYSdTc0ir7CacVNTV0rBIOIOq DwHpp75w4+F9qZYileTGfgj9nPnj1DWuUUUsgemfkzUwI9GzBtECWdz5GF1LaB2w NLOjNK5LXLkkBHpvjhA10LrfFbIpdMnrE4IPfXxPKt+ewqAQlT0WkBxdfy4pjVRu WoB3sy5vnHI0/fRanNzv2UZNjyle86QpHTNCWsHntDgoE4rsXSTW6bXbIjxZ+NV1 g43/4PLAuRuGknp5WAAOx6xjqpPUu7fzVFBqf3Iggl7ZjYI+hIVDrkkoD0WPkQAI yUAlWRFo2hVzChNxQqJYDHzPjKnYwv9/4Su438kl5GKz3PNltDLo6fZCw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddtgedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Nov 2023 09:02:58 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 1987f110 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 1 Nov 2023 13:02:47 +0000 (UTC) Date: Wed, 1 Nov 2023 14:02:56 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Taylor Blau , Junio C Hamano , Phillip Wood , Oswald Buddenhagen , Victoria Dye Subject: [PATCH v5 4/8] ci: split out logic to set up failed test artifacts Message-ID: <2182acf5bfce5abf00287b035d321a9cb5b18941.1698843660.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: We have some logic in place to create a directory with the output from failed tests, which will then subsequently be uploaded as CI artifacts. We're about to add support for GitLab CI, which will want to reuse the logic. Split the logic into a separate function so that it is reusable. Signed-off-by: Patrick Steinhardt --- ci/lib.sh | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/ci/lib.sh b/ci/lib.sh index b3411afae8e..9ffdf743903 100755 --- a/ci/lib.sh +++ b/ci/lib.sh @@ -131,6 +131,27 @@ handle_failed_tests () { return 1 } +create_failed_test_artifacts () { + mkdir -p t/failed-test-artifacts + + for test_exit in t/test-results/*.exit + do + test 0 != "$(cat "$test_exit")" || continue + + test_name="${test_exit%.exit}" + test_name="${test_name##*/}" + printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n" + echo "The full logs are in the 'print test failures' step below." + echo "See also the 'failed-tests-*' artifacts attached to this run." + cat "t/test-results/$test_name.markup" + + trash_dir="t/trash directory.$test_name" + cp "t/test-results/$test_name.out" t/failed-test-artifacts/ + tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" + done + return 1 +} + # GitHub Action doesn't set TERM, which is required by tput export TERM=${TERM:-dumb} @@ -171,25 +192,8 @@ then CC="${CC_PACKAGE:-${CC:-gcc}}" DONT_SKIP_TAGS=t handle_failed_tests () { - mkdir -p t/failed-test-artifacts echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV - - for test_exit in t/test-results/*.exit - do - test 0 != "$(cat "$test_exit")" || continue - - test_name="${test_exit%.exit}" - test_name="${test_name##*/}" - printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n" - echo "The full logs are in the 'print test failures' step below." - echo "See also the 'failed-tests-*' artifacts attached to this run." - cat "t/test-results/$test_name.markup" - - trash_dir="t/trash directory.$test_name" - cp "t/test-results/$test_name.out" t/failed-test-artifacts/ - tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" - done - return 1 + create_failed_test_artifacts } cache_dir="$HOME/none"