summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-09 18:03:49 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-11-09 19:51:09 +0000
commit2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47 (patch)
treea718347b5c6141743397b90fe6cf90116a7c8738 /tests
parentb460d9f32eb527bc7aad4894a5f85c4e69366104 (diff)
downloadlibguestfs-2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47.tar.gz
libguestfs-2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47.tar.xz
libguestfs-2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47.zip
tools: Modify existing tools to use guestfs_{push,pop}_error_handler.
This is a shorter and more convenient way to disable errors temporarily across calls.
Diffstat (limited to 'tests')
-rw-r--r--tests/charsets/test-charset-fidelity.c7
-rw-r--r--tests/mount-local/test-parallel-mount-local.c7
-rw-r--r--tests/regressions/rhbz790721.c7
3 files changed, 6 insertions, 15 deletions
diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c
index b358f2cd..d67787fe 100644
--- a/tests/charsets/test-charset-fidelity.c
+++ b/tests/charsets/test-charset-fidelity.c
@@ -448,15 +448,12 @@ feature_available (guestfs_h *g, const char *feature)
/* If there's an error we should ignore it, so to do that we have to
* temporarily replace the error handler with a null one.
*/
- guestfs_error_handler_cb old_error_cb;
- void *old_error_data;
- old_error_cb = guestfs_get_error_handler (g, &old_error_data);
- guestfs_set_error_handler (g, NULL, NULL);
+ guestfs_push_error_handler (g, NULL, NULL);
const char *groups[] = { feature, NULL };
int r = guestfs_available (g, (char * const *) groups);
- guestfs_set_error_handler (g, old_error_cb, old_error_data);
+ guestfs_pop_error_handler (g);
return r == 0 ? 1 : 0;
}
diff --git a/tests/mount-local/test-parallel-mount-local.c b/tests/mount-local/test-parallel-mount-local.c
index 791a7488..989a9baf 100644
--- a/tests/mount-local/test-parallel-mount-local.c
+++ b/tests/mount-local/test-parallel-mount-local.c
@@ -204,8 +204,6 @@ start_thread (void *statevp)
time_t start_t, t;
pid_t pid;
int status, r;
- guestfs_error_handler_cb old_error_cb;
- void *old_error_cb_data;
g = guestfs_create ();
if (g == NULL) {
@@ -264,10 +262,9 @@ start_thread (void *statevp)
/* Run the FUSE main loop. We don't really want to see libguestfs
* errors here since these are harmless.
*/
- old_error_cb = guestfs_get_error_handler (g, &old_error_cb_data);
- guestfs_set_error_handler (g, NULL, NULL);
+ guestfs_push_error_handler (g, NULL, NULL);
r = guestfs_mount_local_run (g);
- guestfs_set_error_handler (g, old_error_cb, old_error_cb_data);
+ guestfs_pop_error_handler (g);
/* Wait for child process to exit and catch any errors from it. */
again:
diff --git a/tests/regressions/rhbz790721.c b/tests/regressions/rhbz790721.c
index 7d5c266c..72746779 100644
--- a/tests/regressions/rhbz790721.c
+++ b/tests/regressions/rhbz790721.c
@@ -121,8 +121,6 @@ start_thread (void *vi)
{
guestfs_h *g;
int r, thread_id = *(int *)vi;
- guestfs_error_handler_cb old_error_cb;
- void *old_error_data;
const char *error;
g = guestfs_create ();
@@ -159,8 +157,7 @@ start_thread (void *vi)
* will fail with "child process died unexpectedly". We are
* interested in other failures.
*/
- old_error_cb = guestfs_get_error_handler (g, &old_error_data);
- guestfs_set_error_handler (g, NULL, NULL);
+ guestfs_push_error_handler (g, NULL, NULL);
r = guestfs_launch (g);
error = guestfs_last_error (g);
@@ -190,7 +187,7 @@ start_thread (void *vi)
pthread_exit (vi);
}
- guestfs_set_error_handler (g, old_error_cb, old_error_data);
+ guestfs_pop_error_handler (g);
/* Close the handle. */
guestfs_close (g);