[libmediaart] tests: No new temporary cache directories for subprocess tests
- From: Yanko Kaneti <yaneti src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libmediaart] tests: No new temporary cache directories for subprocess tests
- Date: Thu, 13 Nov 2014 12:20:25 +0000 (UTC)
commit 2664fa72d671c6b15a4e1924272c29179d900025
Author: Yanko Kaneti <yaneti declera com>
Date: Thu Nov 13 14:07:29 2014 +0200
tests: No new temporary cache directories for subprocess tests
Otherwise subprocess tests that assert by design leave those behind
tests/mediaarttest.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/tests/mediaarttest.c b/tests/mediaarttest.c
index 696b6de..cef36c2 100644
--- a/tests/mediaarttest.c
+++ b/tests/mediaarttest.c
@@ -496,17 +496,21 @@ test_mediaart_process_failures_subprocess (void)
int
main (int argc, char **argv)
{
- const gchar *cache_home_originally;
- const gchar *temp_cache_dir;
+ const gchar *cache_home_originally = NULL;
+ gchar *temp_cache_dir;
gchar *dir;
gint success;
gint i;
g_test_init (&argc, &argv, NULL);
- temp_cache_dir = g_dir_make_tmp ("libmediaart-tests-XXXXXX", NULL);
- cache_home_originally = g_getenv ("XDG_CACHE_HOME");
- g_setenv ("XDG_CACHE_HOME", temp_cache_dir, TRUE);
+ if (!g_test_subprocess ()) {
+ temp_cache_dir = g_dir_make_tmp ("libmediaart-tests-XXXXXX", NULL);
+ cache_home_originally = g_getenv ("XDG_CACHE_HOME");
+ g_setenv ("XDG_CACHE_HOME", temp_cache_dir, TRUE);
+ } else {
+ temp_cache_dir = g_strdup (g_get_user_cache_dir ());
+ }
for (i = 0; strip_test_cases[i].test_name; i++) {
gchar *testpath;
@@ -548,6 +552,7 @@ main (int argc, char **argv)
g_unsetenv ("XDG_CACHE_HOME");
}
g_rmdir (temp_cache_dir);
+ g_free (temp_cache_dir);
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]