[Why]
Result rootfs of dailybuild requires multiple test jobs.
[How]
1. jobs/iso2rootfs.yaml.
Before:
test_yaml, test_os_mount, test_testbox
After:
test1_yaml, test1_os_mount, test1_testbox
test2_yaml, test2_os_mount, test2_testbox
...
2. tests/iso2rootfs.
- Use while-loop to traverse if $testX_yaml exists.
- [ -n "${test1_yaml}" ] || return 0.
Signed-off-by: Yu Chuan <13186087857(a)163.com>
---
jobs/iso2rootfs.yaml | 8 ++++---
tests/iso2rootfs | 52 +++++++++++++++++++++++++++++---------------
2 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml
index 222ac309d33e..f88ff02ad592 100644
--- a/jobs/iso2rootfs.yaml
+++ b/jobs/iso2rootfs.yaml
@@ -21,6 +21,8 @@ iso2rootfs:
dailybuild_iso_url_file:
# submit test yaml related fields
- test_yaml:
- test_os_mount:
- test_testbox:
+ ## 1. you can add as many jobs as you like.
+ ## 2. the following three fields is requied for every test job.
+ test1_yaml:
+ test1_os_mount:
+ test1_testbox:
diff --git a/tests/iso2rootfs b/tests/iso2rootfs
index 4f6e3e578ce4..48c1fc772890 100755
--- a/tests/iso2rootfs
+++ b/tests/iso2rootfs
@@ -56,7 +56,7 @@ check_yaml_vars()
for yaml_t in "${yaml_vars[@]}"
do
- [ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
+ [ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot find value of var: ${yaml_t}."
done
}
@@ -451,17 +451,33 @@ generate_submit_append_str()
echo "os=${iso_os} os_arch=${iso_arch} os_version=${iso_version} os_mount=$1 testbox=$2"
}
-submit_test_job_yaml()
+submit_one_yaml()
{
- [ -n ${test_yaml} ] || return 0
-
log_info "starting submit ${test_yaml} ..."
- [ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
+ cd "${LKP_SRC}/jobs"
+ [ -f "${test_yaml}" ] || die "cannot find yaml in LKP_SRC/jobs: ${test_yaml}."
+
+ local test_os_mount="$(eval echo "\$${test_num}_os_mount")"
+ local test_testbox="$(eval echo "\$${test_num}_testbox")"
+
+ [ -n "${test_os_mount}" ] || die "cannot find value of var: ${test_num}_os_mount."
+ [ -n "${test_testbox}" ] || die "cannot find value of var: ${test_num}_testbox."
- [ -n "${test_os_mount}" ] || die "cannot fine value of var: test_os_mount."
- [ -n "${test_testbox}" ] || die "cannot fine value of var: test_testbox."
+ "${LKP_SRC}/sbin/submit" \
+ $(generate_submit_append_str "${test_os_mount}" "${test_testbox}") \
+ "${test_yaml}"
+ log_info "submit ${test_yaml} finished"
+}
+
+submit_yamls()
+{
+ [ -n "$test1_yaml" ] || return 0
+
+ log_info "starting submit test yamls ..."
+
+ [ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
cd "${LKP_SRC}" && {
chmod +x ./sbin/install-dependencies.sh
./sbin/install-dependencies.sh
@@ -469,17 +485,19 @@ submit_test_job_yaml()
generate_global_yaml
}
- cd "${LKP_SRC}/jobs" && {
- [ -f "${test_yaml}" ] ||
- die "cannot find test yaml in LKP_SRC/jobs.
- test yaml: ${test_yaml}."
+ local test_yaml_index=1
+ local test_num="test${test_yaml_index}"
+ local test_yaml="$(eval echo "\$${test_num}_yaml")"
- "${LKP_SRC}/sbin/submit" \
- $(generate_submit_append_str "${test_os_mount}" "${test_testbox}") \
- "${test_yaml}"
- }
+ while [ -n "${test_yaml}" ]
+ do
+ submit_one_yaml
+ test_yaml_index=$((${test_yaml_index} +1))
+ test_num="test${test_yaml_index}"
+ test_yaml="$(eval echo "\$${test_num}_yaml")"
+ done
- log_info "submit ${test_yaml} finished"
+ log_info "submit test yamls finished"
}
############ post works ############
@@ -519,7 +537,7 @@ main()
config_rootfs
test_rootfs
- submit_test_job_yaml
+ submit_yamls
post_works
}
--
2.23.0