Codebase list flatpak / 930c46c
d/patches/: Add patch backported from 0.9.4, and new patch sent upstream to PR #894, to avoid using the real home directory in tests Simon McVittie 6 years ago
4 changed file(s) with 116 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 flatpak (0.8.7-3) UNRELEASED; urgency=medium
1
2 * d/patches/: Add patch backported from 0.9.4, and new patch sent
3 upstream to PR #894, to avoid using the real home directory in tests
4
5 -- Simon McVittie <smcv@debian.org> Tue, 04 Jul 2017 11:42:36 +0100
6
07 flatpak (0.8.7-2) unstable; urgency=medium
18
29 * Move upstreamed patch to debian/patches/0.9.1/ to make it obvious
0 From: Alexander Larsson <alexl@redhat.com>
1 Date: Tue, 9 May 2017 13:23:53 +0200
2 Subject: Fix tests by setting XDG_CACHE_HOME
3
4 We use this now, so need to have it set to the test homedir
5
6 Origin: backport, 0.9.4, commit:0d4fa486b54997a25596f93e985df67fc58ab5c5
7 ---
8 tests/libtest.sh | 1 +
9 1 file changed, 1 insertion(+)
10
11 diff --git a/tests/libtest.sh b/tests/libtest.sh
12 index 0f35195..72573f0 100644
13 --- a/tests/libtest.sh
14 +++ b/tests/libtest.sh
15 @@ -80,6 +80,7 @@ mkdir -p ${TEST_DATA_DIR}/system
16 export FLATPAK_SYSTEM_DIR=${TEST_DATA_DIR}/system
17 export FLATPAK_SYSTEM_HELPER_ON_SESSION=1
18
19 +export XDG_CACHE_HOME=${TEST_DATA_DIR}/home/cache
20 export XDG_DATA_HOME=${TEST_DATA_DIR}/home/share
21 export XDG_RUNTIME_DIR=${TEST_DATA_DIR}/runtime
22
22 0.8.8/install-Manually-save-summary-.sig-in-cache-repo.patch
33 0.8.8/Manually-copy-summary-for-update-and-appdata-too.patch
44 0.9.1/Improve-and-simplify-profile-snippet.patch
5 0.9.4/Fix-tests-by-setting-XDG_CACHE_HOME.patch
6 tests-Isolate-tests-from-real-home-directory-more-thoroug.patch
0 From: Simon McVittie <smcv@debian.org>
1 Date: Tue, 4 Jul 2017 11:01:09 +0100
2 Subject: tests: Isolate tests from real home directory more thoroughly
3
4 The library test previously used the real ~/.cache, while the
5 library test and the shell-script tests would use the real ~/.config
6 to look up the XDG user-dirs.dirs. Other home-directory-related code
7 might have used the real $HOME.
8
9 As a general rule, build-time tests should not affect the real home
10 directory. Debian autobuilders run as a user whose home directory
11 does not exist, in order to catch packages whose build process could
12 affect or be affected by the contents of the home directory. This
13 caused testlibrary to fail when it tried to create that nonexistent
14 directory, which I think happened while trying to create ~/.cache.
15
16 Signed-off-by: Simon McVittie <smcv@debian.org>
17 Forwarded: https://github.com/flatpak/flatpak/pull/894
18 ---
19 tests/libtest.sh | 2 ++
20 tests/testlibrary.c | 27 ++++++++++++++++++++++++---
21 2 files changed, 26 insertions(+), 3 deletions(-)
22
23 diff --git a/tests/libtest.sh b/tests/libtest.sh
24 index 72573f0..801606f 100644
25 --- a/tests/libtest.sh
26 +++ b/tests/libtest.sh
27 @@ -80,7 +80,9 @@ mkdir -p ${TEST_DATA_DIR}/system
28 export FLATPAK_SYSTEM_DIR=${TEST_DATA_DIR}/system
29 export FLATPAK_SYSTEM_HELPER_ON_SESSION=1
30
31 +export HOME=${TEST_DATA_DIR}/home
32 export XDG_CACHE_HOME=${TEST_DATA_DIR}/home/cache
33 +export XDG_CONFIG_HOME=${TEST_DATA_DIR}/home/config
34 export XDG_DATA_HOME=${TEST_DATA_DIR}/home/share
35 export XDG_RUNTIME_DIR=${TEST_DATA_DIR}/runtime
36
37 diff --git a/tests/testlibrary.c b/tests/testlibrary.c
38 index e14bdf6..a9a6deb 100644
39 --- a/tests/testlibrary.c
40 +++ b/tests/testlibrary.c
41 @@ -766,6 +766,9 @@ copy_gpg (void)
42 static void
43 global_setup (void)
44 {
45 + g_autofree char *cachedir = NULL;
46 + g_autofree char *configdir = NULL;
47 + g_autofree char *datadir = NULL;
48 g_autofree char *homedir = NULL;
49
50 testdir = g_strdup ("/var/tmp/flatpak-test-XXXXXX");
51 @@ -773,11 +776,29 @@ global_setup (void)
52 if (g_test_verbose ())
53 g_print ("testdir: %s\n", testdir);
54
55 - homedir = g_strconcat (testdir, "/home/share", NULL);
56 + homedir = g_strconcat (testdir, "/home", NULL);
57 g_mkdir_with_parents (homedir, S_IRWXU|S_IRWXG|S_IRWXO);
58 - g_setenv ("XDG_DATA_HOME", homedir, TRUE);
59 + g_setenv ("HOME", homedir, TRUE);
60 if (g_test_verbose ())
61 - g_print ("setting XDG_DATA_HOME=%s\n", homedir);
62 + g_print ("setting HOME=%s\n", datadir);
63 +
64 + cachedir = g_strconcat (testdir, "/home/cache", NULL);
65 + g_mkdir_with_parents (cachedir, S_IRWXU|S_IRWXG|S_IRWXO);
66 + g_setenv ("XDG_CACHE_HOME", cachedir, TRUE);
67 + if (g_test_verbose ())
68 + g_print ("setting XDG_CACHE_HOME=%s\n", cachedir);
69 +
70 + configdir = g_strconcat (testdir, "/home/config", NULL);
71 + g_mkdir_with_parents (configdir, S_IRWXU|S_IRWXG|S_IRWXO);
72 + g_setenv ("XDG_CONFIG_HOME", configdir, TRUE);
73 + if (g_test_verbose ())
74 + g_print ("setting XDG_CONFIG_HOME=%s\n", configdir);
75 +
76 + datadir = g_strconcat (testdir, "/home/share", NULL);
77 + g_mkdir_with_parents (datadir, S_IRWXU|S_IRWXG|S_IRWXO);
78 + g_setenv ("XDG_DATA_HOME", datadir, TRUE);
79 + if (g_test_verbose ())
80 + g_print ("setting XDG_DATA_HOME=%s\n", datadir);
81
82 flatpak_runtimedir = g_strconcat (testdir, "/runtime", NULL);
83 g_mkdir_with_parents (flatpak_runtimedir, S_IRWXU|S_IRWXG|S_IRWXO);