[why] If job.yaml is defined: on_fail: sleep(tests): 300(runtime)
[how] By sh_on_fail, it will appear in job.sh: on_fail() { . $LKP_SRC/lib/http.sh . $LKP_SRC/lib/job.sh . $LKP_SRC/lib/env.sh
export_top_env
run_test $LKP_SRC/tests/wrapper sleep 500 }
Signed-off-by: Hu XueJiao 1034502035@qq.com --- lib/job2sh.rb | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/lib/job2sh.rb b/lib/job2sh.rb index 9c95ff4b..6e00b088 100755 --- a/lib/job2sh.rb +++ b/lib/job2sh.rb @@ -142,7 +142,7 @@ class Job2sh < Job end
def parse_one(ancestors, key, val, pass) - if ['pp', 'define_files', 'monitors'].include?(key) + if ['pp', 'define_files', 'monitors','on_fail'].include?(key) return false end tabs = indent(ancestors) @@ -266,11 +266,13 @@ class Job2sh < Job sh_run_job(job) local_script_lines += @script_lines
- sh_extract_stats(job) local_script_lines += @script_lines
sh_define_files() + local_script_lines += @script_lines + + sh_on_fail(job)
out_line '"$@"'
@@ -357,6 +359,30 @@ class Job2sh < Job out_line "\tchmod +x $LKP_SRC/#{file}" end end - out_line '}' + out_line "}\n\n" + end + + def sh_on_fail(job = nil) + @script_lines = [] + + @programs = available_programs(:workload_elements) + + if !job + job = (@jobx || @job).clone + end + + @cur_func = :on_fail + + out_line 'on_fail()' + out_line '{' + out_line + out_line "\t. $LKP_SRC/lib/http.sh" + out_line "\t. $LKP_SRC/lib/job.sh" + out_line "\t. $LKP_SRC/lib/env.sh" + out_line + out_line "\texport_top_env" + out_line + parse_hash [], job['on_fail'] + out_line "}" end end
On Wed, Nov 04, 2020 at 12:26:35PM +0800, Hu Xuejiao wrote:
[why] If job.yaml is defined: on_fail: sleep(tests): 300(runtime)
[how] By sh_on_fail, it will appear in job.sh: on_fail() { . $LKP_SRC/lib/http.sh . $LKP_SRC/lib/job.sh . $LKP_SRC/lib/env.sh
export_top_env
run_test $LKP_SRC/tests/wrapper sleep 500 }
Signed-off-by: Hu XueJiao 1034502035@qq.com
lib/job2sh.rb | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/lib/job2sh.rb b/lib/job2sh.rb index 9c95ff4b..6e00b088 100755 --- a/lib/job2sh.rb +++ b/lib/job2sh.rb @@ -142,7 +142,7 @@ class Job2sh < Job end
def parse_one(ancestors, key, val, pass)
- if ['pp', 'define_files', 'monitors'].include?(key)
- if ['pp', 'define_files', 'monitors','on_fail'].include?(key)
Style: add space before 'on_fail'.
Thanks, Xijian
return false end tabs = indent(ancestors)
@@ -266,11 +266,13 @@ class Job2sh < Job sh_run_job(job) local_script_lines += @script_lines
sh_extract_stats(job) local_script_lines += @script_lines
sh_define_files()
local_script_lines += @script_lines
sh_on_fail(job)
out_line '"$@"'
@@ -357,6 +359,30 @@ class Job2sh < Job out_line "\tchmod +x $LKP_SRC/#{file}" end end
- out_line '}'
- out_line "}\n\n"
- end
- def sh_on_fail(job = nil)
- @script_lines = []
- @programs = available_programs(:workload_elements)
- if !job
job = (@jobx || @job).clone
- end
- @cur_func = :on_fail
- out_line 'on_fail()'
- out_line '{'
- out_line
- out_line "\t. $LKP_SRC/lib/http.sh"
- out_line "\t. $LKP_SRC/lib/job.sh"
- out_line "\t. $LKP_SRC/lib/env.sh"
- out_line
- out_line "\texport_top_env"
- out_line
- parse_hash [], job['on_fail']
- out_line "}" end
end
2.23.0
On Wed, Nov 04, 2020 at 12:26:35PM +0800, Hu Xuejiao wrote:
[why] If job.yaml is defined: on_fail: sleep(tests): 300(runtime)
[how] By sh_on_fail, it will appear in job.sh: on_fail() { . $LKP_SRC/lib/http.sh . $LKP_SRC/lib/job.sh . $LKP_SRC/lib/env.sh
export_top_env
run_test $LKP_SRC/tests/wrapper sleep 500 }
Signed-off-by: Hu XueJiao 1034502035@qq.com
lib/job2sh.rb | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/lib/job2sh.rb b/lib/job2sh.rb index 9c95ff4b..6e00b088 100755 --- a/lib/job2sh.rb +++ b/lib/job2sh.rb @@ -142,7 +142,7 @@ class Job2sh < Job end
def parse_one(ancestors, key, val, pass)
- if ['pp', 'define_files', 'monitors'].include?(key)
- if ['pp', 'define_files', 'monitors','on_fail'].include?(key)
^ add space
return false end tabs = indent(ancestors)
@@ -266,11 +266,13 @@ class Job2sh < Job sh_run_job(job) local_script_lines += @script_lines
sh_extract_stats(job) local_script_lines += @script_lines
sh_define_files()
local_script_lines += @script_lines
sh_on_fail(job)
out_line '"$@"'
@@ -357,6 +359,30 @@ class Job2sh < Job out_line "\tchmod +x $LKP_SRC/#{file}" end end
- out_line '}'
- out_line "}\n\n"
- end
- def sh_on_fail(job = nil)
- @script_lines = []
- @programs = available_programs(:workload_elements)
- if !job
if ! => unless
job = (@jobx || @job).clone
- end
job = (@jobx || @job).clone unless job
Thanks Luan Shengde
- @cur_func = :on_fail
- out_line 'on_fail()'
- out_line '{'
- out_line
- out_line "\t. $LKP_SRC/lib/http.sh"
- out_line "\t. $LKP_SRC/lib/job.sh"
- out_line "\t. $LKP_SRC/lib/env.sh"
- out_line
- out_line "\texport_top_env"
- out_line
- parse_hash [], job['on_fail']
- out_line "}" end
end
2.23.0