From 6dfa1c4a1c01da984264ba2a2b71f3896afbf5ff Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 24 Mar 2014 17:45:08 +0000 Subject: [PATCH] All C/C++ tests: run with temporary XDG_*_HOME, XDG_RUNTIME_DIR These aren't currently used, so we don't actually create them... except for tests/logger/dbus/tmp-cache/telepathy/logger/sqlite-data, which is in fact created by running the tests. --- .gitignore | 4 ++++ tests/Makefile.am | 7 +++++++ tests/dbus/Makefile.am | 6 ++++++ tests/logger/Makefile.am | 6 ++++++ tests/logger/dbus/Makefile.am | 6 ++++++ 5 files changed, 29 insertions(+) diff --git a/.gitignore b/.gitignore index efb9722..88ebcf7 100644 --- a/.gitignore +++ b/.gitignore @@ -147,6 +147,10 @@ telepathy-glib/version.h /test-driver /tests/all-errors-documented.py.log /tests/all-errors-documented.py.trs +/tests/**/tmp-cache +/tests/**/tmp-config +/tests/**/tmp-data +/tests/**/tmp-runtime tests/dbus/dbus-installed/session.conf tests/dbus/dbus-uninstalled/session.conf tests/dbus/run-test.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index a0d750c..22bb8a2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -69,6 +69,10 @@ AM_TESTS_ENVIRONMENT = \ G_DEBUG=fatal_warnings,fatal_criticals$(maybe_gc_friendly) \ G_MESSAGES_DEBUG=all \ PYTHONPATH=@abs_top_srcdir@/tools \ + XDG_CACHE_HOME=@abs_builddir@/tmp-cache \ + XDG_CONFIG_HOME=@abs_builddir@/tmp-config \ + XDG_DATA_HOME=@abs_builddir@/tmp-data \ + XDG_RUNTIME_DIR=@abs_builddir@/tmp-runtime \ $(NULL) LOG_COMPILER = @@ -213,3 +217,6 @@ AM_CXXFLAGS = $(ERROR_CXXFLAGS) if HAVE_CXX test_util_cxx_SOURCES = util-cxx.cpp endif + +clean-local: + rm -fr tmp-cache tmp-config tmp-data tmp-runtime diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am index d061505..027defa 100644 --- a/tests/dbus/Makefile.am +++ b/tests/dbus/Makefile.am @@ -301,8 +301,11 @@ AM_CFLAGS = $(ERROR_CFLAGS) AM_TESTS_ENVIRONMENT = \ abs_top_builddir=@abs_top_builddir@ \ + XDG_CACHE_HOME=@abs_builddir@/tmp-cache \ + XDG_CONFIG_HOME=@abs_builddir@/tmp-config \ XDG_DATA_HOME=@abs_builddir@ \ XDG_DATA_DIRS=@abs_srcdir@:$${XDG_DATA_DIRS:=/usr/local/share:/usr/share} \ + XDG_RUNTIME_DIR=@abs_builddir@/tmp-runtime \ G_SLICE=debug-blocks \ G_DEBUG=fatal_warnings,fatal_criticals$(maybe_gc_friendly) \ G_MESSAGES_DEBUG=all \ @@ -378,3 +381,6 @@ _gen/errors-check.h: $(top_srcdir)/spec/errors.xml \ $(top_srcdir)/tools/glib-errors-check-gen.py $(AM_V_at)$(MKDIR_P) _gen $(AM_V_GEN)$(PYTHON) $(top_srcdir)/tools/glib-errors-check-gen.py $< > $@ + +clean-local: + rm -fr tmp-cache tmp-config tmp-runtime diff --git a/tests/logger/Makefile.am b/tests/logger/Makefile.am index ef61231..938187d 100644 --- a/tests/logger/Makefile.am +++ b/tests/logger/Makefile.am @@ -29,7 +29,10 @@ AM_CFLAGS = \ AM_TESTS_ENVIRONMENT = \ G_DEBUG=fatal-warnings,fatal-criticals \ TPL_TEST_MODE=true \ + XDG_CACHE_HOME=@abs_builddir@/tmp-cache \ + XDG_CONFIG_HOME=@abs_builddir@/tmp-config \ XDG_DATA_HOME=@abs_top_srcdir@/tests/logger/logs \ + XDG_RUNTIME_DIR=@abs_builddir@/tmp-runtime \ $(NULL) check-valgrind: $(TESTS) @@ -52,3 +55,6 @@ check_c_sources = \ include $(top_srcdir)/tools/check-coding-style.mk check-local: check-coding-style + +clean-local: + rm -fr tmp-cache tmp-config tmp-runtime diff --git a/tests/logger/dbus/Makefile.am b/tests/logger/dbus/Makefile.am index 35ddb53..c322cea 100644 --- a/tests/logger/dbus/Makefile.am +++ b/tests/logger/dbus/Makefile.am @@ -45,8 +45,11 @@ AM_TESTS_ENVIRONMENT = \ TPL_TEST_LOG_DIR=@abs_top_srcdir@/tests/logger/logs \ HOME=@abs_top_srcdir@/tests/logger/logs \ GSETTINGS_SCHEMA_DIR=@abs_srcdir@/data \ + XDG_CACHE_HOME=@abs_builddir@/tmp-cache \ + XDG_CONFIG_HOME=@abs_builddir@/tmp-config \ XDG_DATA_HOME=@abs_top_srcdir@/tests/logger/logs \ XDG_DATA_DIRS=@abs_srcdir@ \ + XDG_RUNTIME_DIR=@abs_builddir@/tmp-runtime \ G_SLICE=debug-blocks \ TPL_DEBUG=all \ G_DEBUG=fatal_warnings,fatal_criticals$(maybe_gc_friendly) \ @@ -73,3 +76,6 @@ CLEANFILES = $(BUILT_SOURCES) distclean-local: rm -f capture-*.log rm -rf _gen + +clean-local: + rm -fr tmp-cache tmp-config tmp-data tmp-runtime -- 1.9.1