[Why] If user only want generate a rootfs without testing, he can not write submit related fields in the job.yaml.
Signed-off-by: Yu Chuan 13186087857@163.com --- jobs/iso2rootfs.yaml | 2 ++ tests/iso2rootfs | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index 644c64be06b4..d4f0ffc0e80c 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -11,6 +11,8 @@ iso2rootfs: rootfs_path: initrd_http_host: initrd_http_port: + + # submit test yaml related fields test_yaml: test_os: test_os_arch: diff --git a/tests/iso2rootfs b/tests/iso2rootfs index e8a027b0dad2..f864188a8b02 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -53,12 +53,6 @@ check_yaml_vars() "rootfs_path" "initrd_http_host" "initrd_http_port" - "test_yaml" - "test_os" - "test_os_arch" - "test_os_version" - "test_os_mount" - "test_testbox" )
local yaml_t @@ -443,6 +437,20 @@ submit_test_job_yaml()
[ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
+ local test_yaml_vars=( + "test_os" + "test_os_arch" + "test_os_version" + "test_os_mount" + "test_testbox" + ) + + local yaml_t + for yaml_t in "${test_yaml_vars[@]}" + do + [ -n "$(eval echo "$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}." + done + cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh @@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs - submit_test_job_yaml + [ -z ${test_yaml} ] || submit_test_job_yaml
post_works }
On Fri, Nov 06, 2020 at 11:15:41AM +0800, Yu Chuan wrote:
[Why] If user only want generate a rootfs without testing, he can not write submit related fields in the job.yaml.
Signed-off-by: Yu Chuan 13186087857@163.com
jobs/iso2rootfs.yaml | 2 ++ tests/iso2rootfs | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/jobs/iso2rootfs.yaml b/jobs/iso2rootfs.yaml index 644c64be06b4..d4f0ffc0e80c 100644 --- a/jobs/iso2rootfs.yaml +++ b/jobs/iso2rootfs.yaml @@ -11,6 +11,8 @@ iso2rootfs: rootfs_path: initrd_http_host: initrd_http_port:
- # submit test yaml related fields test_yaml: test_os: test_os_arch:
diff --git a/tests/iso2rootfs b/tests/iso2rootfs index e8a027b0dad2..f864188a8b02 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -53,12 +53,6 @@ check_yaml_vars() "rootfs_path" "initrd_http_host" "initrd_http_port"
"test_yaml"
"test_os"
"test_os_arch"
"test_os_version"
"test_os_mount"
"test_testbox"
)
local yaml_t
@@ -443,6 +437,20 @@ submit_test_job_yaml()
[ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
- local test_yaml_vars=(
"test_os"
"test_os_arch"
"test_os_version"
"test_os_mount"
"test_testbox"
- )
- local yaml_t
- for yaml_t in "${test_yaml_vars[@]}"
there is no need to define "local yaml_t" for "for yaml_t in xxxx"
Thanks, Luan Shengde
- do
[ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
- done
- cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh
@@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs
- submit_test_job_yaml
[ -z ${test_yaml} ] || submit_test_job_yaml
post_works
}
2.23.0
@@ -443,6 +437,20 @@ submit_test_job_yaml()
[ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
- local test_yaml_vars=(
"test_os"
"test_os_arch"
"test_os_version"
"test_os_mount"
"test_testbox"
- )
- local yaml_t
- for yaml_t in "${test_yaml_vars[@]}"
there is no need to define "local yaml_t" for "for yaml_t in xxxx"
Good, but why? You mean we have no need to use 'local' to avoid change the value of possible glbal var 'yaml_t'?
-------- Thanks Yu Chuan
Thanks, Luan Shengde
- do
[ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
- done
- cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh
@@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs
- submit_test_job_yaml
[ -z ${test_yaml} ] || submit_test_job_yaml
post_works
}
2.23.0
On Wed, Nov 11, 2020 at 03:54:13PM +0800, Yu Chuan wrote:
@@ -443,6 +437,20 @@ submit_test_job_yaml()
[ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
- local test_yaml_vars=(
"test_os"
"test_os_arch"
"test_os_version"
"test_os_mount"
"test_testbox"
- )
- local yaml_t
- for yaml_t in "${test_yaml_vars[@]}"
there is no need to define "local yaml_t" for "for yaml_t in xxxx"
Good, but why? You mean we have no need to use 'local' to avoid change the value of possible glbal var 'yaml_t'?
yes
I tested it later and found that the variable works outside the function with its last value.
if the script has variable with same name, add loacl to avoid value override
Thanks, Luan Shengde
Thanks Yu Chuan
Thanks, Luan Shengde
- do
[ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
- done
- cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh
@@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs
- submit_test_job_yaml
[ -z ${test_yaml} ] || submit_test_job_yaml
post_works
}
2.23.0
@@ -443,6 +437,20 @@ submit_test_job_yaml()
[ -d "${LKP_SRC}" ] || die "cannot find value of var: LKP_SRC."
- local test_yaml_vars=(
"test_os"
"test_os_arch"
"test_os_version"
"test_os_mount"
"test_testbox"
- )
- local yaml_t
- for yaml_t in "${test_yaml_vars[@]}"
there is no need to define "local yaml_t" for "for yaml_t in xxxx"
Good, but why? You mean we have no need to use 'local' to avoid change the value of possible glbal var 'yaml_t'?
yes
I tested it later and found that the variable works outside the function with its last value.
if the script has variable with same name, add loacl to avoid value override
Good!
-------- Thanks Yu Chuan
Thanks, Luan Shengde
Thanks Yu Chuan
Thanks, Luan Shengde
- do
[ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
- done
- cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh
@@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs
- submit_test_job_yaml
[ -z ${test_yaml} ] || submit_test_job_yaml
post_works
}
2.23.0
- local yaml_t
- for yaml_t in "${test_yaml_vars[@]}"
what is yaml_t? strange name.
Thanks, Yinsi
- do
[ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
- done
- cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh
@@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs
- submit_test_job_yaml
[ -z ${test_yaml} ] || submit_test_job_yaml
post_works
}
2.23.0
On Fri, Nov 06, 2020 at 03:29:00PM +0800, Liu Yinsi wrote:
- local yaml_t
- for yaml_t in "${test_yaml_vars[@]}"
what is yaml_t? strange name.
yaml_t => yaml_tmp, maybe i ned use the full name. :)
-------- Thanks Yu Chuan
Thanks, Yinsi
- do
[ -n "$(eval echo "\$${yaml_t}")" ] || die "cannot fine value of var: ${yaml_t}."
- done
- cd "${LKP_SRC}" && { chmod +x ./sbin/install-dependencies.sh ./sbin/install-dependencies.sh
@@ -492,7 +500,7 @@ main() run_qcow2rootfs
test_rootfs
- submit_test_job_yaml
[ -z ${test_yaml} ] || submit_test_job_yaml
post_works
}
2.23.0