summaryrefslogtreecommitdiff
path: root/bus/config-parser-trivial.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-09-03 12:18:39 -0700
committerSimon McVittie <smcv@collabora.com>2018-12-17 14:12:59 +0000
commit03158095968de8a9542b7ce448d5e9b36f10d827 (patch)
treea075322a3fd25865665e1ad2a16cd74a2677e46c /bus/config-parser-trivial.c
parentbb58ce1707799c49ea0164e0ae3b25a02b4e6dce (diff)
downloaddbus-03158095968de8a9542b7ce448d5e9b36f10d827.tar.gz
embedded tests: Conform to the same API for all tests
This will make it possible to unify the wrapper code that runs them. I'm using a plain C string rather than a DBusString to make it more straightforward to carve out tests into their own executables. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'bus/config-parser-trivial.c')
-rw-r--r--bus/config-parser-trivial.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/bus/config-parser-trivial.c b/bus/config-parser-trivial.c
index e230faa2..fd7bbf00 100644
--- a/bus/config-parser-trivial.c
+++ b/bus/config-parser-trivial.c
@@ -687,36 +687,41 @@ check_file_valid (DBusString *full_path,
}
dbus_bool_t
-bus_config_parser_trivial_test (const DBusString *test_data_dir)
+bus_config_parser_trivial_test (const char *test_data_dir_cstr)
{
+ DBusString test_data_dir;
DBusString full_path;
dbus_bool_t retval;
retval = FALSE;
- if (test_data_dir == NULL ||
- _dbus_string_get_length (test_data_dir) == 0)
+ if (test_data_dir_cstr == NULL || test_data_dir_cstr[0] == '\0')
{
_dbus_test_diag ("No test data");
return TRUE;
}
-
+
+ _dbus_string_init_const (&test_data_dir, test_data_dir_cstr);
+
/* We already test default_session_servicedirs and default_system_servicedirs
* in bus_config_parser_test() */
- if (!process_test_valid_subdir (test_data_dir, "valid-config-files", VALID))
+ if (!process_test_valid_subdir (&test_data_dir, "valid-config-files",
+ VALID))
goto finish;
#ifndef DBUS_WIN
/* We already test default_session_servicedirs and default_system_servicedirs
* in bus_config_parser_test() */
- if (!process_test_valid_subdir (test_data_dir, "valid-config-files-system", VALID))
+ if (!process_test_valid_subdir (&test_data_dir,
+ "valid-config-files-system", VALID))
goto finish;
#endif
/* we don't process all the invalid files, as the trivial parser can't hope
* to validate them all for all different syntaxes. We just check one broken
* file to see if junk is received */
- if (!make_full_path (test_data_dir, "invalid-config-files", "not-well-formed.conf", &full_path))
+ if (!make_full_path (&test_data_dir, "invalid-config-files",
+ "not-well-formed.conf", &full_path))
goto finish;
if (!check_file_valid (&full_path, INVALID))
goto finish;
@@ -724,7 +729,8 @@ bus_config_parser_trivial_test (const DBusString *test_data_dir)
#ifndef DBUS_WIN
/* just test if the check_file_valid works okay and we got sane values */
- if (!make_full_path (test_data_dir, "valid-config-files-system", "system.conf", &full_path))
+ if (!make_full_path (&test_data_dir, "valid-config-files-system",
+ "system.conf", &full_path))
goto finish;
if (!check_file_valid (&full_path, VALID))
goto finish;