[Why] Not all the yaml and script of test job will be committed to the lkp-tests repo.
[How] Support three optional fields for every test: - testX_git_url: the url of git repo which contains yaml and script; - testX_git_yaml: the relative path of the yaml file in the git repo; - testX_git_script: the relative path of the test script in the git repo;
Signed-off-by: Yu Chuan 13186087857@163.com --- jobs/iso2rootfs.yaml | 5 +++++ tests/iso2rootfs | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index 3c69a9d98430..c9a31cd0ad00 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -22,3 +22,8 @@ iso2rootfs: test1_yaml: test1_os_mount: test1_testbox: + ## follow three fields is required when your job.yaml and script for + ## this test are from the internet. + test1_git_url: + test1_git_yaml: + test1_git_script: diff --git a/tests/iso2rootfs b/tests/iso2rootfs index a38685118b7f..1ba2e8a31ef8 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -447,10 +447,35 @@ generate_submit_append_str() echo "os=${iso_os} os_arch=${iso_arch} os_version=${iso_version} os_mount=$1 testbox=$2" }
+prepare_submit() +{ + local submit_dir="/tmp/iso2rootfs/submit_tmp" + [ -d "${submit_dir}" ] || mkdir -p "${submit_dir}" + local submit_git_dir="${submit_dir}/${test_git_url##*/}" + submit_git_dir="${submit_git_dir%.git}" + + [ -d "${submit_git_dir}" ] || { + cd "${submit_dir}" + git clone "${test_git_url}" + } + + local test_git_yaml="${submit_git_dir}/$(eval echo "$${test_num}_git_yaml")" + local test_git_script="${submit_git_dir}/$(eval echo "$${test_num}_git_script")" + + [ -f "${test_git_yaml}" ] || die "cannot find file: ${test_num}_git_yaml." + cp "${test_git_yaml}" "${LKP_SRC}/jobs/" + + [ -f "${test_git_script}" ] || return 0 + cp "${test_git_script}" "${LKP_SRC}/tests/" +} + submit_one_yaml() { log_info "starting submit ${test_yaml} ..."
+ local test_git_url="$(eval echo "$${test_num}_git_url")" + [ -z "${test_git_url}" ] || prepare_submit + cd "${LKP_SRC}/jobs" [ -f "${test_yaml}" ] || die "cannot find test yaml in LKP_SRC/jobs.