Lines Matching +full:run +full:- +full:control
2 # SPDX-License-Identifier: GPL-2.0
7 # * virtme-ng
8 # * busybox-static (used by virtme-ng)
9 # * qemu (used by virtme-ng)
11 readonly SCRIPT_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
28 # virtme-ng offers a netdev for ssh when using "--ssh", but we also need a
29 # control port forwarded for vsock_test. Because virtme-ng doesn't support
30 # adding an additional port to forward to the device created from "--ssh" and
31 # virtme-init mistakenly sets identical IPs to the ssh device and additional
32 # devices, we instead opt out of using --ssh, add the device manually, and also
33 # add the kernel cmdline options that virtme-init uses to setup the interface.
34 readonly QEMU_TEST_PORT_FWD="hostfwd=tcp::${TEST_HOST_PORT}-:${TEST_GUEST_PORT}"
35 readonly QEMU_SSH_PORT_FWD="hostfwd=tcp::${SSH_HOST_PORT}-:${SSH_GUEST_PORT}"
37 -netdev user,id=n0,${QEMU_TEST_PORT_FWD},${QEMU_SSH_PORT_FWD} \
38 -device virtio-net-pci,netdev=n0 \
39 -device vhost-vsock-pci,guest-cid=${VSOCK_CID} \
40 --pidfile ${QEMU_PIDFILE} \
49 "Run vsock_test in server mode on the VM and in client mode on the host."
50 "Run vsock_test in client mode on the VM and in server mode on the host."
51 "Run vsock_test using the loopback transport in the VM."
63 echo "If no TEST argument is given, all tests will be run."
66 echo " -b: build the kernel from the current source tree and use it for guest VMs"
67 echo " -q: set the path to or name of qemu binary"
68 echo " -v: verbose output"
75 printf "\t%-35s%-35s\n" "${name}" "${desc}"
88 ssh -q -o UserKnownHostsFile=/dev/null -p ${SSH_HOST_PORT} localhost "$@"
93 if [[ -s "${QEMU_PIDFILE}" ]]; then
94 pkill -SIGTERM -F "${QEMU_PIDFILE}" > /dev/null 2>&1
99 if [[ -e "${QEMU_PIDFILE}" ]]; then
116 if [[ "${found}" -eq 0 ]]; then
123 if ! command -v > /dev/null "test_${arg}"; then
132 if [[ ! -x $(command -v "${dep}") ]]; then
133 echo -e "skip: dependency ${dep} not found!\n"
138 if [[ ! -x $(command -v "${VSOCK_TEST}") ]]; then
151 version="$(vng --version)"
161 if [[ ! "${ok}" -eq 1 ]]; then
169 if [[ ! "${BUILD}" -eq 1 ]]; then
173 if [[ ! -d "${KERNEL_CHECKOUT}" ]]; then
174 echo "-b requires vmtest.sh called from the kernel source tree" >&2
180 if ! vng --kconfig --config "${SCRIPT_DIR}"/config; then
184 if ! make -j$(nproc); then
197 qemu=$(command -v "${QEMU}")
199 if [[ "${VERBOSE}" -eq 1 ]]; then
200 verbose_opt="--verbose"
204 if [[ "${BUILD}" -eq 1 ]]; then
209 --run \
212 --qemu-opts="${QEMU_OPTS}" \
213 --qemu="${qemu}" \
214 --user root \
215 --append "${KERNEL_CMDLINE}" \
216 --rw &> ${logfile} &
219 bash -c 'while [[ ! -s '"${QEMU_PIDFILE}"' ]]; do sleep 1; done; exit 0'; then
229 if [[ ${i} -gt ${WAIT_PERIOD_MAX} ]]; then
232 if vm_ssh -- true; then
256 grep -q "${pattern}"; then
267 $(declare -f wait_for_listener)
289 if [[ ${VERBOSE} -eq 0 ]]; then
295 if [[ "$#" -eq 0 ]]; then
296 __log_stdin | tee -a "${LOG}" > ${redirect}
298 __log_args "$@" | tee -a "${LOG}" > ${redirect}
323 vm_ssh -- "${VSOCK_TEST}" \
324 --mode=server \
325 --control-port="${TEST_GUEST_PORT}" \
326 --peer-cid=2 \
332 --mode=client \
333 --control-host=127.0.0.1 \
334 --peer-cid="${VSOCK_CID}" \
335 --control-port="${TEST_HOST_PORT}" 2>&1 | log_host "${testname}"
344 --mode "server" \
345 --control-port "${TEST_HOST_PORT_LISTENER}" \
346 --peer-cid "${VSOCK_CID}" 2>&1 | log_host "${testname}" &
350 vm_ssh -- "${VSOCK_TEST}" \
351 --mode=client \
352 --control-host=10.0.2.2 \
353 --peer-cid=2 \
354 --control-port="${TEST_HOST_PORT_LISTENER}" 2>&1 | log_guest "${testname}"
361 local port=60000 # non-forwarded local port
363 vm_ssh -- "${VSOCK_TEST}" \
364 --mode=server \
365 --control-port="${port}" \
366 --peer-cid=1 2>&1 | log_guest "${testname}" &
370 vm_ssh -- "${VSOCK_TEST}" \
371 --mode=client \
372 --control-host="127.0.0.1" \
373 --control-port="${port}" \
374 --peer-cid=1 2>&1 | log_guest "${testname}"
391 host_oops_cnt_before=$(dmesg | grep -c -i 'Oops')
392 host_warn_cnt_before=$(dmesg --level=warn | wc -l)
393 vm_oops_cnt_before=$(vm_ssh -- dmesg | grep -c -i 'Oops')
394 vm_warn_cnt_before=$(vm_ssh -- dmesg --level=warn | wc -l)
400 host_oops_cnt_after=$(dmesg | grep -i 'Oops' | wc -l)
401 if [[ ${host_oops_cnt_after} -gt ${host_oops_cnt_before} ]]; then
406 host_warn_cnt_after=$(dmesg --level=warn | wc -l)
407 if [[ ${host_warn_cnt_after} -gt ${host_warn_cnt_before} ]]; then
412 vm_oops_cnt_after=$(vm_ssh -- dmesg | grep -i 'Oops' | wc -l)
413 if [[ ${vm_oops_cnt_after} -gt ${vm_oops_cnt_before} ]]; then
418 vm_warn_cnt_after=$(vm_ssh -- dmesg --level=warn | wc -l)
419 if [[ ${vm_warn_cnt_after} -gt ${vm_warn_cnt_before} ]]; then
427 QEMU="qemu-system-$(uname -m)"
438 shift $((OPTIND-1))
442 if [[ ${#} -eq 0 ]]; then
467 if [[ ${rc} -eq $KSFT_PASS ]]; then
470 elif [[ ${rc} -eq $KSFT_SKIP ]]; then
473 elif [[ ${rc} -eq $KSFT_FAIL ]]; then
483 if [ $((cnt_pass + cnt_skip)) -eq ${cnt_total} ]; then