From 37aebed40124daabe126efc6961c5a37585bcba7 Mon Sep 17 00:00:00 2001 From: Suneeth D Date: Tue, 15 Sep 2026 11:10:25 +0000 Subject: [PATCH] Fix: Ungracefull error handling of benchmark run failures Few microbenchmarks when fails to run because of unmet machine requirements exit without running, but lkp just exits without handling it gracefully. With this patch lkp returns a non-zero exit status on such scenarios and handle gracefully with appropiate error messages. Signed-off-by: Suneeth D --- bin/run-local | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/bin/run-local b/bin/run-local index 5155f1358..a892dd9cf 100755 --- a/bin/run-local +++ b/bin/run-local @@ -115,6 +115,7 @@ job['rootfs'] ||= if File.exist? '/etc/os-release' distro end job['nr_cpu'] ||= Etc.nprocessors +job['nr_node'] ||= Dir.glob('/sys/devices/system/node/node[0-9]*').size job['memory'] ||= (Bash.safe_grep("grep -w '^memory:' #{LKP_SRC}/hosts/#{HOSTNAME}").split[1] || '').chomp job['compiler'] ||= File.realpath('/usr/bin/gcc').match(/gcc.*/).to_s job['compiler'] = 'gcc' if job['compiler'].empty? @@ -132,9 +133,14 @@ ENV['RESULT_ROOT'] = result_root ENV['TMP_RESULT_ROOT'] = result_root jobx = Job2sh.new(job.to_hash) -unless jobx.expand_params - log_error 'Failed to expand params!' - exit +begin + unless jobx.expand_params + log_error 'Failed to expand params!' + exit 1 + end +rescue Job::ParamError => e + log_error e.message + exit 1 end FileUtils.rm_rf TMP @@ -150,7 +156,11 @@ save_paths(result_root, user) system 'killall', '-q', "#{LKP_SRC}/bin/event/wakeup" -with_thp_enabled { system job_script, 'run_job' } +run_job_status = 0 +with_thp_enabled do + system job_script, 'run_job' + run_job_status = $?.exitstatus +end system "#{LKP_SRC}/bin/run-with-job", job_script, "#{LKP_SRC}/bin/post-run" system "#{LKP_SRC}/bin/event/wakeup", 'job-finished' @@ -169,3 +179,5 @@ convert_mrt(_result_root) FileUtils.rm_f(options[:result_root]) FileUtils.ln_s(result_root, options[:result_root]) + +exit run_job_status unless run_job_status.zero?