qemu-patch-raspberry4/tests
Eric Blake 64ebf55648 qemu-io: Don't die on second open
Most callback commands in qemu-io return 0 to keep the interpreter
loop running, or 1 to quit immediately.  However, open_f() just
passed through the return value of openfile(), which has different
semantics of returning 0 if a file was opened, or 1 on any failure.

As a result of mixing the return semantics, we are forcing the
qemu-io interpreter to exit early on any failures, which is rather
annoying when some of the failures are obviously trying to give
the user a hint of how to proceed (if we didn't then kill qemu-io
out from under the user's feet):

$ qemu-io
qemu-io> open foo
qemu-io> open foo
file open already, try 'help close'
$ echo $?
0

In general, we WANT openfile() to report failures, since it is the
function used in the form 'qemu-io -c "$something" no_such_file'
for performing one or more -c options on a single file, and it is
not worth attempting $something if the file itself cannot be opened.
So the solution is to fix open_f() to always return 0 (when we are
in interactive mode, even failure to open should not end the
session), and save the return value of openfile() for command line
use in main().

Note, however, that we do have some qemu-iotests that do 'qemu-io
-c "open file" -c "$something"'; such tests will now proceed to
attempt $something whether or not the open succeeded, the same way
as if the two commands had been attempted in interactive mode.  As
such, the expected output for those tests has to be modified.  But it
also means that it is now possible to use -c close and have a single
qemu-io command line operate on more than one file even without
using interactive mode.  Although the '-c open' action is a subtle
change in behavior, remember that qemu-io is for debugging purposes,
so as long as it serves the needs of qemu-iotests while still being
reasonable for interactive use, it should not be a problem that we
are changing tests to the new behavior.

This has been awkward since at least as far back as commit
e3aff4f, in 2009.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-07-10 13:18:05 +02:00
..
acpi-test-data i386/acpi: update expected acpi files 2017-07-03 22:42:36 +03:00
data tests: use static qga config file 2016-07-25 13:23:18 -05:00
docker docker: add mipsel build target 2017-06-21 15:02:43 +01:00
guest-debug tests/guest-debug: introduce basic gdbstub tests 2015-12-17 13:37:15 +00:00
image-fuzzer tests: Use Python 2.6 "except E as ..." syntax 2016-02-08 17:29:54 +01:00
libqos libqos: add virtio used ring support 2017-06-30 11:03:45 +01:00
migration tests: introduce a framework for testing migration performance 2016-07-22 13:23:39 +05:30
multiboot tests/multiboot: Add test for modules 2015-01-26 12:22:44 +01:00
qapi-schema qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
qemu-iotests qemu-io: Don't die on second open 2017-07-10 13:18:05 +02:00
rocker rocker: tests: don't need to specify master/self when setting vlans 2015-07-07 13:13:22 +01:00
tcg target/openrisc: Rename the cpu from or32 to or1k 2017-02-14 08:14:58 +11:00
vmstate-static-checker-data tests: vmstate static checker: add size mismatch inside substructure 2014-06-23 19:14:52 +02:00
.gitignore qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
ac97-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
acpi-utils.c tests: Move reusable ACPI code into a utility file 2017-03-02 07:14:27 +02:00
acpi-utils.h hw/i386: Use Rev3 FADT (ACPI 2.0) instead of Rev1 to improve guest OS support. 2017-05-03 12:29:40 +02:00
ahci-test.c ahci-test: add QMP tray test for ATAPI 2016-11-14 11:15:55 -05:00
atomic_add-bench.c tests: add atomic_add-bench 2016-10-26 08:29:01 -07:00
bios-tables-test.c pci, virtio, vhost: fixes 2017-05-18 10:01:08 +01:00
boot-order-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
boot-sector.c tests/boot-sector: Increase time-out to 90 seconds 2016-10-14 10:06:47 +11:00
boot-sector.h tests/boot-sector: Use mkstemp() to create a unique file name 2016-10-14 10:06:47 +11:00
boot-serial-test.c boot-serial-test: use -no-shutdown 2017-03-24 13:39:50 +00:00
check-block.sh tests: allow to specify list of formats to test for check-block.sh 2016-09-23 13:36:09 +02:00
check-qdict.c tests/qdict: check more get_try_int() cases 2017-06-20 14:31:33 +02:00
check-qjson.c json: learn to parse uint64 numbers 2017-06-20 14:31:31 +02:00
check-qlist.c tests: remove /{qnum, qlist, dict}/destroy test 2017-06-20 14:31:31 +02:00
check-qnull.c qapi: Drop unused non-strict qobject input visitor 2017-03-05 09:14:19 +01:00
check-qnum.c qnum: add uint type 2017-06-20 14:31:31 +02:00
check-qom-interface.c tests: fix check-qom-interface leaks 2016-09-08 17:57:32 +04:00
check-qom-proplist.c monitor: fix object_del for command-line-created objects 2017-06-06 09:29:46 +02:00
check-qstring.c tests: remove /{qnum, qlist, dict}/destroy test 2017-06-20 14:31:31 +02:00
crypto-tls-x509-helpers.c tests: Clean up includes 2016-02-16 14:29:27 +00:00
crypto-tls-x509-helpers.h clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
device-introspect-test.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
display-vga-test.c qtest: add display-vga-test to ppc64 2017-01-31 10:10:13 +11:00
drive_del-test.c tests: Use null-co:// instead of /dev/null as the dummy image 2017-05-11 11:08:40 +02:00
ds1338-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
e1000-test.c tests: fix e1000-test leak 2017-03-01 11:51:28 +04:00
e1000e-test.c tests: fix e1000e leaks 2017-03-01 11:51:28 +04:00
eepro100-test.c tests: fix eepro100-test leak 2017-03-01 11:51:05 +04:00
endianness-test.c tests: fix endianness-test leaks 2017-03-01 00:09:28 +04:00
es1370-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
fdc-test.c fdc-test: Avoid deprecated 'change' command 2017-05-09 09:14:40 +02:00
fw_cfg-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
hd-geo-test.c tests: fix hd-geo-test leaks 2017-03-01 11:51:04 +04:00
i440fx-test.c tests: fix i440fx-test leaks 2017-03-01 11:51:28 +04:00
i82801b11-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
ide-test.c ide-test: check return of fwrite 2017-06-04 18:42:55 +03:00
intel-hda-test.c coccinelle: Remove unnecessary variables for function return value 2016-06-20 16:38:13 +02:00
io-channel-helpers.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
io-channel-helpers.h io: add QIOChannelSocket class 2015-12-18 12:18:31 +00:00
ioh3420-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
iothread.c aio: introduce aio_co_schedule and aio_co_wake 2017-02-21 11:14:07 +00:00
iothread.h aio: introduce aio_co_schedule and aio_co_wake 2017-02-21 11:14:07 +00:00
ipmi-bt-test.c tests: fix ipmi-bt-test leak 2017-03-01 11:51:05 +04:00
ipmi-kcs-test.c tests: fix ipmi-kcs-test leak 2017-03-01 11:51:05 +04:00
ipoctal232-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
ivshmem-test.c qtest: add ivshmem-test for ppc64 2017-01-31 10:10:13 +11:00
libqtest.c tests/libqtest: Print error instead of aborting when env variable is missing 2017-06-04 18:42:55 +03:00
libqtest.h libqtest: Add a generic function to run a callback function for every machine 2017-04-26 14:42:31 +01:00
m25p80-test.c aspeed/smc: extend tests for Command mode 2017-01-20 11:15:08 +00:00
m48t59-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
Makefile.include tests: Add unit tests for the VM Generation ID feature 2017-07-03 22:29:49 +03:00
megasas-test.c megasas: always store SCSIRequest* into MegasasCmd 2017-06-15 11:04:05 +02:00
ne2000-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
numa-test.c numa-test: fix query-cpus leaks 2017-05-30 16:09:48 -03:00
nvme-test.c tests: Use null-co:// instead of /dev/null as the dummy image 2017-05-11 11:08:40 +02:00
pc-cpu-test.c libqtest: Add a generic function to run a callback function for every machine 2017-04-26 14:42:31 +01:00
pcnet-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
pkix_asn1_tab.c qtest: fix make check complaint in crypto module 2016-10-19 10:09:24 +01:00
pnv-xscom-test.c powernv: Don't test POWER9 CPU yet 2017-03-03 11:30:59 +11:00
postcopy-test.c chardev: move headers to include/chardev 2017-06-02 11:33:52 +04:00
prom-env-test.c tests/prom-env: Enable the test for the sun4u machine, too 2017-02-28 09:03:39 +03:00
ptimer-test-stubs.c tests: fix ptimer leaks 2017-03-01 00:09:28 +04:00
ptimer-test.c tests: fix ptimer leaks 2017-03-01 00:09:28 +04:00
ptimer-test.h tests: ptimer: Change the copyright comment 2016-10-24 16:26:53 +01:00
pvpanic-test.c tests: fix qmp response leak 2017-03-01 00:09:28 +04:00
pxe-test.c tests/boot-sector: Use mkstemp() to create a unique file name 2016-10-14 10:06:47 +11:00
q35-test.c tests/q35-test: add TSEG size checks 2017-06-16 18:44:55 +03:00
qemu-iotests-quick.sh qemu-iotests: Speed up make check-block 2015-01-13 11:47:55 +00:00
qht-bench.c qht-bench: relax test_start/stop atomic accesses 2016-10-24 15:27:19 +02:00
qmp-test.c qapi: Drop unused non-strict qobject input visitor 2017-03-05 09:14:19 +01:00
qom-test.c libqtest: Add a generic function to run a callback function for every machine 2017-04-26 14:42:31 +01:00
rcutorture.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
rtas-test.c tests: don't check if qtest_spapr_boot() returns NULL 2016-10-28 09:36:58 +11:00
rtc-test.c qtest: add rtc periodic timer test 2017-06-06 20:18:35 +02:00
rtl8139-test.c libqos: Change PCI accessors to take opaque BAR handle 2016-10-28 09:38:27 +11:00
spapr-phb-test.c spapr: Improved placement of PCI host bridges in guest memory map 2016-10-16 12:04:15 +11:00
tco-test.c tests: fix tco-test leaks 2017-03-01 11:51:25 +04:00
test-aio-multithread.c cpus: define QEMUTimerListNotifyCB for QEMU system emulation 2017-03-14 13:28:29 +01:00
test-aio.c cpus: define QEMUTimerListNotifyCB for QEMU system emulation 2017-03-14 13:28:29 +01:00
test-arm-mptimer.c tests: Add tests for the ARM MPTimer 2016-10-24 16:26:54 +01:00
test-base64.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-bitcnt.c tests: New test-bitcnt 2017-01-10 08:49:59 -08:00
test-bitops.c bitops.h: Implement half-shuffle and half-unshuffle ops 2016-06-17 15:23:51 +01:00
test-blockjob-txn.c blockjob: strengthen a bit test-blockjob-txn 2017-05-24 16:38:51 -04:00
test-blockjob.c blockjob: introduce block_job_early_fail 2017-05-24 16:38:51 -04:00
test-bufferiszero.c cutils: Add test for buffer_is_zero 2016-09-13 19:13:32 +02:00
test-char.c tests/test-char.c: Don't use main_loop_wait()'s return value 2017-07-04 14:39:27 +02:00
test-clone-visitor.c tests/qapi-schema: Avoid 'str' in alternate test cases 2017-05-31 16:04:05 +02:00
test-coroutine.c test-coroutine: test qemu_coroutine_entered() 2016-09-28 17:11:23 +01:00
test-crypto-afsplit.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
test-crypto-block.c crypto: move 'opaque' parameter to (nearly) the end of parameter list 2017-05-09 14:41:47 +01:00
test-crypto-cipher.c crypto: add 3des-ede support when using libgcrypt/nettle 2016-12-21 14:26:26 +00:00
test-crypto-hash.c crypto: fix initialization of crypto in tests 2016-10-19 10:23:55 +01:00
test-crypto-hmac.c crypto: add HMAC algorithms testcases 2016-12-22 09:24:59 +00:00
test-crypto-ivgen.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
test-crypto-pbkdf.c crypto: support more hash algorithms for pbkdf 2016-09-19 16:30:45 +01:00
test-crypto-secret.c crypto: remove temp files on completion of secrets test 2016-06-13 12:41:17 +01:00
test-crypto-tlscredsx509.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
test-crypto-tlssession.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
test-crypto-xts.c crypto: rename OUT to out in xts test to avoid clash on MinGW 2016-07-04 10:46:59 +01:00
test-cutils.c util/cutils: Change qemu_strtosz*() from int64_t to uint64_t 2017-02-23 20:35:36 +01:00
test-filter-mirror.c tests: fix qmp response leak 2017-03-01 00:09:28 +04:00
test-filter-redirector.c tests: fix qmp response leak 2017-03-01 00:09:28 +04:00
test-hbitmap.c test-hbitmap: Add hbitmap_is_serializable() calls 2017-01-26 10:25:01 +08:00
test-hmp.c Add chardev-send-break monitor command 2017-06-29 17:14:11 +01:00
test-int128.c int128: Use __int128 if available 2016-10-26 08:29:00 -07:00
test-io-channel-buffer.c tests: Clean up includes 2016-02-16 14:29:27 +00:00
test-io-channel-command.c tests: fix leaks in test-io-channel-command 2017-03-01 00:09:28 +04:00
test-io-channel-file.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
test-io-channel-socket.c sockets: Limit SocketAddressLegacy to external interfaces 2017-05-09 09:14:40 +02:00
test-io-channel-tls.c io: change the QIOTask callback signature 2017-01-23 15:32:18 +00:00
test-io-task.c io: fix possible double free of task error object 2017-01-26 10:26:18 +00:00
test-iov.c tests: fix test-iov leaks 2016-09-08 17:57:32 +04:00
test-keyval.c tests: Remove test cases for alternates of 'number' and 'int' 2017-06-19 14:56:29 +02:00
test-logging.c test-logging: don't hard-code paths in /tmp 2016-08-19 12:44:11 +01:00
test-mul64.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-netfilter.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-opts-visitor.c qapi: Fix QemuOpts visitor regression on unvisited input 2017-03-22 19:24:34 +01:00
test-qapi-util.c qapi: New parse_qapi_name() 2017-03-07 16:07:47 +01:00
test-qdev-global-props.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-qdist.c qdist: return "(empty)" instead of NULL when printing an empty dist 2016-08-03 18:44:56 +02:00
test-qemu-opts.c qobject: Use simpler QDict/QList scalar insertion macros 2017-05-09 09:13:51 +02:00
test-qga.c test-qga: Actually test 0xff sync bytes 2017-05-09 09:14:40 +02:00
test-qht-par.c clean-includes: run it once more 2016-06-16 18:39:03 +02:00
test-qht.c test-qht: perform lookups under rcu_read_lock 2016-10-06 18:04:13 +02:00
test-qmp-commands.c qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
test-qmp-event.c qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
test-qobject-input-visitor.c qapi: update the qobject visitor to use QNUM_U64 2017-06-20 14:31:31 +02:00
test-qobject-output-visitor.c qapi: update the qobject visitor to use QNUM_U64 2017-06-20 14:31:31 +02:00
test-rcu-list.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-replication.c tests: Disable image lock in test-replication 2017-05-11 11:08:41 +02:00
test-shift128.c host-utils: Implement unsigned quadword left/right shift and unit tests 2017-01-31 10:10:14 +11:00
test-string-input-visitor.c qapi: Fix string input visitor regression for empty lists 2017-03-21 10:43:01 +01:00
test-string-output-visitor.c qapi: rename *qmp-*-visitor* to *qobject-*-visitor* 2016-10-25 16:25:48 +02:00
test-thread-pool.c test-thread-pool: use generic AioContext infrastructure 2017-02-21 11:14:07 +00:00
test-throttle.c throttle: make throttle_config(throttle_get_config()) symmetric 2017-04-21 10:36:12 +01:00
test-timed-average.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-uuid.c test-uuid: fix leak 2016-11-11 20:53:23 +08:00
test-visitor-serialization.c test-visitor-serialization: Pass &error_abort to qobject_from_json() 2017-03-07 16:07:47 +01:00
test-vmstate.c migration: Move migration.h to migration/ 2017-06-13 11:00:45 +02:00
test-write-threshold.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-x86-cpuid-compat.c qapi: merge QInt and QFloat in QNum 2017-06-20 14:31:31 +02:00
test-x86-cpuid.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
test-xbzrle.c migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00
tmp105-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
tpci200-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
usb-hcd-ehci-test.c tests: fix usb-test leaks 2017-03-01 11:51:29 +04:00
usb-hcd-ohci-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
usb-hcd-uhci-test.c tests: Use null-co:// instead of /dev/null as the dummy image 2017-05-11 11:08:40 +02:00
usb-hcd-xhci-test.c tests: Use null-co:// instead of /dev/null as the dummy image 2017-05-11 11:08:40 +02:00
vhost-user-bridge.c vhost-user-bridge: fix iov_restore_front() warning 2017-06-08 22:02:36 +03:00
vhost-user-test.c char: make chr_fe_deinit() optionaly delete backend 2017-06-02 11:33:53 +04:00
virtio-9p-test.c tests/virtio-9p-test: Don't call le*_to_cpus on fields of packed struct 2017-03-27 21:15:31 +02:00
virtio-balloon-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
virtio-blk-test.c tests: fix virtio-blk-test ISR dependence 2017-06-30 11:03:45 +01:00
virtio-console-test.c coccinelle: Remove unnecessary variables for function return value 2016-06-20 16:38:13 +02:00
virtio-net-test.c tests: fix virtio-net-test ISR dependence 2017-06-30 11:03:45 +01:00
virtio-rng-test.c tests: enable virtio tests on SPAPR 2016-10-28 09:36:58 +11:00
virtio-scsi-test.c tests: fix virtio-scsi-test ISR dependence 2017-06-30 11:03:45 +01:00
virtio-serial-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
vmgenid-test.c tests: Add unit tests for the VM Generation ID feature 2017-07-03 22:29:49 +03:00
vmxnet3-test.c tests: Remove unnecessary glib.h includes 2016-06-07 18:19:24 +03:00
wdt_ib700-test.c coccinelle: Remove unnecessary variables for function return value 2016-06-20 16:38:13 +02:00