mirror of
https://gitlab.freedesktop.org/upower/power-profiles-daemon.git
synced 2026-05-08 12:28:05 +02:00
tests: Move test config file to a private directory
If we are to run all the tests in parallel, we need to make sure that each instance of the daemon gets its own configuration file, otherwise all of them will be trying to change each other's config behind their backs.
This commit is contained in:
parent
c48108763b
commit
4ee64adc81
2 changed files with 6 additions and 5 deletions
|
|
@ -29,7 +29,7 @@ typedef struct {
|
|||
int ret;
|
||||
|
||||
GKeyFile *config;
|
||||
const char *config_path;
|
||||
char *config_path;
|
||||
|
||||
PpdProfile active_profile;
|
||||
PpdProfile selected_profile;
|
||||
|
|
@ -284,9 +284,9 @@ load_configuration (PpdApp *data)
|
|||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (g_getenv ("UMOCKDEV_DIR") != NULL)
|
||||
data->config_path = "ppd_test_conf.ini";
|
||||
data->config_path = g_build_filename (g_getenv ("UMOCKDEV_DIR"), "ppd_test_conf.ini", NULL);
|
||||
else
|
||||
data->config_path = "/var/lib/power-profiles-daemon/state.ini";
|
||||
data->config_path = g_strdup ("/var/lib/power-profiles-daemon/state.ini");
|
||||
data->config = g_key_file_new ();
|
||||
if (!g_key_file_load_from_file (data->config, data->config_path, G_KEY_FILE_KEEP_COMMENTS, &error))
|
||||
g_debug ("Could not load configuration file '%s': %s", data->config_path, error->message);
|
||||
|
|
@ -894,6 +894,7 @@ free_app_data (PpdApp *data)
|
|||
data->name_id = 0;
|
||||
}
|
||||
|
||||
g_clear_pointer (&data->config_path, g_free);
|
||||
g_clear_pointer (&data->config, g_key_file_unref);
|
||||
g_ptr_array_free (data->probed_drivers, TRUE);
|
||||
g_ptr_array_free (data->actions, TRUE);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ class Tests(dbusmock.DBusTestCase):
|
|||
self.stop_daemon()
|
||||
del self.tp_acpi
|
||||
try:
|
||||
os.remove('ppd_test_conf.ini')
|
||||
os.remove(self.testbed.get_root_dir() + '/' + 'ppd_test_conf.ini')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
@ -708,7 +708,7 @@ class Tests(dbusmock.DBusTestCase):
|
|||
self.stop_daemon()
|
||||
|
||||
# sys.stderr.write('\n-------------- config file: ----------------\n')
|
||||
# with open('ppd_test_conf.ini') as f:
|
||||
# with open(self.testbed.get_root_dir() + '/' + 'ppd_test_conf.ini') as f:
|
||||
# sys.stderr.write(f.read())
|
||||
# sys.stderr.write('------------------------------\n')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue