diff mbox series

[PULL,02/10] fuzz: add fuzz_reset API

Message ID 20230217040855.16873-3-alxndr@bu.edu
State New
Headers show
Series [PULL,01/10] hw/sparse-mem: clear memory on reset | expand

Commit Message

Alexander Bulekov Feb. 17, 2023, 4:08 a.m. UTC
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 | 6 ++++++
 tests/qtest/fuzz/fuzz.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Darren Kenny Feb. 17, 2023, 10:48 a.m. UTC | #1
I know this is a pull request, but if you prefer to have all the patches
with and R-b, you can add mine here too, but I'll leave it up to you.

Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

Thanks,

Darren.

On Thursday, 2023-02-16 at 23:08:47 -05, Alexander Bulekov wrote:
> 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 | 6 ++++++
>  tests/qtest/fuzz/fuzz.h | 2 +-
>  2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
> index eb7520544b..3bedb81b32 100644
> --- a/tests/qtest/fuzz/fuzz.c
> +++ b/tests/qtest/fuzz/fuzz.c
> @@ -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);
> diff --git a/tests/qtest/fuzz/fuzz.h b/tests/qtest/fuzz/fuzz.h
> index 327c1c5a55..21d1362d65 100644
> --- a/tests/qtest/fuzz/fuzz.h
> +++ b/tests/qtest/fuzz/fuzz.h
> @@ -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);
> -- 
> 2.39.0
Alexander Bulekov Feb. 17, 2023, 2:47 p.m. UTC | #2
On 230217 1048, Darren Kenny wrote:
> I know this is a pull request, but if you prefer to have all the patches
> with and R-b, you can add mine here too, but I'll leave it up to you.
> 
> Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
> 

Thank you Darren - I missed that this one wasn't reviewed..
diff mbox series

Patch

diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index eb7520544b..3bedb81b32 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -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);
diff --git a/tests/qtest/fuzz/fuzz.h b/tests/qtest/fuzz/fuzz.h
index 327c1c5a55..21d1362d65 100644
--- a/tests/qtest/fuzz/fuzz.h
+++ b/tests/qtest/fuzz/fuzz.h
@@ -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);