From fc41f401f631799760fa225d16c82f626634e55d Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Fri, 8 Jul 2016 13:16:31 +0200
Subject: [PATCH] Remove hardcoding of the session environment

Our test should be using the session environment as setup by the system
(in lava specifically by run-in-systemd). So remove the hardcoding of
DISPLAY (deprecated on wayland targets anyway), XDG_RUNTIME_DIR (setup
by the environment in all cases) and DBUS_SESSION_BUS_ADDRESS (should be
inferred by XDG_RUNTIME_DIR by all supported dbus libraries)

Reviewed-by: Luis Araujo <luis.araujo@collabora.co.uk>
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D3664
---
 apparmor/bluez/R1.13a.1_bluez-core.sh                   | 2 --
 apparmor/bluez/R1.13a.1_bluez-spp.sh                    | 2 --
 apparmor/folks/R6.4.2_folks-metacontacts-antilinking.sh | 2 --
 clutter-i18n/manual/run-test.sh                         | 2 +-
 folks/create-abstract-sync-database.sh                  | 4 ----
 folks/folks-alias-persistence.sh                        | 4 ----
 folks/folks-eds-compatibility.sh                        | 4 ----
 folks/folks-extended-info.sh                            | 3 ---
 folks/folks-metacontacts-antilinking.sh                 | 4 ----
 folks/folks-metacontacts-linking.sh                     | 4 ----
 folks/folks-metacontacts-unlinking.sh                   | 4 ----
 folks/folks-ofonotest.sh                                | 4 ----
 folks/folks-retrieve-contacts-telepathy.sh              | 4 ----
 folks/folks-search-contacts.sh                          | 4 ----
 folks/folks-sync-only.sh                                | 4 ----
 sdk/telepathy-ring-automated.sh                         | 7 -------
 x-out-of-screen-events/buttond_tester.sh                | 4 ----
 17 files changed, 1 insertion(+), 61 deletions(-)

diff --git a/apparmor/bluez/R1.13a.1_bluez-core.sh b/apparmor/bluez/R1.13a.1_bluez-core.sh
index 4692951..0f4a9e9 100755
--- a/apparmor/bluez/R1.13a.1_bluez-core.sh
+++ b/apparmor/bluez/R1.13a.1_bluez-core.sh
@@ -7,6 +7,4 @@ else
     exit 1
 fi
 
-test -z "$DISPLAY" && DISPLAY=:0
-
 sudo "/usr/lib/chaiwala-tests/bluez/bluez-test"
diff --git a/apparmor/bluez/R1.13a.1_bluez-spp.sh b/apparmor/bluez/R1.13a.1_bluez-spp.sh
index 2a5a87b..4f6aea5 100755
--- a/apparmor/bluez/R1.13a.1_bluez-spp.sh
+++ b/apparmor/bluez/R1.13a.1_bluez-spp.sh
@@ -7,6 +7,4 @@ else
     exit 1
 fi
 
-test -z "$DISPLAY" && DISPLAY=:0
-
 /usr/lib/chaiwala-tests/bluez/spp-test.sh
diff --git a/apparmor/folks/R6.4.2_folks-metacontacts-antilinking.sh b/apparmor/folks/R6.4.2_folks-metacontacts-antilinking.sh
index 2502389..3a53438 100755
--- a/apparmor/folks/R6.4.2_folks-metacontacts-antilinking.sh
+++ b/apparmor/folks/R6.4.2_folks-metacontacts-antilinking.sh
@@ -12,6 +12,4 @@ else
     exit 1
 fi
 
-test -z "$DISPLAY" && DISPLAY=:0
-
 ${TEST_DIR}/../../folks/folks-metacontacts-antilinking.sh
diff --git a/clutter-i18n/manual/run-test.sh b/clutter-i18n/manual/run-test.sh
index f28b53d..5971c34 100755
--- a/clutter-i18n/manual/run-test.sh
+++ b/clutter-i18n/manual/run-test.sh
@@ -1 +1 @@
-DISPLAY=:0 LANG=de_DE.utf8 /usr/lib/chaiwala-tests/clutter-i18n/manual/test-clutter-i18n
+LANG=de_DE.utf8 /usr/lib/chaiwala-tests/clutter-i18n/manual/test-clutter-i18n
diff --git a/folks/create-abstract-sync-database.sh b/folks/create-abstract-sync-database.sh
index 7334aad..f4267ff 100755
--- a/folks/create-abstract-sync-database.sh
+++ b/folks/create-abstract-sync-database.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 database=`uuidgen`
 
 # Create abstract database
diff --git a/folks/folks-alias-persistence.sh b/folks/folks-alias-persistence.sh
index 236341f..ce2ead2 100755
--- a/folks/folks-alias-persistence.sh
+++ b/folks/folks-alias-persistence.sh
@@ -5,10 +5,6 @@ echo "# running test: $0"
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 mkdir -p ~/.local/share/folks
diff --git a/folks/folks-eds-compatibility.sh b/folks/folks-eds-compatibility.sh
index cff2821..9b5ee65 100755
--- a/folks/folks-eds-compatibility.sh
+++ b/folks/folks-eds-compatibility.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 # Remove all contacts from eds.
diff --git a/folks/folks-extended-info.sh b/folks/folks-extended-info.sh
index 846ada1..7026478 100755
--- a/folks/folks-extended-info.sh
+++ b/folks/folks-extended-info.sh
@@ -7,10 +7,7 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 
 set -x
 
-export DISPLAY=:0
 export FOLKS_DEBUG_NO_COLOUR=1
 export G_MESSAGES_DEBUG=all
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
 
 exec /usr/lib/chaiwala-tests/contacts/folks-extended-info
diff --git a/folks/folks-metacontacts-antilinking.sh b/folks/folks-metacontacts-antilinking.sh
index 1c649a4..164a33b 100755
--- a/folks/folks-metacontacts-antilinking.sh
+++ b/folks/folks-metacontacts-antilinking.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 # Clean up to make sure we have a good test.
diff --git a/folks/folks-metacontacts-linking.sh b/folks/folks-metacontacts-linking.sh
index 17df5bf..6b0ee8c 100755
--- a/folks/folks-metacontacts-linking.sh
+++ b/folks/folks-metacontacts-linking.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 # Clean up to make sure we have a good test.
diff --git a/folks/folks-metacontacts-unlinking.sh b/folks/folks-metacontacts-unlinking.sh
index 2861ae4..53639f7 100755
--- a/folks/folks-metacontacts-unlinking.sh
+++ b/folks/folks-metacontacts-unlinking.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 # Clean up to make sure we have a good test.
diff --git a/folks/folks-ofonotest.sh b/folks/folks-ofonotest.sh
index e54bc72..c6c572a 100755
--- a/folks/folks-ofonotest.sh
+++ b/folks/folks-ofonotest.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 mkdir -p ~/.local/share/folks
diff --git a/folks/folks-retrieve-contacts-telepathy.sh b/folks/folks-retrieve-contacts-telepathy.sh
index cfd8738..0c17ae4 100755
--- a/folks/folks-retrieve-contacts-telepathy.sh
+++ b/folks/folks-retrieve-contacts-telepathy.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 mkdir -p ~/.local/share/folks
diff --git a/folks/folks-search-contacts.sh b/folks/folks-search-contacts.sh
index 1e24884..de367c7 100755
--- a/folks/folks-search-contacts.sh
+++ b/folks/folks-search-contacts.sh
@@ -8,10 +8,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 # Debuggability
 set -x
 
-export XDG_RUNTIME_DIR=/run/user/$(id -u)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-export DISPLAY=:0
-
 cur_dir=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 
 mkdir -p ~/.local/share/folks
diff --git a/folks/folks-sync-only.sh b/folks/folks-sync-only.sh
index 99296fd..1420861 100755
--- a/folks/folks-sync-only.sh
+++ b/folks/folks-sync-only.sh
@@ -9,10 +9,6 @@ env | LC_ALL=C sort | sed -e 's/^/#  /'
 set -x
 set -e
 
-export DISPLAY=:0
-export XDG_RUNTIME_DIR=/run/user/$(id -u user)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-
 BACKUP_FILES=""
 PROCESSES_TO_KILL=""
 
diff --git a/sdk/telepathy-ring-automated.sh b/sdk/telepathy-ring-automated.sh
index ed90d76..4099a1d 100755
--- a/sdk/telepathy-ring-automated.sh
+++ b/sdk/telepathy-ring-automated.sh
@@ -7,13 +7,6 @@ echo "# $0: running in: $(pwd)"
 echo "# $0: initial environment:"
 env | LC_ALL=C sort | sed -e 's/^/#  /'
 
-export DISPLAY=:0
-export XDG_RUNTIME_DIR=/run/user/$(id -u user)
-
-echo "# $0: additional environment:"
-echo "#  DISPLAY=$DISPLAY"
-echo "#  XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
-
 set -x
 
 BACKUP_FILES=""
diff --git a/x-out-of-screen-events/buttond_tester.sh b/x-out-of-screen-events/buttond_tester.sh
index f1acdc8..eb51915 100755
--- a/x-out-of-screen-events/buttond_tester.sh
+++ b/x-out-of-screen-events/buttond_tester.sh
@@ -18,10 +18,6 @@ set -x
 set -e
 set -o pipefail
 
-export DISPLAY=:0
-export XDG_RUNTIME_DIR=/run/user/$(id -u user)
-export DBUS_SESSION_BUS_ADDRESS=unix:path="$XDG_RUNTIME_DIR/bus"
-
 /usr/lib/chaiwala-tests/x-out-of-screen-events/input_generator 2>&1 | sed -e 's/^/# input_generator:  /' &
 sleep 2
 buttond /usr/share/chaiwala-tests/x-out-of-screen-events/buttond_tester.conf 2>&1 | sed -e 's/^/# buttond:  /' &
-- 
GitLab