[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 65/69] libqos: add blkdebug_prepare_script
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 65/69] libqos: add blkdebug_prepare_script |
Date: |
Fri, 27 Feb 2015 18:19:03 +0000 |
From: John Snow <address@hidden>
Pull this helper out of ide-test and into libqos,
to be shared with ahci-test.
Signed-off-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/ide-test.c | 23 +----------------------
tests/libqos/libqos.c | 22 ++++++++++++++++++++++
tests/libqos/libqos.h | 1 +
3 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/tests/ide-test.c b/tests/ide-test.c
index 1dae84f..78382e9 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -29,6 +29,7 @@
#include <glib.h>
#include "libqtest.h"
+#include "libqos/libqos.h"
#include "libqos/pci-pc.h"
#include "libqos/malloc-pc.h"
@@ -494,28 +495,6 @@ static void test_flush(void)
ide_test_quit();
}
-static void prepare_blkdebug_script(const char *debug_fn, const char *event)
-{
- FILE *debug_file = fopen(debug_fn, "w");
- int ret;
-
- fprintf(debug_file, "[inject-error]\n");
- fprintf(debug_file, "event = \"%s\"\n", event);
- fprintf(debug_file, "errno = \"5\"\n");
- fprintf(debug_file, "state = \"1\"\n");
- fprintf(debug_file, "immediately = \"off\"\n");
- fprintf(debug_file, "once = \"on\"\n");
-
- fprintf(debug_file, "[set-state]\n");
- fprintf(debug_file, "event = \"%s\"\n", event);
- fprintf(debug_file, "new_state = \"2\"\n");
- fflush(debug_file);
- g_assert(!ferror(debug_file));
-
- ret = fclose(debug_file);
- g_assert(ret == 0);
-}
-
static void test_retry_flush(const char *machine)
{
uint8_t data;
diff --git a/tests/libqos/libqos.c b/tests/libqos/libqos.c
index c825486..4bb047c 100644
--- a/tests/libqos/libqos.c
+++ b/tests/libqos/libqos.c
@@ -98,3 +98,25 @@ void mkqcow2(const char *file, unsigned size_mb)
{
return mkimg(file, "qcow2", size_mb);
}
+
+void prepare_blkdebug_script(const char *debug_fn, const char *event)
+{
+ FILE *debug_file = fopen(debug_fn, "w");
+ int ret;
+
+ fprintf(debug_file, "[inject-error]\n");
+ fprintf(debug_file, "event = \"%s\"\n", event);
+ fprintf(debug_file, "errno = \"5\"\n");
+ fprintf(debug_file, "state = \"1\"\n");
+ fprintf(debug_file, "immediately = \"off\"\n");
+ fprintf(debug_file, "once = \"on\"\n");
+
+ fprintf(debug_file, "[set-state]\n");
+ fprintf(debug_file, "event = \"%s\"\n", event);
+ fprintf(debug_file, "new_state = \"2\"\n");
+ fflush(debug_file);
+ g_assert(!ferror(debug_file));
+
+ ret = fclose(debug_file);
+ g_assert(ret == 0);
+}
diff --git a/tests/libqos/libqos.h b/tests/libqos/libqos.h
index 8cb2987..f57362b 100644
--- a/tests/libqos/libqos.h
+++ b/tests/libqos/libqos.h
@@ -21,6 +21,7 @@ QOSState *qtest_boot(QOSOps *ops, const char *cmdline_fmt,
...);
void qtest_shutdown(QOSState *qs);
void mkimg(const char *file, const char *fmt, unsigned size_mb);
void mkqcow2(const char *file, unsigned size_mb);
+void prepare_blkdebug_script(const char *debug_fn, const char *event);
static inline uint64_t qmalloc(QOSState *q, size_t bytes)
{
--
2.1.0
- [Qemu-devel] [PULL 54/69] qtest/ahci: Add a macro bootup routine, (continued)
- [Qemu-devel] [PULL 54/69] qtest/ahci: Add a macro bootup routine, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 58/69] qtest/ahci: add fragmented dma test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 55/69] libqos/ahci: add ahci command helpers, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 57/69] qtest/ahci: Add PIO and LBA48 tests, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 59/69] qtest/ahci: add qcow2 support to ahci-test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 61/69] qtest/ahci: Add simple flush test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 62/69] qtest/ahci: Allow override of default CLI options, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 60/69] qtest/ahci: test different disk sectors, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 63/69] libqtest: add qmp_eventwait, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 64/69] libqtest: add qmp_async, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 65/69] libqos: add blkdebug_prepare_script,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 66/69] qtest/ahci: add flush retry test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 69/69] tests: Check QVIRTIO_F_ANY_LAYOUT flag in virtio-blk test, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 68/69] libqos: Solve bug in interrupt checking when using MSIX in virtio-pci.c, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 67/69] sheepdog: fix confused return values, Stefan Hajnoczi, 2015/02/27
- Re: [Qemu-devel] [PULL 00/69] Block patches, Stefan Hajnoczi, 2015/02/27