[PATCH v8 lkp-tests 1/3] job2sh.rb: define on_state

[why] If job.yaml is defined: on_fail: sleep(tests): 300(runtime) [how] By on_fail(sh_on_state), it will appear in job.sh: on_fail() { . $LKP_SRC/lib/job.sh . $LKP_SRC/lib/env.sh run_test $LKP_SRC/tests/wrapper sleep 300 } Signed-off-by: Hu XueJiao <1034502035@qq.com> --- lib/job2sh.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/job2sh.rb b/lib/job2sh.rb index 9c8b578d..9d0a7bb2 100755 --- a/lib/job2sh.rb +++ b/lib/job2sh.rb @@ -363,14 +363,14 @@ class Job2sh < Job out_line "}\n\n" end - def sh_on_state(job = nil) + def sh_on_state(state = nil, job = nil) @script_lines = [] @programs = available_programs(:workload_elements) job ||= (@jobx || @job).clone - if job.include?('on_fail') + if state == "on_fail" && job.include?('on_fail') @cur_func = :run_job -- 2.23.0
participants (1)
-
Hu Xuejiao