From 08b6b26056bbf7e1167a7c65e3a96181317607d4 Mon Sep 17 00:00:00 2001 From: Kostiantyn Kostiuk Date: Mon, 23 Feb 2026 16:46:24 +0200 Subject: [PATCH] Try to export HLKX package even when test run crashed Signed-off-by: Kostiantyn Kostiuk --- lib/engines/hcktest/hcktest.rb | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/engines/hcktest/hcktest.rb b/lib/engines/hcktest/hcktest.rb index f11492db..9c80cad1 100644 --- a/lib/engines/hcktest/hcktest.rb +++ b/lib/engines/hcktest/hcktest.rb @@ -269,15 +269,31 @@ def prepare_tests @test_list = @tests.update_tests(log: true) end + def rescue2return + yield + nil + rescue StandardError => e + @project.logger.error("HCKTest encountered an error: (#{e.class}) #{e.message}") + e + end + def auto_run ResourceScope.open do |scope| run_studio scope sleep 5 until @studio.up? - - run_tests_without_config - run_tests_with_config - - @tests.create_project_package + # Try to export the project package even if some of the steps fail, it can be + # used to simplify the HLK process by reusing the created package and just fixing + # the root cause of the failure without the need to run all other tests + ex1 = rescue2return { run_tests_without_config } + ex2 = rescue2return { run_tests_with_config } + + ex3 = rescue2return { @tests.create_project_package } + + # Propagate the first exception if any occurred; the most likely other exceptions are just + # consequences of the first one and will be resolved after fixing the first root cause + raise ex1 if ex1 + raise ex2 if ex2 + raise ex3 if ex3 end end