← Back to team overview

deja-dup-team team mailing list archive

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

 

Naël has proposed merging lp:~nathanael-naeri/deja-dup/fix-1660174-1660224-1660342 into lp:deja-dup.

Requested reviews:
  Michael Terry (mterry)
Related bugs:
  Bug #1660174 in Déjà Dup: "The test shell preserves $HOME"
  https://bugs.launchpad.net/deja-dup/+bug/1660174
  Bug #1660224 in Déjà Dup: "The test environment does not include a trash can"
  https://bugs.launchpad.net/deja-dup/+bug/1660224
  Bug #1660342 in Déjà Dup: "The test environment does not support the XDG Special User Directories"
  https://bugs.launchpad.net/deja-dup/+bug/1660342

For more details, see:
https://code.launchpad.net/~nathanael-naeri/deja-dup/fix-1660174-1660224-1660342/+merge/317041

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).
-- 
Your team Déjà Dup Developers is subscribed to branch lp:deja-dup.
=== modified file 'tests/shell'
--- tests/shell	2013-10-08 23:50:46 +0000
+++ tests/shell	2017-02-12 01:51:40 +0000
@@ -22,13 +22,16 @@
 # point at a custom dconf location and $HOME.
 
 TOPDIR=$(readlink -e "$(dirname ${0})/..")
-BUILDDIR="$TOPDIR/builddir"
+BUILDDIR="${TOPDIR}/builddir"
 
 
 # Create fake home environment
 ROOTDIR=$(mktemp -d --tmpdir dd.XXXXXXXXXX)
 export DEJA_DUP_TEST_ROOT="${ROOTDIR}"
 
+OLD_HOME="${HOME}"
+HOME="${ROOTDIR}"
+
 mkdir -p "${ROOTDIR}/cache"
 export XDG_CACHE_HOME="${ROOTDIR}/cache"
 
@@ -38,6 +41,15 @@
 mkdir -p "${ROOTDIR}/gnupg"
 export GNUPGHOME="${ROOTDIR}/gnupg"
 
+if [ -f "${OLD_HOME}/.config/user-dirs.dirs" -a -f "${OLD_HOME}/.config/user-dirs.locale" ]; then
+  cp "${OLD_HOME}/.config/user-dirs.dirs" "${XDG_CONFIG_HOME}/user-dirs.dirs"
+  cp "${OLD_HOME}/.config/user-dirs.locale" "${XDG_CONFIG_HOME}/user-dirs.locale"
+  . "${XDG_CONFIG_HOME}/user-dirs.dirs"
+  for d in DESKTOP DOCUMENTS DOWNLOAD MUSIC PICTURES PUBLICSHARE TEMPLATES VIDEOS; do
+    eval mkdir -p "\${XDG_${d}_DIR}"
+  done
+fi
+
 
 # For convenience, make some potentially useful folders
 mkdir -p "${ROOTDIR}/source"
@@ -57,6 +69,8 @@
   mkdir -p "${XDG_DATA_HOME}/deja-dup/ui"
   cp "${TOPDIR}/deja-dup/ui/"* "${XDG_DATA_HOME}/deja-dup/ui"
 
+  mkdir -p "${XDG_DATA_HOME}/Trash"
+
   export DEJA_DUP_TOOLS_PATH="${BUILDDIR}/libdeja/tools/duplicity"
   export PATH="${BUILDDIR}/deja-dup/monitor:${BUILDDIR}/deja-dup:${BUILDDIR}/deja-dup/preferences:${PATH}"
 
@@ -74,7 +88,7 @@
   ARGS="bash --norc"
 
   # Explain the details
-  echo "Your data playground is ${ROOTDIR}"
+  echo "Your data playground and home directory is ${ROOTDIR}"
   echo "Run deja-dup, deja-dup-preferences, or deja-dup-monitor to test."
   echo "Run exit to leave."
   echo "Run exit 1 to leave and keep data playground intact."


Follow ups