diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2021-02-23 14:46:45 +0000 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2021-03-08 14:55:19 +0100 |
commit | e1fa7f5591c219a94f039754f6fbe58e757e7af6 (patch) | |
tree | daddd47ae57e0512543abc820d828e66ffd03361 /tests/qtest/libqos | |
parent | 7a23c523762371fd26a7a9ecfa8f16b64618a1ad (diff) | |
download | qemu-e1fa7f5591c219a94f039754f6fbe58e757e7af6.zip qemu-e1fa7f5591c219a94f039754f6fbe58e757e7af6.tar.gz qemu-e1fa7f5591c219a94f039754f6fbe58e757e7af6.tar.bz2 |
libqtest: add qtest_remove_abrt_handler()
Add a function to remove previously-added abrt handler functions.
Now that a symmetric pair of add/remove functions exists we can also
balance the SIGABRT handler installation. The signal handler was
installed each time qtest_add_abrt_handler() was called. Now it is
installed when the abrt handler list becomes non-empty and removed again
when the list becomes empty.
The qtest_remove_abrt_handler() function will be used by
vhost-user-blk-test.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20210223144653.811468-5-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/qtest/libqos')
-rw-r--r-- | tests/qtest/libqos/libqtest.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h index 51287b9..a68dcd7 100644 --- a/tests/qtest/libqos/libqtest.h +++ b/tests/qtest/libqos/libqtest.h @@ -649,9 +649,27 @@ void qtest_add_data_func_full(const char *str, void *data, g_free(path); \ } while (0) +/** + * qtest_add_abrt_handler: + * @fn: Handler function + * @data: Argument that is passed to the handler + * + * Add a handler function that is invoked on SIGABRT. This can be used to + * terminate processes and perform other cleanup. The handler can be removed + * with qtest_remove_abrt_handler(). + */ void qtest_add_abrt_handler(GHookFunc fn, const void *data); /** + * qtest_remove_abrt_handler: + * @data: Argument previously passed to qtest_add_abrt_handler() + * + * Remove an abrt handler that was previously added with + * qtest_add_abrt_handler(). + */ +void qtest_remove_abrt_handler(void *data); + +/** * qtest_qmp_assert_success: * @qts: QTestState instance to operate on * @fmt: QMP message to send to qemu, formatted like |