Merge lp:~nathanael-naeri/deja-dup/fix-1660174-1660224-1660342 into lp:deja-dup/34

Proposed by Naël
Status: Merged
Approved by: Michael Terry
Approved revision: 1571
Merged at revision: 1571
Proposed branch: lp:~nathanael-naeri/deja-dup/fix-1660174-1660224-1660342
Merge into: lp:deja-dup/34
Diff against target: 55 lines (+16/-2)
1 file modified
tests/shell (+16/-2)
To merge this branch: bzr merge lp:~nathanael-naeri/deja-dup/fix-1660174-1660224-1660342
Reviewer Review Type Date Requested Status
Michael Terry Approve
Review via email: mp+317041@code.launchpad.net

Commit message

Set HOME to the test environment /tmp/dd-<temp> (fixes LP:1660174), include a trash can in the test environment (fixes LP:1660224), and setup XDG Special User Directories in the test environment (fixes LP:1660342).

Description of the change

I propose three improvements to the test shell, to make the test environment more similar to the user's environment, and therefore facilitate testing: set HOME to the test environment /tmp/dd-<temp> (fixes LP:1660174), include a trash can in the test environment (fixes LP:1660224), and setup XDG Special User Directories in the test environment (fixes LP:1660342).

The changes are limited to the file tests/shell. Please review the bug reports and the changes in this file to make sure I didn't mess things up (I don't think so and I hope not).

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Thank you! This looks nice and looks like it works just fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/shell'
2--- tests/shell 2013-10-08 23:50:46 +0000
3+++ tests/shell 2017-02-12 01:51:40 +0000
4@@ -22,13 +22,16 @@
5 # point at a custom dconf location and $HOME.
6
7 TOPDIR=$(readlink -e "$(dirname ${0})/..")
8-BUILDDIR="$TOPDIR/builddir"
9+BUILDDIR="${TOPDIR}/builddir"
10
11
12 # Create fake home environment
13 ROOTDIR=$(mktemp -d --tmpdir dd.XXXXXXXXXX)
14 export DEJA_DUP_TEST_ROOT="${ROOTDIR}"
15
16+OLD_HOME="${HOME}"
17+HOME="${ROOTDIR}"
18+
19 mkdir -p "${ROOTDIR}/cache"
20 export XDG_CACHE_HOME="${ROOTDIR}/cache"
21
22@@ -38,6 +41,15 @@
23 mkdir -p "${ROOTDIR}/gnupg"
24 export GNUPGHOME="${ROOTDIR}/gnupg"
25
26+if [ -f "${OLD_HOME}/.config/user-dirs.dirs" -a -f "${OLD_HOME}/.config/user-dirs.locale" ]; then
27+ cp "${OLD_HOME}/.config/user-dirs.dirs" "${XDG_CONFIG_HOME}/user-dirs.dirs"
28+ cp "${OLD_HOME}/.config/user-dirs.locale" "${XDG_CONFIG_HOME}/user-dirs.locale"
29+ . "${XDG_CONFIG_HOME}/user-dirs.dirs"
30+ for d in DESKTOP DOCUMENTS DOWNLOAD MUSIC PICTURES PUBLICSHARE TEMPLATES VIDEOS; do
31+ eval mkdir -p "\${XDG_${d}_DIR}"
32+ done
33+fi
34+
35
36 # For convenience, make some potentially useful folders
37 mkdir -p "${ROOTDIR}/source"
38@@ -57,6 +69,8 @@
39 mkdir -p "${XDG_DATA_HOME}/deja-dup/ui"
40 cp "${TOPDIR}/deja-dup/ui/"* "${XDG_DATA_HOME}/deja-dup/ui"
41
42+ mkdir -p "${XDG_DATA_HOME}/Trash"
43+
44 export DEJA_DUP_TOOLS_PATH="${BUILDDIR}/libdeja/tools/duplicity"
45 export PATH="${BUILDDIR}/deja-dup/monitor:${BUILDDIR}/deja-dup:${BUILDDIR}/deja-dup/preferences:${PATH}"
46
47@@ -74,7 +88,7 @@
48 ARGS="bash --norc"
49
50 # Explain the details
51- echo "Your data playground is ${ROOTDIR}"
52+ echo "Your data playground and home directory is ${ROOTDIR}"
53 echo "Run deja-dup, deja-dup-preferences, or deja-dup-monitor to test."
54 echo "Run exit to leave."
55 echo "Run exit 1 to leave and keep data playground intact."

Subscribers

People subscribed via source and target branches