diff mbox series

[bpf] selfetests/bpf: Adapt vmtest.sh to s390 libbpf CI changes

Message ID 20211118115225.1349726-1-iii@linux.ibm.com (mailing list archive)
State Accepted
Commit 29ad850a5cae84757bcd4c60e0d74232ef8c5157
Delegated to: BPF
Headers show
Series [bpf] selfetests/bpf: Adapt vmtest.sh to s390 libbpf CI changes | expand

Checks

Context Check Description
bpf/vmtest-bpf fail VM_Test
bpf/vmtest-bpf-PR fail PR summary
netdev/tree_selection success Clearly marked for bpf
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: kafai@fb.com songliubraving@fb.com yhs@fb.com john.fastabend@gmail.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: 'Acked-by:' is the preferred signature form WARNING: line length of 87 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ilya Leoshkevich Nov. 18, 2021, 11:52 a.m. UTC
[1] added s390 support to libbpf CI and added an ${ARCH} prefix to a
number of paths and identifiers in libbpf GitHub repo, which vmtest.sh
relies upon. Update these and make use of the new s390 support.

[1] https://github.com/libbpf/libbpf/pull/204

Co-developed-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/testing/selftests/bpf/vmtest.sh | 46 ++++++++++++++++++---------
 1 file changed, 31 insertions(+), 15 deletions(-)

Comments

Andrii Nakryiko Nov. 18, 2021, 6:38 p.m. UTC | #1
On Thu, Nov 18, 2021 at 3:52 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> [1] added s390 support to libbpf CI and added an ${ARCH} prefix to a
> number of paths and identifiers in libbpf GitHub repo, which vmtest.sh
> relies upon. Update these and make use of the new s390 support.
>
> [1] https://github.com/libbpf/libbpf/pull/204
>
> Co-developed-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---

Thanks for the quick fix! I did rm -r ~/.bpf_selftest (though I
thought I did that with my changes as well, whatever) before running
vmtest.sh. It all worked. I got three test failures which is strange,
because I don't get those failures in my custom and more complete QEMU
image, so it's strange, if anyone has any ideas and is willing to help
debug this, it would be greatly appreciated.

But either way, this fixes immediate problems with vmtest.sh, pushed
to bpf-next. Thanks!


All error logs:

#17 btf_map_in_map:FAIL
test_lookup_update:PASS:skel_open 0 nsec
test_lookup_update:PASS:skel_attach 0 nsec
test_lookup_update:PASS:inner1 0 nsec
test_lookup_update:PASS:inner2 0 nsec
test_lookup_update:PASS:inner3 0 nsec
test_lookup_update:PASS:inner1 0 nsec
test_lookup_update:PASS:inner2 0 nsec
test_lookup_update:PASS:inner4 0 nsec
test_lookup_update:PASS:inner5 0 nsec
test_lookup_update:PASS:map1_id 0 nsec
test_lookup_update:PASS:map2_id 0 nsec
test_lookup_update:PASS:sync_rcu 0 nsec
test_lookup_update:PASS:sync_rcu 0 nsec
test_lookup_update:FAIL:map1_leak inner_map1 leaked!
#17/1 btf_map_in_map/lookup_update:FAIL
test_diff_size:PASS:skel_open 0 nsec
test_diff_size:PASS:outer_sockarr inner map size check 0 nsec
test_diff_size:PASS:outer_arr inner map size check 0 nsec
#17/2 btf_map_in_map/diff_size:OK

#147 task_local_storage:FAIL
test_sys_enter_exit:PASS:skel_open_and_load 0 nsec
test_sys_enter_exit:PASS:skel_attach 0 nsec
test_sys_enter_exit:PASS:enter_cnt 0 nsec
test_sys_enter_exit:PASS:exit_cnt 0 nsec
test_sys_enter_exit:PASS:mismatch_cnt 0 nsec
#147/1 task_local_storage/sys_enter_exit:OK
test_exit_creds:PASS:skel_open_and_load 0 nsec
test_exit_creds:PASS:skel_attach 0 nsec
test_exit_creds:PASS:valid_ptr_count 0 nsec
test_exit_creds:FAIL:null_ptr_count unexpected null_ptr_count: actual
0 == expected 0
#147/2 task_local_storage/exit_creds:FAIL
test_recursion:PASS:skel_open_and_load 0 nsec
test_recursion:PASS:skel_attach 0 nsec
#147/3 task_local_storage/recursion:OK

#155 test_bpffs:FAIL
test_test_bpffs:PASS:clone 0 nsec
test_test_bpffs:PASS:waitpid 0 nsec
test_test_bpffs:FAIL:bpffs test  failed 255
Summary: 209/967 PASSED, 10 SKIPPED, 3 FAILED


>  tools/testing/selftests/bpf/vmtest.sh | 46 ++++++++++++++++++---------
>  1 file changed, 31 insertions(+), 15 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
> index 027198768fad..5e43c79ddc6e 100755
> --- a/tools/testing/selftests/bpf/vmtest.sh
> +++ b/tools/testing/selftests/bpf/vmtest.sh
> @@ -4,17 +4,34 @@
>  set -u
>  set -e
>
> -# This script currently only works for x86_64, as
> -# it is based on the VM image used by the BPF CI which is
> -# x86_64.
> -QEMU_BINARY="${QEMU_BINARY:="qemu-system-x86_64"}"
> -X86_BZIMAGE="arch/x86/boot/bzImage"
> +# This script currently only works for x86_64 and s390x, as
> +# it is based on the VM image used by the BPF CI, which is
> +# available only for these architectures.
> +ARCH="$(uname -m)"
> +case "${ARCH}" in
> +s390x)
> +       QEMU_BINARY=qemu-system-s390x
> +       QEMU_CONSOLE="ttyS1"
> +       QEMU_FLAGS=(-smp 2)
> +       BZIMAGE="arch/s390/boot/compressed/vmlinux"
> +       ;;
> +x86_64)
> +       QEMU_BINARY=qemu-system-x86_64
> +       QEMU_CONSOLE="ttyS0,115200"
> +       QEMU_FLAGS=(-cpu host -smp 8)
> +       BZIMAGE="arch/x86/boot/bzImage"
> +       ;;
> +*)
> +       echo "Unsupported architecture"
> +       exit 1
> +       ;;
> +esac
>  DEFAULT_COMMAND="./test_progs"
>  MOUNT_DIR="mnt"
>  ROOTFS_IMAGE="root.img"
>  OUTPUT_DIR="$HOME/.bpf_selftests"
> -KCONFIG_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/latest.config"
> -KCONFIG_API_URL="https://api.github.com/repos/libbpf/libbpf/contents/travis-ci/vmtest/configs/latest.config"
> +KCONFIG_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/config-latest.${ARCH}"
> +KCONFIG_API_URL="https://api.github.com/repos/libbpf/libbpf/contents/travis-ci/vmtest/configs/config-latest.${ARCH}"
>  INDEX_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/INDEX"
>  NUM_COMPILE_JOBS="$(nproc)"
>  LOG_FILE_BASE="$(date +"bpf_selftests.%Y-%m-%d_%H-%M-%S")"
> @@ -85,7 +102,7 @@ newest_rootfs_version()
>  {
>         {
>         for file in "${!URLS[@]}"; do
> -               if [[ $file =~ ^libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
> +               if [[ $file =~ ^"${ARCH}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
>                         echo "${BASH_REMATCH[1]}"
>                 fi
>         done
> @@ -102,7 +119,7 @@ download_rootfs()
>                 exit 1
>         fi
>
> -       download "libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
> +       download "${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
>                 zstd -d | sudo tar -C "$dir" -x
>  }
>
> @@ -224,13 +241,12 @@ EOF
>                 -nodefaults \
>                 -display none \
>                 -serial mon:stdio \
> -               -cpu host \
> +               "${qemu_flags[@]}" \
>                 -enable-kvm \
> -               -smp 8 \
>                 -m 4G \
>                 -drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \
>                 -kernel "${kernel_bzimage}" \
> -               -append "root=/dev/vda rw console=ttyS0,115200"
> +               -append "root=/dev/vda rw console=${QEMU_CONSOLE}"
>  }
>
>  copy_logs()
> @@ -282,7 +298,7 @@ main()
>         local kernel_checkout=$(realpath "${script_dir}"/../../../../)
>         # By default the script searches for the kernel in the checkout directory but
>         # it also obeys environment variables O= and KBUILD_OUTPUT=
> -       local kernel_bzimage="${kernel_checkout}/${X86_BZIMAGE}"
> +       local kernel_bzimage="${kernel_checkout}/${BZIMAGE}"
>         local command="${DEFAULT_COMMAND}"
>         local update_image="no"
>         local exit_command="poweroff -f"
> @@ -337,13 +353,13 @@ main()
>                 if is_rel_path "${O}"; then
>                         O="$(realpath "${PWD}/${O}")"
>                 fi
> -               kernel_bzimage="${O}/${X86_BZIMAGE}"
> +               kernel_bzimage="${O}/${BZIMAGE}"
>                 make_command="${make_command} O=${O}"
>         elif [[ "${KBUILD_OUTPUT:=""}" != "" ]]; then
>                 if is_rel_path "${KBUILD_OUTPUT}"; then
>                         KBUILD_OUTPUT="$(realpath "${PWD}/${KBUILD_OUTPUT}")"
>                 fi
> -               kernel_bzimage="${KBUILD_OUTPUT}/${X86_BZIMAGE}"
> +               kernel_bzimage="${KBUILD_OUTPUT}/${BZIMAGE}"
>                 make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
>         fi
>
> --
> 2.31.1
>
patchwork-bot+netdevbpf@kernel.org Nov. 18, 2021, 6:40 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu, 18 Nov 2021 12:52:25 +0100 you wrote:
> [1] added s390 support to libbpf CI and added an ${ARCH} prefix to a
> number of paths and identifiers in libbpf GitHub repo, which vmtest.sh
> relies upon. Update these and make use of the new s390 support.
> 
> [1] https://github.com/libbpf/libbpf/pull/204
> 
> Co-developed-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> 
> [...]

Here is the summary with links:
  - [bpf] selfetests/bpf: Adapt vmtest.sh to s390 libbpf CI changes
    https://git.kernel.org/bpf/bpf-next/c/29ad850a5cae

You are awesome, thank you!
sunyucong@gmail.com Nov. 18, 2021, 6:44 p.m. UTC | #3
On Thu, Nov 18, 2021 at 3:54 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> [1] added s390 support to libbpf CI and added an ${ARCH} prefix to a
> number of paths and identifiers in libbpf GitHub repo, which vmtest.sh
> relies upon. Update these and make use of the new s390 support.
>
> [1] https://github.com/libbpf/libbpf/pull/204
>
> Co-developed-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tools/testing/selftests/bpf/vmtest.sh | 46 ++++++++++++++++++---------
>  1 file changed, 31 insertions(+), 15 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
> index 027198768fad..5e43c79ddc6e 100755
> --- a/tools/testing/selftests/bpf/vmtest.sh
> +++ b/tools/testing/selftests/bpf/vmtest.sh
> @@ -4,17 +4,34 @@
>  set -u
>  set -e
>
> -# This script currently only works for x86_64, as
> -# it is based on the VM image used by the BPF CI which is
> -# x86_64.
> -QEMU_BINARY="${QEMU_BINARY:="qemu-system-x86_64"}"
> -X86_BZIMAGE="arch/x86/boot/bzImage"
> +# This script currently only works for x86_64 and s390x, as
> +# it is based on the VM image used by the BPF CI, which is
> +# available only for these architectures.
> +ARCH="$(uname -m)"
> +case "${ARCH}" in
> +s390x)
> +       QEMU_BINARY=qemu-system-s390x
> +       QEMU_CONSOLE="ttyS1"
> +       QEMU_FLAGS=(-smp 2)
> +       BZIMAGE="arch/s390/boot/compressed/vmlinux"
> +       ;;
> +x86_64)
> +       QEMU_BINARY=qemu-system-x86_64
> +       QEMU_CONSOLE="ttyS0,115200"
> +       QEMU_FLAGS=(-cpu host -smp 8)
> +       BZIMAGE="arch/x86/boot/bzImage"
> +       ;;
> +*)
> +       echo "Unsupported architecture"
> +       exit 1
> +       ;;
> +esac
>  DEFAULT_COMMAND="./test_progs"
>  MOUNT_DIR="mnt"
>  ROOTFS_IMAGE="root.img"
>  OUTPUT_DIR="$HOME/.bpf_selftests"
> -KCONFIG_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/latest.config"
> -KCONFIG_API_URL="https://api.github.com/repos/libbpf/libbpf/contents/travis-ci/vmtest/configs/latest.config"
> +KCONFIG_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/config-latest.${ARCH}"
> +KCONFIG_API_URL="https://api.github.com/repos/libbpf/libbpf/contents/travis-ci/vmtest/configs/config-latest.${ARCH}"
>  INDEX_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/INDEX"
>  NUM_COMPILE_JOBS="$(nproc)"
>  LOG_FILE_BASE="$(date +"bpf_selftests.%Y-%m-%d_%H-%M-%S")"
> @@ -85,7 +102,7 @@ newest_rootfs_version()
>  {
>         {
>         for file in "${!URLS[@]}"; do
> -               if [[ $file =~ ^libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
> +               if [[ $file =~ ^"${ARCH}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
>                         echo "${BASH_REMATCH[1]}"
>                 fi
>         done
> @@ -102,7 +119,7 @@ download_rootfs()
>                 exit 1
>         fi
>
> -       download "libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
> +       download "${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
>                 zstd -d | sudo tar -C "$dir" -x
>  }
>
> @@ -224,13 +241,12 @@ EOF
>                 -nodefaults \
>                 -display none \
>                 -serial mon:stdio \
> -               -cpu host \
> +               "${qemu_flags[@]}" \
>                 -enable-kvm \
> -               -smp 8 \
>                 -m 4G \
>                 -drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \
>                 -kernel "${kernel_bzimage}" \
> -               -append "root=/dev/vda rw console=ttyS0,115200"
> +               -append "root=/dev/vda rw console=${QEMU_CONSOLE}"
>  }
>
>  copy_logs()
> @@ -282,7 +298,7 @@ main()
>         local kernel_checkout=$(realpath "${script_dir}"/../../../../)
>         # By default the script searches for the kernel in the checkout directory but
>         # it also obeys environment variables O= and KBUILD_OUTPUT=
> -       local kernel_bzimage="${kernel_checkout}/${X86_BZIMAGE}"
> +       local kernel_bzimage="${kernel_checkout}/${BZIMAGE}"
>         local command="${DEFAULT_COMMAND}"
>         local update_image="no"
>         local exit_command="poweroff -f"
> @@ -337,13 +353,13 @@ main()
>                 if is_rel_path "${O}"; then
>                         O="$(realpath "${PWD}/${O}")"
>                 fi
> -               kernel_bzimage="${O}/${X86_BZIMAGE}"
> +               kernel_bzimage="${O}/${BZIMAGE}"
>                 make_command="${make_command} O=${O}"
>         elif [[ "${KBUILD_OUTPUT:=""}" != "" ]]; then
>                 if is_rel_path "${KBUILD_OUTPUT}"; then
>                         KBUILD_OUTPUT="$(realpath "${PWD}/${KBUILD_OUTPUT}")"
>                 fi
> -               kernel_bzimage="${KBUILD_OUTPUT}/${X86_BZIMAGE}"
> +               kernel_bzimage="${KBUILD_OUTPUT}/${BZIMAGE}"
>                 make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
>         fi
>
> --
> 2.31.1
>

Acked-By: Yucong Sun <sunyucong@gmail.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 027198768fad..5e43c79ddc6e 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -4,17 +4,34 @@ 
 set -u
 set -e
 
-# This script currently only works for x86_64, as
-# it is based on the VM image used by the BPF CI which is
-# x86_64.
-QEMU_BINARY="${QEMU_BINARY:="qemu-system-x86_64"}"
-X86_BZIMAGE="arch/x86/boot/bzImage"
+# This script currently only works for x86_64 and s390x, as
+# it is based on the VM image used by the BPF CI, which is
+# available only for these architectures.
+ARCH="$(uname -m)"
+case "${ARCH}" in
+s390x)
+	QEMU_BINARY=qemu-system-s390x
+	QEMU_CONSOLE="ttyS1"
+	QEMU_FLAGS=(-smp 2)
+	BZIMAGE="arch/s390/boot/compressed/vmlinux"
+	;;
+x86_64)
+	QEMU_BINARY=qemu-system-x86_64
+	QEMU_CONSOLE="ttyS0,115200"
+	QEMU_FLAGS=(-cpu host -smp 8)
+	BZIMAGE="arch/x86/boot/bzImage"
+	;;
+*)
+	echo "Unsupported architecture"
+	exit 1
+	;;
+esac
 DEFAULT_COMMAND="./test_progs"
 MOUNT_DIR="mnt"
 ROOTFS_IMAGE="root.img"
 OUTPUT_DIR="$HOME/.bpf_selftests"
-KCONFIG_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/latest.config"
-KCONFIG_API_URL="https://api.github.com/repos/libbpf/libbpf/contents/travis-ci/vmtest/configs/latest.config"
+KCONFIG_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/config-latest.${ARCH}"
+KCONFIG_API_URL="https://api.github.com/repos/libbpf/libbpf/contents/travis-ci/vmtest/configs/config-latest.${ARCH}"
 INDEX_URL="https://raw.githubusercontent.com/libbpf/libbpf/master/travis-ci/vmtest/configs/INDEX"
 NUM_COMPILE_JOBS="$(nproc)"
 LOG_FILE_BASE="$(date +"bpf_selftests.%Y-%m-%d_%H-%M-%S")"
@@ -85,7 +102,7 @@  newest_rootfs_version()
 {
 	{
 	for file in "${!URLS[@]}"; do
-		if [[ $file =~ ^libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
+		if [[ $file =~ ^"${ARCH}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
 			echo "${BASH_REMATCH[1]}"
 		fi
 	done
@@ -102,7 +119,7 @@  download_rootfs()
 		exit 1
 	fi
 
-	download "libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
+	download "${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
 		zstd -d | sudo tar -C "$dir" -x
 }
 
@@ -224,13 +241,12 @@  EOF
 		-nodefaults \
 		-display none \
 		-serial mon:stdio \
-		-cpu host \
+		"${qemu_flags[@]}" \
 		-enable-kvm \
-		-smp 8 \
 		-m 4G \
 		-drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \
 		-kernel "${kernel_bzimage}" \
-		-append "root=/dev/vda rw console=ttyS0,115200"
+		-append "root=/dev/vda rw console=${QEMU_CONSOLE}"
 }
 
 copy_logs()
@@ -282,7 +298,7 @@  main()
 	local kernel_checkout=$(realpath "${script_dir}"/../../../../)
 	# By default the script searches for the kernel in the checkout directory but
 	# it also obeys environment variables O= and KBUILD_OUTPUT=
-	local kernel_bzimage="${kernel_checkout}/${X86_BZIMAGE}"
+	local kernel_bzimage="${kernel_checkout}/${BZIMAGE}"
 	local command="${DEFAULT_COMMAND}"
 	local update_image="no"
 	local exit_command="poweroff -f"
@@ -337,13 +353,13 @@  main()
 		if is_rel_path "${O}"; then
 			O="$(realpath "${PWD}/${O}")"
 		fi
-		kernel_bzimage="${O}/${X86_BZIMAGE}"
+		kernel_bzimage="${O}/${BZIMAGE}"
 		make_command="${make_command} O=${O}"
 	elif [[ "${KBUILD_OUTPUT:=""}" != "" ]]; then
 		if is_rel_path "${KBUILD_OUTPUT}"; then
 			KBUILD_OUTPUT="$(realpath "${PWD}/${KBUILD_OUTPUT}")"
 		fi
-		kernel_bzimage="${KBUILD_OUTPUT}/${X86_BZIMAGE}"
+		kernel_bzimage="${KBUILD_OUTPUT}/${BZIMAGE}"
 		make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
 	fi