[why]
Originally submit_job is too complicated, it need to be simplified.
Signed-off-by: Hu XueJiao <1034502035(a)qq.com>
---
spec/submit_spec.rb | 55 +++++++++++++++++----------------------------
1 file changed, 21 insertions(+), 34 deletions(-)
diff --git a/spec/submit_spec.rb b/spec/submit_spec.rb
index 4096cb73..e2361b13 100644
--- a/spec/submit_spec.rb
+++ b/spec/submit_spec.rb
@@ -20,40 +20,27 @@ def traverse_file(output_dir)
end
end
-def submit_job(submit_item)
- submit_yaml_path = File.join("#{LKP_SRC}/spec/submit", submit_item)
- Dir.glob("#{submit_yaml_path}/*.yaml").each do |yaml_file|
- output_dir = File.join(submit_yaml_path, File.basename(yaml_file, '.yaml'))
- submit_cmd = [
- "#{LKP_SRC}/sbin/submit",
- '-o', output_dir,
- '-s', 'lab: spec_lab',
- '-s', 'testbox: vm-2p8g--spec_submit',
- yaml_file
- ]
- system(*submit_cmd)
- traverse_file(output_dir)
+def submit_job()
+ submit_path = "#{LKP_SRC}/spec/submit"
+ Dir.foreach(submit_path) do |sub|
+ next if sub == '.' || sub == '..'
+
+ path = "#{submit_path}/#{sub}"
+ if File.directory?(path)
+ Dir.glob("#{path}/*.yaml").each do |yaml_file|
+ output_dir = File.join(path, File.basename(yaml_file, '.yaml'))
+ submit_cmd = [
+ "#{LKP_SRC}/sbin/submit",
+ '-o', output_dir,
+ '-s', 'lab: spec_lab',
+ '-s', 'testbox: vm-2p8g--spec_submit',
+ yaml_file
+ ]
+ system(*submit_cmd)
+ traverse_file(output_dir)
+ end
+ end
end
end
-describe 'submit job spec' do
- it 'link jobs spec' do
- submit_job('link_jobs')
- end
-
- it 'link matrix' do
- submit_job('matrix')
- end
-
- it 'separate yaml spec' do
- submit_job('separate_yaml')
- end
-
- it 'job on fail' do
- submit_job('job_on_fail')
- end
-
- it 'merge yaml' do
- submit_job('merge_yaml')
- end
-end
+submit_job
--
2.23.0