Lines Matching +full:read +full:- +full:to +full:- +full:read
2 # run_qemu translates the ambiguous exit status in Table1 to that in Table2.
6 # --------------------
7 # 0 - Unexpected exit from QEMU (possible signal), or the unittest did
8 # not use debug-exit
9 # 1 - most likely unittest succeeded, or QEMU failed
12 # -------------------
13 # 0 - Everything succeeded
14 # 1 - most likely QEMU failed
17 # ----------------------
18 # 0 - SUCCESS
19 # 1 - most likely QEMU failed
20 # 2 - most likely a run script failed
21 # 3 - most likely the unittest failed
22 # 124 - most likely the unittest timed out
23 # 127 - most likely the unittest called abort()
24 # 1..127 - FAILURE (could be QEMU, a run script, or the unittest)
25 # >= 128 - Signal (signum = status - 128)
32 echo -n "$@"
33 [ "$ENVIRON_DEFAULT" = "yes" ] && echo -n " #"
36 # stdout to {stdout}, stderr to $errors and stderr
40 exec {stdout}>&-
42 [ $ret -eq 134 ] && echo "QEMU Aborted" >&2
49 sig=$(sed 's/.*terminating on signal \([0-9][0-9]*\).*/\1/' <<<"$sig")
53 if [ $ret -eq 0 ]; then
59 # Exiting with zero (non-debugexit) is an error
62 elif [ $ret -eq 1 ]; then
65 # status of 1 to 0 (SUCCESS)
67 if ! grep -qvi warning <<<"$errors" ; then
85 exec {stdout}>&-
87 if [ $ret -eq 1 ]; then
88 testret=$(grep '^EXIT: ' <<<"$lines" | head -n1 | sed 's/.*STATUS=\([0-9][0-9]*\).*/\1/')
90 if [ $testret -eq 1 ]; then
107 s=${TIMEOUT: -1}
109 TIMEOUT=${TIMEOUT:0:-1}
114 echo "timeout -k 1s --foreground $TIMEOUT"
120 echo '{ "execute": "qmp_capabilities" }{ "execute":' "$2" '}' | ncat -U $1
125 while ! test -S "$1"; do sleep 0.1; done
127 ncat --no-shutdown -U $1 |
128 jq -c 'select(has("event"))'
133 grep -v "Now migrate the VM (quiet)" |
134 grep -v "Begin continuous migration (quiet)" |
135 grep -v "End continuous migration (quiet)" |
136 grep -v "Skipped VM migration (quiet)"
141 if [ $skip_migration -eq 1 ]; then
142 grep -q -e "Now migrate the VM" -e "Begin continuous migration" < $1
144 … grep -q -e "Now migrate the VM" -e "Begin continuous migration" -e "Skipped VM migration" < $1
150 if ! command -v ncat >/dev/null 2>&1; then
157 trap 'trap - TERM ; kill 0 ; exit 2' INT TERM
158 …trap 'rm -f ${src_out} ${dst_out} ${src_outfifo} ${dst_outfifo} ${dst_incoming} ${src_qmp} ${dst_q…
160 dst_incoming=$(mktemp -u -t mig-helper-socket-incoming.XXXXXXXXXX)
161 src_out=$(mktemp -t mig-helper-stdout1.XXXXXXXXXX)
162 src_outfifo=$(mktemp -u -t mig-helper-fifo-stdout1.XXXXXXXXXX)
163 dst_out=$(mktemp -t mig-helper-stdout2.XXXXXXXXXX)
164 dst_outfifo=$(mktemp -u -t mig-helper-fifo-stdout2.XXXXXXXXXX)
165 src_qmp=$(mktemp -u -t mig-helper-qmp1.XXXXXXXXXX)
166 dst_qmp=$(mktemp -u -t mig-helper-qmp2.XXXXXXXXXX)
167 src_infifo=$(mktemp -u -t mig-helper-fifo-stdin1.XXXXXXXXXX)
168 dst_infifo=$(mktemp -u -t mig-helper-fifo-stdin2.XXXXXXXXXX)
179 # These fds appear to be unused to shellcheck so quieten the warning.
188 -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \
189 -mon chardev=mon,mode=control \
203 while ps -p ${live_pid} > /dev/null ; do
204 if [ ${continuous_migration} -eq 1 ] ; then
208 elif grep -q "Begin continuous migration" < ${src_out} ; then
210 elif grep -q "Now migrate the VM" < ${src_out} ; then
212 elif [ $skip_migration -eq 0 ] && grep -q "Skipped VM migration" < ${src_out} ; then
221 while (( $(jobs -r | wc -l) > 0 )); do
231 -chardev socket,id=mon,path=${dst_qmp},server=on,wait=off \
232 -mon chardev=mon,mode=control -incoming unix:${dst_incoming} \
240 # The test must prompt the user to migrate, so wait for the
242 while [ ${continuous_migration} -eq 0 ] && ! seen_migrate_msg ${src_out} ; do
243 if ! ps -p ${live_pid} > /dev/null ; then
253 if grep -q "Begin continuous migration" < ${src_out} ; then
254 if [ ${continuous_migration} -eq 1 ] ; then
266 while ! [ -S ${dst_incoming} ] ; do sleep 0.1 ; done
267 while ! [ -S ${dst_qmp} ] ; do sleep 0.1 ; done
269 if [ $skip_migration -eq 0 ] && grep -q "Skipped VM migration" < ${src_out} ; then
270 # May not get any migrations, exit to main loop for now...
272 if [ ${continuous_migration} -eq 1 ] ; then
288 # Wait for the migration to complete
289 migstatus=$(qmp ${src_qmp} '"query-migrate"' | grep return)
290 while ! grep -q '"completed"' <<<"$migstatus" ; do
292 if ! migstatus=$(qmp ${src_qmp} '"query-migrate"'); then
299 if grep -q '"failed"' <<<"$migstatus"; then
311 if grep -q "End continuous migration" < ${src_out} ; then
312 if [ ${continuous_migration} -eq 0 ] ; then
323 if [ ${continuous_migration} -eq 0 ]; then
324 # keypress to dst so getchar completes and test continues
329 while [ -S ${dst_incoming} ] ; do sleep 0.1 ; done
355 if ! command -v ncat >/dev/null 2>&1; then
360 if ! command -v jq >/dev/null 2>&1; then
365 trap 'trap - TERM ; kill 0 ; exit 2' INT TERM
366 trap 'rm -f ${qmp}' RETURN EXIT
368 qmp=$(mktemp -u -t panic-qmp.XXXXXXXXXX)
371 "$@" -chardev socket,id=mon,path=${qmp},server=on,wait=off \
372 -mon chardev=mon,mode=control -S &
374 panic_event_count=$(qmp_events ${qmp} | jq -c 'select(.event == "GUEST_PANICKED")' | wc -l)
375 if [ "$panic_event_count" -lt 1 ]; then
409 for qemucmd in ${QEMU:-qemu-system-$QEMU_ARCH qemu-kvm}; do
410 if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
416 if [ -z "$qemu" ]; then
421 command -v $qemu
427 rm -f $KVM_UNIT_TESTS_ENV
441 [ -f "$KVM_UNIT_TESTS_ENV" ] && export KVM_UNIT_TESTS_ENV_OLD="$KVM_UNIT_TESTS_ENV"
450 [ -f "$KVM_UNIT_TESTS_ENV" ] && INITRD="-initrd $KVM_UNIT_TESTS_ENV"
460 if eval test -v $p; then
477 if [ -n "$ACCEL" ] || [ -n "$QEMU_ACCEL" ]; then
478 [ -n "$ACCEL" ] && QEMU_ACCEL=$ACCEL
480 QEMU_VERSION_STRING="$($qemu -h | head -1)"
483 IFS='[ .]' read -r _ _ _ QEMU_MAJOR QEMU_MINOR QEMU_MICRO rest <<<"$QEMU_VERSION_STRING"
487 KERNEL_VERSION_STRING=$(uname -r)
488 IFS=. read -r KERNEL_VERSION KERNEL_PATCHLEVEL rest <<<"$KERNEL_VERSION_STRING"
489 IFS=- read -r KERNEL_SUBLEVEL KERNEL_EXTRAVERSION <<<"$rest"
490 KERNEL_SUBLEVEL=${KERNEL_SUBLEVEL%%[!0-9]*}
491 KERNEL_EXTRAVERSION=${KERNEL_EXTRAVERSION%%[!0-9]*}
492 ! [[ $KERNEL_SUBLEVEL =~ ^[0-9]+$ ]] && unset $KERNEL_SUBLEVEL
493 ! [[ $KERNEL_EXTRAVERSION =~ ^[0-9]+$ ]] && unset $KERNEL_EXTRAVERSION
501 [ ! -f "$KVM_UNIT_TESTS_ENV_OLD" ] && return
503 …grep -E '^[[:blank:]]*[[:alpha:]_][[:alnum:]_]*=' "$KVM_UNIT_TESTS_ENV_OLD" | while IFS= read -r l…
505 if ! grep -q "^$var=" $KVM_UNIT_TESTS_ENV; then
518 elif [ "$ERRATATXT" ] && [ ! -f "$ERRATATXT" ]; then
524 new_env=$(sort <(env | grep '^ERRATA_') <(grep '^ERRATA_' $KVM_UNIT_TESTS_ENV) | uniq -u)
532 for line in $(grep -v '^#' "$ERRATATXT" | tr -d '[:blank:]' | cut -d: -f1,2); do
536 test -z "$commit" && continue
538 [ -n "${!errata}" ] && continue
540 IFS=. read -r v p rest <<<"$minver"
541 IFS=- read -r s x <<<"$rest"
542 s=${s%%[!0-9]*}
543 x=${x%%[!0-9]*}
545 if ! [[ $v =~ ^[0-9]+$ ]] || ! [[ $p =~ ^[0-9]+$ ]]; then
549 ! [[ $s =~ ^[0-9]+$ ]] && unset $s
550 ! [[ $x =~ ^[0-9]+$ ]] && unset $x
590 old_exit=$(trap -p EXIT | sed "s/^[^']*'//;s/'[^']*$//")
591 trap -- "$1; $old_exit" EXIT
596 [ -c /dev/kvm ] ||
606 [ "$(sysctl -n kern.hv_support 2>/dev/null)" = "1" ] || return 1
627 if [ -z "$ACCEL" ]; then