[PATCH v3 lkp-tests 3/3] iso2rootfs: solve the problem of multiple vmlinuz failures during test

[Why] Due to compass-ci patch: - git repo: https://gitee.com/wu_fengguang/compass-ci.git - commit id: 960aff501db5645c57459b317d0ce4dd3924f7bc As a result, when getting var(kernel_path), the vmlinuz soft link is also included, and our var(kernel_path) gets two identical vmlinuz. root cause: yuchuan@localhost rootfs_dir% ls -hl boot/vmlinuz* lrwxrwxrwx 1 root root 41 Nov 12 12:03 boot/vmlinuz -> vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 -rwxr-xr-x 1 root root 7.1M Nov 12 11:54 boot/vmlinuz-0-rescue-47178e4890764247aa6a35b8517bbc82 -rw-r--r-- 1 root root 20M Nov 12 12:04 boot/vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 yuchuan@localhost rootfs_dir% ls -hl boot/vmlinuz-* -rwxr-xr-x 1 root root 7.1M Nov 12 11:54 boot/vmlinuz-0-rescue-47178e4890764247aa6a35b8517bbc82 -rw-r--r-- 1 root root 20M Nov 12 12:04 boot/vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 [How] 1. When filtering vmlinuz: Before: realpath {rootfs_dir}/boot/vmlinuz* | grep -v rescue After: realpath {rootfs_dir}/boot/vmlinuz-* | grep -v rescue 2. Add a judgement, if the kernel num of result rootfs is not equal to 1, exit. Signed-off-by: Yu Chuan <13186087857@163.com> --- tests/iso2rootfs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 05274164f8c1..c728a7e9335a 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -375,8 +375,12 @@ test_rootfs() log_info "starting test rootfs ..." local test_script="${CGZ_PATH}/kvm.sh" - local kernel_path=$(realpath "${ROOTFS_DES_DIR}"/boot/vmlinuz*|grep -v rescue) + local kernel_path=$(realpath "${ROOTFS_DES_DIR}"/boot/vmlinuz-*|grep -v rescue) local initrd_lkp_path=$(realpath "${ROOTFS_DES_DIR}"/boot/initramfs.lkp*) + + local kernel_num=$(echo "$kernel_path" | wc -l) + [ "$kernel_num" -eq "1" ] || die "result rootfs have multiple vmlinuz, num: $kernel_num" + local root_path case ${rootfs_protocol} in "nfs") -- 2.23.0

On Fri, Nov 13, 2020 at 03:57:38PM +0800, Yu Chuan wrote:
[Why] Due to compass-ci patch: - git repo: https://gitee.com/wu_fengguang/compass-ci.git - commit id: 960aff501db5645c57459b317d0ce4dd3924f7bc
As a result, when getting var(kernel_path), the vmlinuz soft link is also included, and our var(kernel_path) gets two identical vmlinuz.
root cause: yuchuan@localhost rootfs_dir% ls -hl boot/vmlinuz* lrwxrwxrwx 1 root root 41 Nov 12 12:03 boot/vmlinuz -> vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 -rwxr-xr-x 1 root root 7.1M Nov 12 11:54 boot/vmlinuz-0-rescue-47178e4890764247aa6a35b8517bbc82 -rw-r--r-- 1 root root 20M Nov 12 12:04 boot/vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 yuchuan@localhost rootfs_dir% ls -hl boot/vmlinuz-* -rwxr-xr-x 1 root root 7.1M Nov 12 11:54 boot/vmlinuz-0-rescue-47178e4890764247aa6a35b8517bbc82 -rw-r--r-- 1 root root 20M Nov 12 12:04 boot/vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64
[How] 1. When filtering vmlinuz: Before: realpath {rootfs_dir}/boot/vmlinuz* | grep -v rescue After: realpath {rootfs_dir}/boot/vmlinuz-* | grep -v rescue
Can you use the boot/vmlinuz to the realpath, no need grep? Thanks, Xueliang
2. Add a judgement, if the kernel num of result rootfs is not equal to 1, exit.
Signed-off-by: Yu Chuan <13186087857@163.com> --- tests/iso2rootfs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 05274164f8c1..c728a7e9335a 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -375,8 +375,12 @@ test_rootfs() log_info "starting test rootfs ..." local test_script="${CGZ_PATH}/kvm.sh"
- local kernel_path=$(realpath "${ROOTFS_DES_DIR}"/boot/vmlinuz*|grep -v rescue) + local kernel_path=$(realpath "${ROOTFS_DES_DIR}"/boot/vmlinuz-*|grep -v rescue) local initrd_lkp_path=$(realpath "${ROOTFS_DES_DIR}"/boot/initramfs.lkp*) + + local kernel_num=$(echo "$kernel_path" | wc -l) + [ "$kernel_num" -eq "1" ] || die "result rootfs have multiple vmlinuz, num: $kernel_num" + local root_path case ${rootfs_protocol} in "nfs") -- 2.23.0

[Why] Due to compass-ci patch: - git repo: https://gitee.com/wu_fengguang/compass-ci.git - commit id: 960aff501db5645c57459b317d0ce4dd3924f7bc
As a result, when getting var(kernel_path), the vmlinuz soft link is also included, and our var(kernel_path) gets two identical vmlinuz.
root cause: yuchuan@localhost rootfs_dir% ls -hl boot/vmlinuz* lrwxrwxrwx 1 root root 41 Nov 12 12:03 boot/vmlinuz -> vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 -rwxr-xr-x 1 root root 7.1M Nov 12 11:54 boot/vmlinuz-0-rescue-47178e4890764247aa6a35b8517bbc82 -rw-r--r-- 1 root root 20M Nov 12 12:04 boot/vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64 yuchuan@localhost rootfs_dir% ls -hl boot/vmlinuz-* -rwxr-xr-x 1 root root 7.1M Nov 12 11:54 boot/vmlinuz-0-rescue-47178e4890764247aa6a35b8517bbc82 -rw-r--r-- 1 root root 20M Nov 12 12:04 boot/vmlinuz-4.19.90-2003.4.0.0036.oe1.aarch64
[How] 1. When filtering vmlinuz: Before: realpath {rootfs_dir}/boot/vmlinuz* | grep -v rescue After: realpath {rootfs_dir}/boot/vmlinuz-* | grep -v rescue
Can you use the boot/vmlinuz to the realpath, no need grep?
good point! what a new perspective! -------- Thanks Yu Chuan
Thanks, Xueliang
2. Add a judgement, if the kernel num of result rootfs is not equal to 1, exit.
Signed-off-by: Yu Chuan <13186087857@163.com> --- tests/iso2rootfs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/iso2rootfs b/tests/iso2rootfs index 05274164f8c1..c728a7e9335a 100755 --- a/tests/iso2rootfs +++ b/tests/iso2rootfs @@ -375,8 +375,12 @@ test_rootfs() log_info "starting test rootfs ..." local test_script="${CGZ_PATH}/kvm.sh"
- local kernel_path=$(realpath "${ROOTFS_DES_DIR}"/boot/vmlinuz*|grep -v rescue) + local kernel_path=$(realpath "${ROOTFS_DES_DIR}"/boot/vmlinuz-*|grep -v rescue) local initrd_lkp_path=$(realpath "${ROOTFS_DES_DIR}"/boot/initramfs.lkp*) + + local kernel_num=$(echo "$kernel_path" | wc -l) + [ "$kernel_num" -eq "1" ] || die "result rootfs have multiple vmlinuz, num: $kernel_num" + local root_path case ${rootfs_protocol} in "nfs") -- 2.23.0
participants (2)
-
Cao Xueliang
-
Yu Chuan