aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-03-12 21:57:52 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-08-28 20:27:35 +0200
commit05cb85567d0eea78a2407ee8367f50afcd14cc65 (patch)
tree300149a426ad1d81056c297a751eb8211c91476a /tests
parentbc163bb16505f6b9aef05173d868e5f60edcc504 (diff)
downloadayatana-indicator-sound-05cb85567d0eea78a2407ee8367f50afcd14cc65.tar.gz
ayatana-indicator-sound-05cb85567d0eea78a2407ee8367f50afcd14cc65.tar.bz2
ayatana-indicator-sound-05cb85567d0eea78a2407ee8367f50afcd14cc65.zip
tests/integration/: Properly set env variables for pulseaudio and assure dependencies to be in place.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt21
-rw-r--r--tests/integration/CMakeLists.txt16
-rw-r--r--tests/integration/indicator-sound-test-base.cpp3
3 files changed, 36 insertions, 4 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0290969..f992a83 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -10,12 +10,27 @@ set_directory_properties (PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled)
set_source_files_properties (gschemas.compiled GENERATED)
+# the home path needs to be severely below 108 characters of length, as pulseaudio
+# will try to place a unix domain socket file in there... (i.e. in XDG_RUNTIME_DIR).
+# In previous versions, the test-home was in the build directory somewhere, which failed
+# when the source tree was stored in some deep sub/sub/sub/folders structure.
+set (TEST_HOME "/tmp/build-home")
+set (XDG_CONFIG_HOME "${TEST_HOME}/.config")
+set (XDG_RUNTIME_DIR "${TEST_HOME}/.run")
+
+add_custom_command (OUTPUT home.created
+ COMMAND mkdir -p ${TEST_HOME}
+ COMMAND mkdir -p ${XDG_RUNTIME_DIR}
+ COMMAND mkdir -p ${XDG_CONFIG_HOME}
+)
+add_custom_target (
+ test-home ALL DEPENDS home.created
+)
+
# GSettings:
# compile the indicator-sound schema into a gschemas.compiled file in this directory,
# and help the tests to find that file by setting -DSCHEMA_DIR
set (XDG_DATA_DIRS "${CMAKE_CURRENT_BINARY_DIR}/gsettings-schemas")
-set (TEST_HOME "${CMAKE_CURRENT_BINARY_DIR}/test-home")
-set (XDG_RUNTIME_DIR "${TEST_HOME}/.config")
set (SCHEMA_DIR "${XDG_DATA_DIRS}/glib-2.0/schemas")
if (EXISTS /usr/share/glib-2.0/schemas/com.ubuntu.sound.gschema.xml)
set (SOUND_SCHEMA /usr/share/glib-2.0/schemas/com.ubuntu.sound.gschema.xml)
@@ -33,8 +48,6 @@ add_custom_command (OUTPUT gschemas.compiled
COMMAND cp -f ${CMAKE_SOURCE_DIR}/data/org.ayatana.indicator.sound.gschema.xml ${SCHEMA_DIR}
COMMAND cp -f ${SOUND_SCHEMA} ${SCHEMA_DIR}
COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})
-add_custom_command (OUTPUT test-home
- COMMAND mkdir -p $(TEST_HOME)/.config/dconf)
add_custom_target (
gschemas-compiled ALL DEPENDS gschemas.compiled
diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt
index 2bf808c..d20fa8f 100644
--- a/tests/integration/CMakeLists.txt
+++ b/tests/integration/CMakeLists.txt
@@ -32,6 +32,7 @@ add_definitions(-DSOUND_SERVICE_BIN="${CMAKE_BINARY_DIR}/src/ayatana-indicator-s
-DTEST_SOUND="${CMAKE_SOURCE_DIR}/tests/integration/test-sound.wav"
-DQT_NO_KEYWORDS=1
-DXDG_DATA_DIRS="${XDG_DATA_DIRS}"
+ -DXDG_CONFIG_HOME="${XDG_CONFIG_HOME}"
-DXDG_RUNTIME_DIR="${XDG_RUNTIME_DIR}"
-DTEST_HOME="${TEST_HOME}"
)
@@ -62,6 +63,11 @@ add_executable(
${INTEGRATION_TESTS_SRC}
)
+add_dependencies(
+ integration-tests
+ test-home
+)
+
qt5_use_modules(
integration-tests
Core
@@ -117,11 +123,21 @@ add_executable(
${SET-VOLUME-SRC}
)
+add_dependencies(
+ set-volume
+ test-home
+)
+
add_executable(
get-volume
${GET-VOLUME-SRC}
)
+add_dependencies(
+ get-volume
+ test-home
+)
+
qt5_use_modules(
set-volume
Core
diff --git a/tests/integration/indicator-sound-test-base.cpp b/tests/integration/indicator-sound-test-base.cpp
index cdc1b2a..010f8c4 100644
--- a/tests/integration/indicator-sound-test-base.cpp
+++ b/tests/integration/indicator-sound-test-base.cpp
@@ -57,6 +57,7 @@ void IndicatorSoundTestBase::SetUp()
setenv("HOME", TEST_HOME, true);
setenv("XDG_DATA_DIRS", XDG_DATA_DIRS, true);
setenv("XDG_RUNTIME_DIR", XDG_RUNTIME_DIR, true);
+ setenv("XDG_CONFIG_HOME", XDG_CONFIG_HOME, true);
setenv("DBUS_SYSTEM_BUS_ADDRESS", dbusTestRunner.systemBus().toStdString().c_str(), true);
setenv("DBUS_SESSION_BUS_ADDRESS", dbusTestRunner.sessionBus().toStdString().c_str(), true);
dbusMock.registerNotificationDaemon();
@@ -82,6 +83,8 @@ void IndicatorSoundTestBase::SetUp()
void IndicatorSoundTestBase::TearDown()
{
unsetenv("XDG_DATA_DIRS");
+ unsetenv("XDG_RUNTIME_DIR");
+ unsetenv("XDG_CONFIG_HOME");
unsetenv("HOME");
unsetenv("PULSE_SERVER");
unsetenv("DBUS_SYSTEM_BUS_ADDRESS");