Commit 9843c724 authored by Simon McVittie's avatar Simon McVittie

Revert "name-test C tests: produce structured (TAP) output"

This reverts commit fec99c9b.
This change was intended for 1.11.
parent c285a053
...@@ -11,13 +11,10 @@ ...@@ -11,13 +11,10 @@
static void static void
die (const char *message) die (const char *message)
{ {
printf ("Bail out! test-ids: %s\n", message); fprintf (stderr, "*** test-ids: %s", message);
exit (1); exit (1);
} }
static int test_num = 0;
/* This test outputs TAP syntax: http://testanything.org/ */
int int
main (int argc, main (int argc,
char **argv) char **argv)
...@@ -26,7 +23,7 @@ main (int argc, ...@@ -26,7 +23,7 @@ main (int argc,
DBusConnection *connection; DBusConnection *connection;
char *id; char *id;
char *server_id; char *server_id;
dbus_error_init (&error); dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_SESSION, &error); connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL) if (connection == NULL)
...@@ -36,35 +33,24 @@ main (int argc, ...@@ -36,35 +33,24 @@ main (int argc,
dbus_error_free (&error); dbus_error_free (&error);
return 1; return 1;
} }
printf ("ok %d - connected to session bus\n", ++test_num);
server_id = dbus_connection_get_server_id (connection); server_id = dbus_connection_get_server_id (connection);
if (server_id == NULL) if (server_id == NULL)
die ("No bus server ID retrieved\n"); die ("No bus server ID retrieved\n");
/* printf("'%s'\n", server_id); */
printf ("ok %d - session bus server ID is %s\n", ++test_num, server_id);
if (strlen (server_id) != 32) if (strlen (server_id) != 32)
die ("Bus server id should have length 32\n"); die ("Bus server id should have length 32\n");
printf ("ok %d - session bus server ID length is 32\n", ++test_num);
dbus_free (server_id); dbus_free (server_id);
id = dbus_bus_get_id (connection, NULL); id = dbus_bus_get_id (connection, NULL);
if (id == NULL) if (id == NULL)
die ("No bus ID retrieved\n"); die ("No bus ID retrieved\n");
/* printf("'%s'\n", id); */
printf ("ok %d - session bus ID is %s\n", ++test_num, id);
if (strlen (id) != 32) if (strlen (id) != 32)
die ("Bus ID should have length 32\n"); die ("Bus ID should have length 32\n");
printf ("ok %d - session bus ID length is 32\n", ++test_num);
dbus_free (id); dbus_free (id);
printf ("1..%d\n", test_num); _dbus_verbose ("*** Test IDs exiting\n");
return 0; return 0;
} }
...@@ -56,13 +56,13 @@ _run_iteration (DBusConnection *conn) ...@@ -56,13 +56,13 @@ _run_iteration (DBusConnection *conn)
if (reply == NULL) if (reply == NULL)
{ {
printf ("Bail out! Reply is NULL ***\n"); printf ("Failed: Reply is NULL ***\n");
exit (1); exit (1);
} }
if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
{ {
printf ("Bail out! Reply is error: %s ***\n", dbus_message_get_error_name (reply)); printf ("Failed: Reply is error: %s ***\n", dbus_message_get_error_name (reply));
exit (1); exit (1);
} }
...@@ -72,7 +72,6 @@ _run_iteration (DBusConnection *conn) ...@@ -72,7 +72,6 @@ _run_iteration (DBusConnection *conn)
} }
/* This test outputs TAP syntax: http://testanything.org/ */
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
...@@ -88,7 +87,7 @@ main (int argc, char *argv[]) ...@@ -88,7 +87,7 @@ main (int argc, char *argv[])
but if it does and we are stuck in a poll call then we know the but if it does and we are stuck in a poll call then we know the
stuck in poll bug has come back to haunt us */ stuck in poll bug has come back to haunt us */
printf ("# Testing stuck in poll\n"); printf ("*** Testing stuck in poll\n");
dbus_error_init (&error); dbus_error_init (&error);
...@@ -105,10 +104,10 @@ main (int argc, char *argv[]) ...@@ -105,10 +104,10 @@ main (int argc, char *argv[])
/* we just care about seconds */ /* we just care about seconds */
delta = end_tv_sec - start_tv_sec; delta = end_tv_sec - start_tv_sec;
printf ("ok %d - %lis\n", i + 1, delta); printf ("Iter %i: %lis\n", i, delta);
if (delta >= 5) if (delta >= 5)
{ {
printf ("Bail out! Looks like we might have been be stuck in poll ***\n"); printf ("Failed: looks like we might have been be stuck in poll ***\n");
exit (1); exit (1);
} }
} }
...@@ -120,6 +119,6 @@ main (int argc, char *argv[]) ...@@ -120,6 +119,6 @@ main (int argc, char *argv[])
dbus_connection_send (conn, method, NULL); dbus_connection_send (conn, method, NULL);
dbus_message_unref (method); dbus_message_unref (method);
printf ("# Testing completed\n1..%d\n", i); printf ("Success ***\n");
exit (0); exit (0);
} }
...@@ -39,13 +39,13 @@ _method_call (DBusConnection *conn, ...@@ -39,13 +39,13 @@ _method_call (DBusConnection *conn,
if (reply == NULL) if (reply == NULL)
{ {
printf ("Bail out! Reply is NULL ***\n"); printf ("Failed: Reply is NULL ***\n");
exit (1); exit (1);
} }
if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
{ {
printf ("Bail out! Reply is error: %s ***\n", dbus_message_get_error_name (reply)); printf ("Failed: Reply is error: %s ***\n", dbus_message_get_error_name (reply));
exit (1); exit (1);
} }
...@@ -61,7 +61,6 @@ _run_iteration (DBusConnection *conn) ...@@ -61,7 +61,6 @@ _run_iteration (DBusConnection *conn)
_method_call (conn, INT_MAX); _method_call (conn, INT_MAX);
} }
/* This test outputs TAP syntax: http://testanything.org/ */
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
...@@ -72,7 +71,7 @@ main (int argc, char *argv[]) ...@@ -72,7 +71,7 @@ main (int argc, char *argv[])
DBusConnection *conn; DBusConnection *conn;
DBusError error; DBusError error;
printf ("# Testing pending call timeouts\n"); printf ("*** Testing pending call timeouts\n");
dbus_error_init (&error); dbus_error_init (&error);
...@@ -89,7 +88,7 @@ main (int argc, char *argv[]) ...@@ -89,7 +88,7 @@ main (int argc, char *argv[])
/* we just care about seconds */ /* we just care about seconds */
delta = end_tv_sec - start_tv_sec; delta = end_tv_sec - start_tv_sec;
printf ("ok %d - %lis\n", i + 1, delta); printf ("Iter %i: %lis\n", i, delta);
} }
method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService", method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService",
...@@ -99,6 +98,6 @@ main (int argc, char *argv[]) ...@@ -99,6 +98,6 @@ main (int argc, char *argv[])
dbus_connection_send (conn, method, NULL); dbus_connection_send (conn, method, NULL);
dbus_message_unref (method); dbus_message_unref (method);
printf ("# Testing completed\n1..%d\n", i); printf ("Success ***\n");
exit (0); exit (0);
} }
...@@ -102,7 +102,7 @@ open_shutdown_private_connection (dbus_bool_t use_guid) ...@@ -102,7 +102,7 @@ open_shutdown_private_connection (dbus_bool_t use_guid)
dbus_message_unref (msg); dbus_message_unref (msg);
if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &addr, DBUS_TYPE_INVALID)) if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &addr, DBUS_TYPE_INVALID))
die ("couldn't parse message replym\n"); die ("couldn't parse message replym\n");
printf ("# got private temp address %s\n", addr); printf ("got private temp address %s\n", addr);
addr = strdup (addr); addr = strdup (addr);
if (!use_guid) if (!use_guid)
{ {
...@@ -145,32 +145,24 @@ open_shutdown_private_connection (dbus_bool_t use_guid) ...@@ -145,32 +145,24 @@ open_shutdown_private_connection (dbus_bool_t use_guid)
_dbus_loop_unref (loop); _dbus_loop_unref (loop);
} }
/* This test outputs TAP syntax: http://testanything.org/ */
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
int test_num = 0;
open_shutdown_private_connection (TRUE); open_shutdown_private_connection (TRUE);
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
open_shutdown_private_connection (TRUE); open_shutdown_private_connection (TRUE);
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
open_shutdown_private_connection (FALSE); open_shutdown_private_connection (FALSE);
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
open_shutdown_private_connection (FALSE); open_shutdown_private_connection (FALSE);
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
printf ("1..%d\n", test_num);
return 0; return 0;
} }
...@@ -97,7 +97,7 @@ main (int argc, char *argv[]) ...@@ -97,7 +97,7 @@ main (int argc, char *argv[])
if (!server) if (!server)
die (error.message); die (error.message);
testdata->private_addr = dbus_server_get_address (server); testdata->private_addr = dbus_server_get_address (server);
fprintf (stderr, "test server listening on %s\n", testdata->private_addr); printf ("test server listening on %s\n", testdata->private_addr);
dbus_server_set_new_connection_function (server, new_connection_callback, dbus_server_set_new_connection_function (server, new_connection_callback,
testdata, NULL); testdata, NULL);
......
...@@ -7,7 +7,7 @@ static DBusLoop *loop; ...@@ -7,7 +7,7 @@ static DBusLoop *loop;
static void static void
die (const char *message) die (const char *message)
{ {
printf ("Bail out! test-shutdown: %s", message); fprintf (stderr, "*** test-shutdown: %s", message);
exit (1); exit (1);
} }
...@@ -46,28 +46,23 @@ open_destroy_shared_session_bus_connection (void) ...@@ -46,28 +46,23 @@ open_destroy_shared_session_bus_connection (void)
dbus_connection_unref (connection); dbus_connection_unref (connection);
} }
/* This test outputs TAP syntax: http://testanything.org/ */
int int
main (int argc, main (int argc,
char **argv) char **argv)
{ {
int test_num = 0;
open_destroy_shared_session_bus_connection (); open_destroy_shared_session_bus_connection ();
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
open_destroy_shared_session_bus_connection (); open_destroy_shared_session_bus_connection ();
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
open_destroy_shared_session_bus_connection (); open_destroy_shared_session_bus_connection ();
dbus_shutdown (); dbus_shutdown ();
printf ("ok %d\n", ++test_num);
printf ("1..%d\n", test_num); _dbus_verbose ("*** Test shutdown exiting\n");
return 0; return 0;
} }
...@@ -105,7 +105,7 @@ check_condvar_lock (DBusCondVar *condvar1, ...@@ -105,7 +105,7 @@ check_condvar_lock (DBusCondVar *condvar1,
} }
} }
/* This test outputs TAP syntax: http://testanything.org/ */
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
...@@ -116,7 +116,6 @@ main (int argc, char *argv[]) ...@@ -116,7 +116,6 @@ main (int argc, char *argv[])
DBusCondVar *dispatch_cond1, *io_path_cond1; DBusCondVar *dispatch_cond1, *io_path_cond1;
DBusMutex *mutex2, *dispatch_mutex2, *io_path_mutex2; DBusMutex *mutex2, *dispatch_mutex2, *io_path_mutex2;
DBusCondVar *dispatch_cond2, *io_path_cond2; DBusCondVar *dispatch_cond2, *io_path_cond2;
int test_num = 0;
printf ("*** Testing late thread init\n"); printf ("*** Testing late thread init\n");
...@@ -141,7 +140,6 @@ main (int argc, char *argv[]) ...@@ -141,7 +140,6 @@ main (int argc, char *argv[])
check_mutex_lock (io_path_mutex1, io_path_mutex2, TRUE); check_mutex_lock (io_path_mutex1, io_path_mutex2, TRUE);
check_condvar_lock (dispatch_cond1, dispatch_cond2, TRUE); check_condvar_lock (dispatch_cond1, dispatch_cond2, TRUE);
check_condvar_lock (io_path_cond1, io_path_cond2, TRUE); check_condvar_lock (io_path_cond1, io_path_cond2, TRUE);
printf ("ok %d\n", ++test_num);
dbus_threads_init_default (); dbus_threads_init_default ();
...@@ -163,7 +161,6 @@ main (int argc, char *argv[]) ...@@ -163,7 +161,6 @@ main (int argc, char *argv[])
check_mutex_lock (io_path_mutex1, io_path_mutex2, TRUE); check_mutex_lock (io_path_mutex1, io_path_mutex2, TRUE);
check_condvar_lock (dispatch_cond1, dispatch_cond2, TRUE); check_condvar_lock (dispatch_cond1, dispatch_cond2, TRUE);
check_condvar_lock (io_path_cond1, io_path_cond2, TRUE); check_condvar_lock (io_path_cond1, io_path_cond2, TRUE);
printf ("ok %d\n", ++test_num);
method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService", method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService",
"/org/freedesktop/TestSuite", "/org/freedesktop/TestSuite",
...@@ -172,6 +169,6 @@ main (int argc, char *argv[]) ...@@ -172,6 +169,6 @@ main (int argc, char *argv[])
dbus_connection_send (conn, method, NULL); dbus_connection_send (conn, method, NULL);
dbus_message_unref (method); dbus_message_unref (method);
printf ("Testing completed\n1..%d\n", test_num); printf ("Success ***\n");
exit (0); exit (0);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment