dbus_bool_t _dbus_spawn_test (const char *test_data_dir) { if (!_dbus_test_oom_handling ("spawn_nonexistent", check_spawn_nonexistent, NULL)) return FALSE; /* Don't run the obnoxious segfault test by default, * it's a pain to have to click all those error boxes. */ if (getenv ("DO_SEGFAULT_TEST")) if (!_dbus_test_oom_handling ("spawn_segfault", check_spawn_segfault, NULL)) return FALSE; if (!_dbus_test_oom_handling ("spawn_exit", check_spawn_exit, NULL)) return FALSE; if (!_dbus_test_oom_handling ("spawn_and_kill", check_spawn_and_kill, NULL)) return FALSE; return TRUE; }
dbus_bool_t _dbus_spawn_test (const char *test_data_dir) { if (!_dbus_test_oom_handling ("spawn_nonexistent", check_spawn_nonexistent, NULL)) return FALSE; if (!_dbus_test_oom_handling ("spawn_segfault", check_spawn_segfault, NULL)) return FALSE; if (!_dbus_test_oom_handling ("spawn_exit", check_spawn_exit, NULL)) return FALSE; if (!_dbus_test_oom_handling ("spawn_and_kill", check_spawn_and_kill, NULL)) return FALSE; return TRUE; }
EXPORT_C #endif dbus_bool_t _dbus_spawn_test (const char *test_data_dir) { if (!_dbus_test_oom_handling ("spawn_nonexistent", check_spawn_nonexistent, NULL)) return FALSE; #ifndef __SYMBIAN32__ if (!_dbus_test_oom_handling ("spawn_segfault", check_spawn_segfault, NULL)) return FALSE; #endif // No signal support in Symbian #ifndef __SYMBIAN32__ if (!_dbus_test_oom_handling ("spawn_exit", check_spawn_exit, NULL)) return FALSE; #endif // No baby sitter support in Symbian #ifndef __SYMBIAN32__ if (!_dbus_test_oom_handling ("spawn_and_kill", check_spawn_and_kill, NULL)) return FALSE; #endif // No signal support in Symbian return TRUE; }
int main (int argc, char **argv) { #ifdef DBUS_BUILD_TESTS const char *dir; DBusString config_file; 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; } printf ("%s: Running launch helper OOM checks\n", argv[0]); if (!_dbus_string_init (&config_file)) return 1; if (!_dbus_string_append (&config_file, dir)) return 1; if (!_dbus_string_append (&config_file, "/valid-config-files-system/debug-allow-all-pass.conf")) return 1; /* use a config file that will actually work... */ _dbus_setenv ("TEST_LAUNCH_HELPER_CONFIG", _dbus_string_get_const_data (&config_file)); _dbus_string_free (&config_file); if (!_dbus_test_oom_handling ("dbus-daemon-launch-helper", bus_activation_helper_oom_test, "org.freedesktop.DBus.TestSuiteEchoService")) die ("OOM failed"); test_post_hook (argv[0]); 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) { const char *dir; DBusString config_file; if (argc > 1 && strcmp (argv[1], "--tap") != 0) dir = argv[1]; else dir = _dbus_getenv ("DBUS_TEST_DATA"); if (dir == NULL) _dbus_test_fatal ("Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable"); _dbus_test_diag ("%s: Running launch helper OOM checks", argv[0]); if (!_dbus_string_init (&config_file) || !_dbus_string_append (&config_file, dir) || !_dbus_string_append (&config_file, "/valid-config-files-system/debug-allow-all-pass.conf")) _dbus_test_fatal ("OOM during initialization"); /* use a config file that will actually work... */ dbus_setenv ("TEST_LAUNCH_HELPER_CONFIG", _dbus_string_get_const_data (&config_file)); _dbus_string_free (&config_file); if (!_dbus_test_oom_handling ("dbus-daemon-launch-helper", bus_activation_helper_oom_test, (char *) "org.freedesktop.DBus.TestSuiteEchoService")) _dbus_test_fatal ("OOM test failed"); /* ... otherwise it must have passed */ _dbus_test_ok ("%s", argv[0]); _dbus_test_check_memleaks (argv[0]); return _dbus_test_done_testing (); }