telepathy-mission-control: Tests: distinguish between XDG cache/config/ data home, and MC_ACCOUNT_DIR

Simon McVittie smcv at kemper.freedesktop.org
Thu Sep 20 08:15:56 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 947aaa3c91f7f286d37f803286d77070f0cc6fb2
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=947aaa3c91f7f286d37f803286d77070f0cc6fb2

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Sep  3 19:12:29 2012 +0100

Tests: distinguish between XDG cache/config/data home, and MC_ACCOUNT_DIR

We want to be sure that MC is using the right one in each situation.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35896
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>

---

 tests/twisted/Makefile.am                          |   10 +++++-----
 tests/twisted/account-manager/auto-connect.py      |    5 +++++
 tests/twisted/account-manager/avatar-persist.py    |    5 +++++
 tests/twisted/account-manager/avatar-refresh.py    |    5 +++++
 tests/twisted/account-manager/make-valid.py        |    5 +++++
 .../account-storage/default-keyring-storage.py     |    4 ++++
 tests/twisted/account-storage/diverted-storage.py  |    8 +++++++-
 tests/twisted/crash-recovery/crash-recovery.py     |    5 +++++
 tests/twisted/dispatcher/create-at-startup.py      |    5 +++++
 9 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 8cb7877..ca3b28d 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -222,13 +222,13 @@ BASIC_TESTS_ENVIRONMENT = \
 	PYTHONPATH=@abs_top_srcdir@/tests/twisted:@abs_top_builddir@/tests/twisted \
 	MC_DEBUG=all \
 	MC_FILTER_PLUGIN_DIR=@abs_top_builddir@/tests/twisted/.libs \
-	MC_ACCOUNT_DIR=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX) \
-	XDG_CONFIG_HOME=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX) \
+	MC_ACCOUNT_DIR=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX)/mc-account-dir \
+	XDG_CONFIG_HOME=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX)/config \
 	XDG_CONFIG_DIRS=@abs_top_srcdir@/tests/twisted \
-	XDG_DATA_HOME=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX) \
+	XDG_DATA_HOME=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX)/localshare \
 	XDG_DATA_DIRS=@abs_top_srcdir@/tests/twisted \
-	XDG_CACHE_DIR=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX) \
-	XDG_CACHE_HOME=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX) \
+	XDG_CACHE_DIR=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX)/cache \
+	XDG_CACHE_HOME=@abs_top_builddir@/tests/twisted/tmp-$(TMPSUFFIX)/cache \
 	MC_CLIENTS_DIR=@abs_top_srcdir@/tests/twisted/telepathy/clients \
 	MC_MANAGER_DIR=@abs_top_srcdir@/tests/twisted/telepathy/managers \
 	G_DEBUG=fatal_criticals
diff --git a/tests/twisted/account-manager/auto-connect.py b/tests/twisted/account-manager/auto-connect.py
index 38227f5..581a1b6 100644
--- a/tests/twisted/account-manager/auto-connect.py
+++ b/tests/twisted/account-manager/auto-connect.py
@@ -39,6 +39,11 @@ def preseed():
 
     accounts_dir = os.environ['MC_ACCOUNT_DIR']
 
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
     accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
 
     # As a regression test for part of fd.o #28557, the password starts and
diff --git a/tests/twisted/account-manager/avatar-persist.py b/tests/twisted/account-manager/avatar-persist.py
index 06ad65d..e907873 100644
--- a/tests/twisted/account-manager/avatar-persist.py
+++ b/tests/twisted/account-manager/avatar-persist.py
@@ -40,6 +40,11 @@ def preseed():
 
     accounts_dir = os.environ['MC_ACCOUNT_DIR']
 
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
     accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
     accounts_cfg.write("""# Telepathy accounts
 [%s]
diff --git a/tests/twisted/account-manager/avatar-refresh.py b/tests/twisted/account-manager/avatar-refresh.py
index a93912e..42dd5d3 100644
--- a/tests/twisted/account-manager/avatar-refresh.py
+++ b/tests/twisted/account-manager/avatar-refresh.py
@@ -40,6 +40,11 @@ def preseed():
 
     accounts_dir = os.environ['MC_ACCOUNT_DIR']
 
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
     accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
     accounts_cfg.write("""# Telepathy accounts
 [%s]
diff --git a/tests/twisted/account-manager/make-valid.py b/tests/twisted/account-manager/make-valid.py
index ee3ee98..457229d 100644
--- a/tests/twisted/account-manager/make-valid.py
+++ b/tests/twisted/account-manager/make-valid.py
@@ -40,6 +40,11 @@ def preseed():
 
     accounts_dir = os.environ['MC_ACCOUNT_DIR']
 
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
     # The passwords are missing, so the accounts can't connect yet.
     accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
     accounts_cfg.write("""# Telepathy accounts
diff --git a/tests/twisted/account-storage/default-keyring-storage.py b/tests/twisted/account-storage/default-keyring-storage.py
index bab0b72..c123078 100644
--- a/tests/twisted/account-storage/default-keyring-storage.py
+++ b/tests/twisted/account-storage/default-keyring-storage.py
@@ -266,6 +266,10 @@ DisplayName=New and improved account
 
 if __name__ == '__main__':
     ctl_dir = os.environ['MC_ACCOUNT_DIR']
+    try:
+        os.mkdir(ctl_dir, 0700)
+    except OSError:
+        pass
     start_gnome_keyring_daemon(ctl_dir)
     exec_test(test, {}, timeout=10)
     stop_gnome_keyring_daemon()
diff --git a/tests/twisted/account-storage/diverted-storage.py b/tests/twisted/account-storage/diverted-storage.py
index d645656..608ad4e 100644
--- a/tests/twisted/account-storage/diverted-storage.py
+++ b/tests/twisted/account-storage/diverted-storage.py
@@ -33,7 +33,13 @@ from mctest import (
 import constants as cs
 
 def test(q, bus, mc):
-    empty_key_file_name = os.path.join(os.environ['MC_ACCOUNT_DIR'], 'accounts.cfg')
+    accounts_dir = os.environ['MC_ACCOUNT_DIR']
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
+    empty_key_file_name = os.path.join(accounts_dir, 'accounts.cfg')
 
     group = 'fakecm/fakeprotocol/someguy_40example_2ecom0'
 
diff --git a/tests/twisted/crash-recovery/crash-recovery.py b/tests/twisted/crash-recovery/crash-recovery.py
index e189b85..0446550 100644
--- a/tests/twisted/crash-recovery/crash-recovery.py
+++ b/tests/twisted/crash-recovery/crash-recovery.py
@@ -34,6 +34,11 @@ import constants as cs
 def preseed():
     accounts_dir = os.environ['MC_ACCOUNT_DIR']
 
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
     accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
 
     accounts_cfg.write("""# Telepathy accounts
diff --git a/tests/twisted/dispatcher/create-at-startup.py b/tests/twisted/dispatcher/create-at-startup.py
index c4e2476..992145f 100644
--- a/tests/twisted/dispatcher/create-at-startup.py
+++ b/tests/twisted/dispatcher/create-at-startup.py
@@ -35,6 +35,11 @@ import constants as cs
 def preseed():
     accounts_dir = os.environ['MC_ACCOUNT_DIR']
 
+    try:
+        os.mkdir(accounts_dir, 0700)
+    except OSError:
+        pass
+
     accounts_cfg = open(accounts_dir + '/accounts.cfg', 'w')
     accounts_cfg.write("""# Telepathy accounts
 [fakecm/fakeprotocol/jc_2edenton_40unatco_2eint]



More information about the telepathy-commits mailing list