Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'selftests-vsock-support-nested-vm-runner-for-vmtest-sh'

Bobby Eshleman says:

====================
selftests/vsock: support nested VM runner for vmtest.sh

This series fixes a few issues trying to launch vmtest.sh in a nested VM
environment and were discovered when trying to prepare the tests for
netdev CI/CD.

When taken together these patches make vmtest.sh work both on bare metal
and in nested VMs, regardless of the outer VM's user, coincidental path
overlaps, or filesystem settings.
====================

Link: https://patch.msgid.link/20260317-vsock-vmtest-nested-fixes-v2-0-0b3f53b80a0f@meta.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+22 -4
+22 -4
tools/testing/selftests/vsock/vmtest.sh
··· 42 42 virtme.ssh virtme_ssh_channel=tcp virtme_ssh_user=$USER \ 43 43 " 44 44 readonly LOG=$(mktemp /tmp/vsock_vmtest_XXXX.log) 45 + readonly TEST_HOME="$(mktemp -d /tmp/vmtest_home_XXXX)" 46 + readonly SSH_KEY_PATH="${TEST_HOME}"/.ssh/id_ed25519 45 47 46 48 # Namespace tests must use the ns_ prefix. This is checked in check_netns() and 47 49 # is used to determine if a test needs namespace setup before test execution. ··· 259 257 260 258 shift 261 259 262 - ${ns_exec} ssh -q -o UserKnownHostsFile=/dev/null -p "${SSH_HOST_PORT}" localhost "$@" 260 + ${ns_exec} ssh -q \ 261 + -i "${SSH_KEY_PATH}" \ 262 + -o UserKnownHostsFile=/dev/null \ 263 + -o StrictHostKeyChecking=no \ 264 + -p "${SSH_HOST_PORT}" \ 265 + localhost "$@" 263 266 264 267 return $? 265 268 } ··· 272 265 cleanup() { 273 266 terminate_pidfiles "${!PIDFILES[@]}" 274 267 del_namespaces 268 + rm -rf "${TEST_HOME}" 275 269 } 276 270 277 271 check_args() { ··· 390 382 popd &>/dev/null 391 383 } 392 384 385 + setup_home() { 386 + mkdir -p "$(dirname "${SSH_KEY_PATH}")" 387 + ssh-keygen -t ed25519 -f "${SSH_KEY_PATH}" -N "" -q 388 + cp "${VSOCK_TEST}" "${TEST_HOME}"/vsock_test 389 + } 390 + 393 391 create_pidfile() { 394 392 local pidfile 395 393 ··· 484 470 --run \ 485 471 ${kernel_opt} \ 486 472 ${verbose_opt} \ 473 + --rwdir=/root="${TEST_HOME}" \ 474 + --force-9p \ 475 + --cwd /root \ 487 476 --qemu-opts="${qemu_opts}" \ 488 477 --qemu="${qemu}" \ 489 478 --user root \ 490 479 --append "${KERNEL_CMDLINE}" \ 491 - --rw &> ${logfile} & 480 + &> ${logfile} & 492 481 493 482 timeout "${WAIT_QEMU}" \ 494 483 bash -c 'while [[ ! -s '"${pidfile}"' ]]; do sleep 1; done; exit 0' ··· 621 604 # log output and use pipefail to respect vsock_test errors 622 605 set -o pipefail 623 606 if [[ "${host}" != server ]]; then 624 - vm_ssh "${ns}" -- "${VSOCK_TEST}" \ 607 + vm_ssh "${ns}" -- ./vsock_test \ 625 608 --mode=client \ 626 609 --control-host="${host}" \ 627 610 --peer-cid="${cid}" \ ··· 629 612 2>&1 | log_guest 630 613 rc=$? 631 614 else 632 - vm_ssh "${ns}" -- "${VSOCK_TEST}" \ 615 + vm_ssh "${ns}" -- ./vsock_test \ 633 616 --mode=server \ 634 617 --peer-cid="${cid}" \ 635 618 --control-port="${port}" \ ··· 1568 1551 check_vng 1569 1552 check_socat 1570 1553 handle_build 1554 + setup_home 1571 1555 1572 1556 echo "1..${#ARGS[@]}" 1573 1557