int main (int argc, char **argv) { #ifdef DBUS_BUILD_TESTS const char *dir; DBusString test_data_dir; progname = argv[0]; if (argc > 1) dir = argv[1]; else dir = _dbus_getenv ("DBUS_TEST_DATA"); if (dir == NULL) { fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n"); return 1; } _dbus_string_init_const (&test_data_dir, dir); if (!_dbus_threads_init_debug ()) die ("initializing debug threads"); test_pre_hook (); printf ("%s: Running config file parser (trivial) test\n", argv[0]); if (!bus_config_parser_trivial_test (&test_data_dir)) die ("parser"); test_post_hook (); printf ("%s: Success\n", argv[0]); return 0; #else /* DBUS_BUILD_TESTS */ printf ("Not compiled with test support\n"); return 0; #endif }
/** * An exported symbol to be run in order to execute * unit tests. Should not be used by * any app other than our test app, this symbol * won't exist in some builds of the library. * (with --enable-tests=no) * * @param test_data_dir the directory with test data (test/data normally) */ void dbus_internal_do_not_use_run_tests (const char *test_data_dir, const char *specific_test) { #ifdef DBUS_BUILD_TESTS if (!_dbus_threads_init_debug ()) die ("debug threads init"); if (test_data_dir == NULL) test_data_dir = _dbus_getenv ("DBUS_TEST_DATA"); if (test_data_dir != NULL) printf ("Test data in %s\n", test_data_dir); else printf ("No test data!\n"); run_test ("string", specific_test, _dbus_string_test); run_test ("sysdeps", specific_test, _dbus_sysdeps_test); run_test ("data-slot", specific_test, _dbus_data_slot_test); run_test ("misc", specific_test, _dbus_misc_test); run_test ("address", specific_test, _dbus_address_test); run_test ("server", specific_test, _dbus_server_test); run_test ("object-tree", specific_test, _dbus_object_tree_test); run_test ("signature", specific_test, _dbus_signature_test); run_test ("marshalling", specific_test, _dbus_marshal_test); #if 0 printf ("%s: running recursive marshalling tests\n", "dbus-test"); if (!_dbus_marshal_recursive_test ()) die ("recursive marshal"); check_memleaks (); #else _dbus_warn ("recursive marshal tests disabled\n"); #endif run_test ("byteswap", specific_test, _dbus_marshal_byteswap_test); run_test ("memory", specific_test, _dbus_memory_test); #if 1 run_test ("mem-pool", specific_test, _dbus_mem_pool_test); #endif run_test ("list", specific_test, _dbus_list_test); run_test ("marshal-validate", specific_test, _dbus_marshal_validate_test); run_test ("marshal-header", specific_test, _dbus_marshal_header_test); run_data_test ("message", specific_test, _dbus_message_test, test_data_dir); run_test ("hash", specific_test, _dbus_hash_test); #if !defined(DBUS_WINCE) run_data_test ("spawn", specific_test, _dbus_spawn_test, test_data_dir); #endif run_data_test ("credentials", specific_test, _dbus_credentials_test, test_data_dir); #ifdef DBUS_UNIX run_data_test ("userdb", specific_test, _dbus_userdb_test, test_data_dir); #endif run_test ("keyring", specific_test, _dbus_keyring_test); #if 0 printf ("%s: running md5 tests\n", "dbus-test"); if (!_dbus_md5_test ()) die ("md5"); check_memleaks (); #endif run_data_test ("sha", specific_test, _dbus_sha_test, test_data_dir); run_data_test ("auth", specific_test, _dbus_auth_test, test_data_dir); run_data_test ("pending-call", specific_test, _dbus_pending_call_test, test_data_dir); printf ("%s: completed successfully\n", "dbus-test"); #else printf ("Not compiled with unit tests, not running any\n"); #endif }
int main (int argc, char **argv) { #ifdef DBUS_BUILD_TESTS const char *dir; const char *only; DBusString test_data_dir; progname = argv[0]; if (argc > 1) dir = argv[1]; else dir = _dbus_getenv ("DBUS_TEST_DATA"); if (argc > 2) only = argv[2]; else only = NULL; if (dir == NULL) { fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n"); return 1; } _dbus_string_init_const (&test_data_dir, dir); if (!_dbus_threads_init_debug ()) die ("initializing debug threads"); if (only == NULL || strcmp (only, "expire-list") == 0) { test_pre_hook (); printf ("%s: Running expire list test\n", argv[0]); if (!bus_expire_list_test (&test_data_dir)) die ("expire list"); test_post_hook (); } if (only == NULL || strcmp (only, "config-parser") == 0) { test_pre_hook (); printf ("%s: Running config file parser test\n", argv[0]); if (!bus_config_parser_test (&test_data_dir)) die ("parser"); test_post_hook (); } if (only == NULL || strcmp (only, "signals") == 0) { test_pre_hook (); printf ("%s: Running signals test\n", argv[0]); if (!bus_signals_test (&test_data_dir)) die ("signals"); test_post_hook (); } if (only == NULL || strcmp (only, "dispatch-sha1") == 0) { test_pre_hook (); printf ("%s: Running SHA1 connection test\n", argv[0]); if (!bus_dispatch_sha1_test (&test_data_dir)) die ("sha1"); test_post_hook (); } if (only == NULL || strcmp (only, "dispatch") == 0) { test_pre_hook (); printf ("%s: Running message dispatch test\n", argv[0]); if (!bus_dispatch_test (&test_data_dir)) die ("dispatch"); test_post_hook (); } if (only == NULL || strcmp (only, "activation-service-reload") == 0) { test_pre_hook (); printf ("%s: Running service files reloading test\n", argv[0]); if (!bus_activation_service_reload_test (&test_data_dir)) die ("service reload"); test_post_hook (); } #ifdef HAVE_UNIX_FD_PASSING if (only == NULL || strcmp (only, "unix-fds-passing") == 0) { test_pre_hook (); printf ("%s: Running unix fd passing test\n", argv[0]); if (!bus_unix_fds_passing_test (&test_data_dir)) die ("unix fd passing"); test_post_hook (); } #endif printf ("%s: Success\n", argv[0]); return 0; #else /* DBUS_BUILD_TESTS */ printf ("Not compiled with test support\n"); return 0; #endif }
int main (int argc, char **argv) { #ifdef DBUS_BUILD_TESTS const char *dir; DBusString test_data_dir; progname = argv[0]; if (argc > 1) dir = argv[1]; else dir = _dbus_getenv ("DBUS_TEST_DATA"); dir = "c:\\data\\dbus"; if (dir == NULL) { fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n"); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n"); #endif return 1; } _dbus_string_init_const (&test_data_dir, dir); if (!_dbus_threads_init_debug ()) die ("initializing debug threads"); test_pre_hook (); printf ("%s: Running expire list test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running expire list test\n", argv[0]); #endif if (!bus_expire_list_test (&test_data_dir)) die ("expire list"); test_post_hook (); test_pre_hook (); printf ("%s: Running config file parser test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running config file parser test\n", argv[0]); #endif if (!bus_config_parser_test (&test_data_dir)) die ("parser"); test_post_hook (); test_pre_hook (); printf ("%s: Running policy test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running policy test\n", argv[0]); #endif if (!bus_policy_test (&test_data_dir)) die ("policy"); test_post_hook (); test_pre_hook (); printf ("%s: Running signals test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running signals test\n", argv[0]); #endif if (!bus_signals_test (&test_data_dir)) die ("signals"); test_post_hook (); test_pre_hook (); printf ("%s: Running SHA1 connection test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running SHA1 connection test\n", argv[0]); #endif if (!bus_dispatch_sha1_test (&test_data_dir)) die ("sha1"); test_post_hook (); test_pre_hook (); printf ("%s: Running service files reloading test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running service files reloading test\n", argv[0]); #endif if (!bus_activation_service_reload_test (&test_data_dir)) die ("service reload"); test_post_hook (); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running message dispatch test\n", argv[0]); #endif test_pre_hook (); printf ("%s: Running message dispatch test\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Running message dispatch test\n", argv[0]); #endif if (!bus_dispatch_test (&test_data_dir)) die ("dispatch"); /*2 bytes of memory leak to be investigated*/ //test_post_hook (); printf ("%s: Success\n", argv[0]); #ifdef __SYMBIAN32__ std_log(LOG_FILENAME_LINE, "%s: Success\n", argv[0]); create_xml(0); #endif return 0; #else /* DBUS_BUILD_TESTS */ printf ("Not compiled with test support\n"); return 0; #endif }
int main (int argc, char **argv) { #ifdef DBUS_BUILD_TESTS const char *dir; DBusString test_data_dir; progname = argv[0]; if (argc > 1) dir = argv[1]; else dir = _dbus_getenv ("DBUS_TEST_DATA"); if (dir == NULL) { fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n"); return 1; } _dbus_string_init_const (&test_data_dir, dir); #if 0 /* FIXME this is disabled because of thread bugs that need fixing... */ if (!_dbus_threads_init_debug ()) die ("initializing debug threads"); #endif test_pre_hook (); printf ("%s: Running expire list test\n", argv[0]); if (!bus_expire_list_test (&test_data_dir)) die ("expire list"); test_post_hook (); test_pre_hook (); printf ("%s: Running config file parser test\n", argv[0]); if (!bus_config_parser_test (&test_data_dir)) die ("parser"); test_post_hook (); test_pre_hook (); printf ("%s: Running policy test\n", argv[0]); if (!bus_policy_test (&test_data_dir)) die ("policy"); test_post_hook (); test_pre_hook (); printf ("%s: Running signals test\n", argv[0]); if (!bus_signals_test (&test_data_dir)) die ("signals"); test_post_hook (); test_pre_hook (); printf ("%s: Running SHA1 connection test\n", argv[0]); if (!bus_dispatch_sha1_test (&test_data_dir)) die ("sha1"); test_post_hook (); test_pre_hook (); printf ("%s: Running message dispatch test\n", argv[0]); if (!bus_dispatch_test (&test_data_dir)) die ("dispatch"); test_post_hook (); test_pre_hook (); printf ("%s: Running service files reloading test\n", argv[0]); if (!bus_activation_service_reload_test (&test_data_dir)) die ("service reload"); test_post_hook (); printf ("%s: Success\n", argv[0]); return 0; #else /* DBUS_BUILD_TESTS */ printf ("Not compiled with test support\n"); return 0; #endif }