25 #include "dbus-internals.h" 26 #include "dbus-test.h" 27 #include "dbus-auth.h" 28 #include <dbus/dbus-test-tap.h> 37 #ifdef DBUS_ENABLE_EMBEDDED_TESTS 38 #include "dbus-auth-script.h" 42 process_test_subdir (
const DBusString *test_base_dir,
55 _dbus_test_fatal (
"didn't allocate test_directory");
61 _dbus_test_fatal (
"couldn't copy test_base_dir to test_directory");
64 _dbus_test_fatal (
"couldn't allocate full path");
68 _dbus_test_fatal (
"didn't allocate filename string");
74 _dbus_string_get_const_data (&test_directory),
80 _dbus_test_diag (
"Testing %s:", subdir);
88 _dbus_test_fatal (
"couldn't init string");
91 _dbus_test_fatal (
"couldn't copy dir to full_path");
94 _dbus_test_fatal (
"couldn't concat file to dir");
98 _dbus_verbose (
"Skipping non-.auth-script file %s\n",
99 _dbus_string_get_const_data (&filename));
104 _dbus_test_diag (
" %s", _dbus_string_get_const_data (&filename));
106 if (!_dbus_auth_script_run (&full_path))
117 _dbus_warn (
"Could not get next file in %s: %s",
118 _dbus_string_get_const_data (&test_directory), error.
message);
136 process_test_dirs (
const char *test_data_dir)
145 if (!process_test_subdir (&test_directory,
"auth"))
158 _dbus_auth_test (
const char *test_data_dir)
161 if (test_data_dir ==
NULL)
164 if (!process_test_dirs (test_data_dir))
const char * message
public error message field
#define NULL
A null pointer, defined appropriately for C or C++.
void _dbus_directory_close(DBusDirIter *iter)
Closes a directory iteration.
dbus_bool_t _dbus_directory_get_next_file(DBusDirIter *iter, DBusString *filename, DBusError *error)
Get next file in the directory.
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack.
void dbus_error_free(DBusError *error)
Frees an error that's been set (or just initialized), then reinitializes the error as in dbus_error_i...
dbus_bool_t _dbus_concat_dir_and_file(DBusString *dir, const DBusString *next_component)
Appends the given filename to the given directory.
DBusDirIter * _dbus_directory_open(const DBusString *filename, DBusError *error)
Open a directory to iterate over.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
dbus_bool_t _dbus_string_copy(const DBusString *source, int start, DBusString *dest, int insert_at)
Like _dbus_string_move(), but does not delete the section of the source string that's copied to the d...
dbus_bool_t _dbus_string_ends_with_c_str(const DBusString *a, const char *c_str)
Returns whether a string ends with the given suffix.
Internals of directory iterator.
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
Object representing an exception.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as #_DBUS_STRING_I...
#define TRUE
Expands to "1".
#define FALSE
Expands to "0".
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).