[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/28] ide-test: add test for werror=stop
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 03/28] ide-test: add test for werror=stop |
Date: |
Thu, 31 Jul 2014 11:58:56 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Jul 07, 2014 at 02:17:44PM -0400, John Snow wrote:
> @@ -489,6 +490,72 @@ static void test_flush(void)
> ide_test_quit();
> }
>
> +static void prepare_blkdebug_script(const char *debug_path, const char
> *event)
> +{
> + FILE *debug_file = fopen(debug_path, "w");
Please avoid shadowing the global debug_path variable. Perhaps simply
call the argument 'filename'.
> +static void test_retry_flush(void)
> +{
> + uint8_t data;
> + const char *s;
> +
> + prepare_blkdebug_script(debug_path, "flush_to_disk");
> +
> + ide_test_start(
> + "-vnc none "
> + "-drive
> file=blkdebug:%s:%s,if=ide,cache=writeback,rerror=stop,werror=stop",
> + debug_path, tmp_path);
> +
> + /* FLUSH CACHE command on device 0*/
> + outb(IDE_BASE + reg_device, 0);
> + outb(IDE_BASE + reg_command, CMD_FLUSH_CACHE);
> +
> + /* Check status while request is in flight*/
> + data = inb(IDE_BASE + reg_status);
> + assert_bit_set(data, BSY | DRDY);
> + assert_bit_clear(data, DF | ERR | DRQ);
> +
> + sleep(1); /* HACK: wait for event */
> +
> + /* Complete the command */
> + s = "{'execute':'cont' }";
> + while (!qmp(s)) {
> + s = "";
> + sleep(1);
> + }
I guess we're supposed to wait for the block I/O error event when the
machine stops. Please implement that and replace this polling loop.
See the STOP event in docs/qmp/qmp-events.txt.
> @@ -501,6 +568,11 @@ int main(int argc, char **argv)
> return 0;
> }
>
> + /* Create temporary blkdebug instructions */
> + fd = mkstemp(debug_path);
> + g_assert(fd >= 0);
> + close(fd);
> +
debug_path must be unlinked at the end of main(). Tests should not
clutter up the /tmp directory, all resources must be freed.
pgpYpY5lOzkex.pgp
Description: PGP signature
- [Qemu-devel] [PATCH 00/28] ahci refactoring to support ahci-test suite, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 01/28] blkdebug: report errors on flush too, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 02/28] libqtest: add QTEST_LOG for debugging qtest testcases, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 03/28] ide-test: add test for werror=stop, John Snow, 2014/07/07
- Re: [Qemu-devel] [PATCH 03/28] ide-test: add test for werror=stop,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 04/28] ide: stash aiocb for flushes, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 06/28] ide: simplify set_inactive callbacks, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 07/28] ide: simplify async_cmd_done callbacks, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 05/28] ide: simplify reset callbacks, John Snow, 2014/07/07
- [Qemu-devel] [PATCH 11/28] ide: fold add_status callback into set_inactive, John Snow, 2014/07/07