OSDN Git Service

fuzz: add fuzz_reset API
authorAlexander Bulekov <alxndr@bu.edu>
Sun, 5 Feb 2023 04:29:43 +0000 (23:29 -0500)
committerAlexander Bulekov <alxndr@bu.edu>
Fri, 17 Feb 2023 03:08:37 +0000 (22:08 -0500)
As we are converting most fuzzers to rely on reboots to reset state,
introduce an API to make sure reboots are invoked in a consistent
manner.

Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
tests/qtest/fuzz/fuzz.c
tests/qtest/fuzz/fuzz.h

index eb75205..3bedb81 100644 (file)
@@ -51,6 +51,12 @@ void flush_events(QTestState *s)
     }
 }
 
+void fuzz_reset(QTestState *s)
+{
+    qemu_system_reset(SHUTDOWN_CAUSE_GUEST_RESET);
+    main_loop_wait(true);
+}
+
 static QTestState *qtest_setup(void)
 {
     qtest_server_set_send_handler(&qtest_client_inproc_recv, &fuzz_qts);
index 327c1c5..21d1362 100644 (file)
@@ -103,7 +103,7 @@ typedef struct FuzzTarget {
 } FuzzTarget;
 
 void flush_events(QTestState *);
-void reboot(QTestState *);
+void fuzz_reset(QTestState *);
 
 /* Use the QTest ASCII protocol or call address_space API directly?*/
 void fuzz_qtest_set_serialize(bool option);