return strcmp (a, b);
}
+static void
+load_config_directory (const gchar *path, GList **messages)
+{
+ GDir *dir;
+ GList *files = NULL, *link;
+ GError *error = NULL;
+
+ /* Find configuration files */
+ dir = g_dir_open (path, 0, &error);
+ if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+ g_printerr ("Failed to open configuration directory %s: %s\n", path, error->message);
+ g_clear_error (&error);
+ if (dir)
+ {
+ const gchar *name;
+ while ((name = g_dir_read_name (dir)))
+ files = g_list_append (files, g_strdup (name));
+ g_dir_close (dir);
+ }
+
+ /* Sort alphabetically and load onto existing configuration */
+ files = g_list_sort (files, compare_strings);
+ for (link = files; link; link = link->next)
+ {
+ gchar *filename = link->data;
+ gchar *conf_path;
+
+ conf_path = g_build_filename (path, filename, NULL);
+ if (g_str_has_suffix (filename, ".conf"))
+ {
+ *messages = g_list_append (*messages, g_strdup_printf ("Loading configuration from %s", conf_path));
+ config_load_from_file (config_get_instance (), conf_path, &error);
+ if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
+ g_printerr ("Failed to load configuration from %s: %s\n", filename, error->message);
+ g_clear_error (&error);
+ }
+ else
+ g_debug ("Ignoring configuration file %s, it does not have .conf suffix", conf_path);
+ g_free (conf_path);
+ }
+ g_list_free_full (files, g_free);
+}
+
int
main (int argc, char **argv)
{
}
/* Load config file(s) */
+ load_config_directory (SYSTEM_CONFIG_DIR, &messages);
if (config_d_dir)
- {
- GDir *dir;
- GList *files = NULL, *link;
-
- /* Find configuration files */
- dir = g_dir_open (config_d_dir, 0, &error);
- if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
- g_printerr ("Failed to open configuration directory %s: %s\n", config_d_dir, error->message);
- g_clear_error (&error);
- if (dir)
- {
- const gchar *name;
- while ((name = g_dir_read_name (dir)))
- files = g_list_append (files, g_strdup (name));
- g_dir_close (dir);
- }
-
- /* Sort alphabetically and load onto existing configuration */
- files = g_list_sort (files, compare_strings);
- for (link = files; link; link = link->next)
- {
- gchar *filename = link->data;
- gchar *path;
-
- path = g_build_filename (config_d_dir, filename, NULL);
- if (g_str_has_suffix (filename, ".conf"))
- {
- messages = g_list_append (messages, g_strdup_printf ("Loading configuration from %s", path));
- config_load_from_file (config_get_instance (), path, &error);
- if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
- g_printerr ("Failed to load configuration from %s: %s\n", filename, error->message);
- g_clear_error (&error);
- }
- else
- g_debug ("Ignoring configuration file %s, it does not have .conf suffix", path);
- g_free (path);
- }
- g_list_free_full (files, g_free);
- }
+ load_config_directory (config_d_dir, &messages);
g_free (config_d_dir);
messages = g_list_append (messages, g_strdup_printf ("Loading configuration from %s", config_path));
if (!config_load_from_file (config_get_instance (), config_path, &error))
{
GMainLoop *loop;
int i;
- gchar *greeter = NULL, *script_name, *config_file, *additional_config, *path, *path1, *path2, *ld_preload, *ld_library_path, *home_dir;
+ gchar *greeter = NULL, *script_name, *config_file, *additional_system_config;
+ gchar *additional_config, *path, *path1, *path2, *ld_preload, *ld_library_path, *home_dir;
GString *passwd_data, *group_data;
GSource *status_source;
gchar cwd[1024];
if (system (g_strdup_printf ("cp %s %s/etc/lightdm/lightdm.conf", config_path, temp_dir)))
perror ("Failed to copy configuration");
+ additional_system_config = g_key_file_get_string (config, "test-runner-config", "additional-system-config", NULL);
+ if (additional_system_config)
+ {
+ gchar **files;
+
+ g_mkdir_with_parents (g_strdup_printf ("%s/usr/share/lightdm/lightdm.conf.d", temp_dir), 0755);
+
+ files = g_strsplit (additional_system_config, " ", -1);
+ for (i = 0; files[i]; i++)
+ if (system (g_strdup_printf ("cp %s/tests/scripts/%s %s/usr/share/lightdm/lightdm.conf.d", SRCDIR, files[i], temp_dir)))
+ perror ("Failed to copy configuration");
+ g_strfreev (files);
+ }
+
additional_config = g_key_file_get_string (config, "test-runner-config", "additional-config", NULL);
if (additional_config)
{