diff options
author | Ross Burton <ross@linux.intel.com> | 2010-04-15 11:17:29 +0100 |
---|---|---|
committer | Ross Burton <ross@linux.intel.com> | 2010-04-15 11:17:29 +0100 |
commit | 479158cbe1ecccee111f49f0a7529adcf743d726 (patch) | |
tree | c50173721fe97b4ba49e4d85fd0c8bad8c094663 /tests | |
parent | 60483a6706584b43ac3ac434d626be19d83bb05d (diff) | |
download | librest-479158cbe1ecccee111f49f0a7529adcf743d726.tar.gz |
tests: add a timeout to oauth-async
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oauth-async.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/oauth-async.c b/tests/oauth-async.c index 51c8546..c7f77b8 100644 --- a/tests/oauth-async.c +++ b/tests/oauth-async.c @@ -23,6 +23,7 @@ #include <rest/oauth-proxy.h> #include <rest/oauth-proxy-private.h> #include <stdio.h> +#include <stdlib.h> static GMainLoop *loop; @@ -97,6 +98,14 @@ request_token_cb (OAuthProxy *proxy, g_assert_no_error (err); } +static gboolean +on_timeout (gpointer data) +{ + g_message ("timed out!"); + exit (1); + return FALSE; +} + int main (int argc, char **argv) { @@ -107,6 +116,9 @@ main (int argc, char **argv) g_thread_init (NULL); g_type_init (); + /* Install a timeout so that we don't hang or infinite loop */ + g_timeout_add_seconds (10, on_timeout, NULL); + loop = g_main_loop_new (NULL, TRUE); /* Create the proxy */ |