[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [nepomuk-core] autotests/lib/tools: Tests: robustify the sandbox
From: Simeon Bird <bladud () gmail ! com>
Date: 2013-09-01 3:13:00
Message-ID: E1VFy60-0007A6-Ue () scm ! kde ! org
[Download RAW message or body]
Git commit 72709fddb61fcbcb404c25c29a01d46be3010810 by Simeon Bird.
Committed on 02/08/2013 at 17:46.
Pushed by sbird into branch 'master'.
Tests: robustify the sandbox
Running the nepomuk tests always timed out for me. I found that this was
because the nepomukserver was failing to start. There are two problems
here:
1) if the sandbox fails to start, it should just fail, not
timeout.
2) nepomukserver should not fail to start.
This patch fixes 1) by adding return value checking to the sandbox
script; if kdeinit4 & friends fail to start the test fails instantly
2) turned out to be because the nepomukserver could not
connect to the (local) X server. To fix this, I changed the script to be
started through xvfb-run, which starts a virtual X server for it to
connect to.
Finally, start the nepomukserver we just built, rather than the
installed one.
REVIEW: 112134
M +5 -0 autotests/lib/tools/CMakeLists.txt
M +24 -3 autotests/lib/tools/nepomuk-sandbox-begin.sh.in
M +1 -1 autotests/lib/tools/nepomuk-sandbox-end.sh.in
C +6 -2 autotests/lib/tools/reallyRunNepomukTest.sh.in [from: \
autotests/lib/tools/runNepomukTest.sh.in - 069% similarity] M +9 -5 \
autotests/lib/tools/runNepomukTest.sh.in
http://commits.kde.org/nepomuk-core/72709fddb61fcbcb404c25c29a01d46be3010810
diff --git a/autotests/lib/tools/CMakeLists.txt b/autotests/lib/tools/CMakeLists.txt
index 2e24962..add7144 100644
--- a/autotests/lib/tools/CMakeLists.txt
+++ b/autotests/lib/tools/CMakeLists.txt
@@ -29,3 +29,8 @@ configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/runNepomukTest.sh.in"
IMMEDIATE @ONLY
)
+configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/reallyRunNepomukTest.sh.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/reallyRunNepomukTest.sh"
+ IMMEDIATE @ONLY
+)
+
diff --git a/autotests/lib/tools/nepomuk-sandbox-begin.sh.in \
b/autotests/lib/tools/nepomuk-sandbox-begin.sh.in index 1517dc9..cce30a5 100644
--- a/autotests/lib/tools/nepomuk-sandbox-begin.sh.in
+++ b/autotests/lib/tools/nepomuk-sandbox-begin.sh.in
@@ -29,14 +29,35 @@ mkdir -p $KDEHOME/share/config
cp @NEPOMUK_TESTLIB_DATA_DIR@/nepomukserverrc $KDEHOME/share/config/
# start kde basics
+SANDBOX_FAILED=false
echo "Starting new KDE session in $KDEHOME..."
kbuildsycoca4 2> /dev/null
+if [ $? != 0 ]; then
+ echo "failed to run kbuildsycoca4"
+ SANDBOX_FAILED=true
+fi
+
kdeinit4 2> /dev/null
+if [ $? != 0 ]; then
+ echo "failed to start kdeinit4"
+ SANDBOX_FAILED=true
+fi
+
qdbus org.kde.kded /kded org.kde.kded.loadSecondPhase 2> /dev/null
echo "Started..."
# Start the nepomuk server (which will automatically start other nepomuk services
echo "Starting nepomukserver"
-nepomukserver 2> $KDETMP/nepomuk-server.log &
-
-export NEPOMUK_TESTLIB_RUNNING=true
+@CMAKE_BINARY_DIR@/server/nepomukserver 2> $KDETMP/nepomuk-server.log &
+
+ret=$(ps | grep nepomukserver | wc -l)
+if [ $ret != 1 ]; then
+ echo "failed to start nepomukserver"
+ SANDBOX_FAILED=true
+fi
+
+if ( $SANDBOX_FAILED ); then
+ export NEPOMUK_TESTLIB_RUNNING=false
+else
+ export NEPOMUK_TESTLIB_RUNNING=true
+fi
diff --git a/autotests/lib/tools/nepomuk-sandbox-end.sh.in \
b/autotests/lib/tools/nepomuk-sandbox-end.sh.in index e331cb0..2b762b0 100644
--- a/autotests/lib/tools/nepomuk-sandbox-end.sh.in
+++ b/autotests/lib/tools/nepomuk-sandbox-end.sh.in
@@ -18,4 +18,4 @@ echo "Cleaning up temporary KDEHOME $KDEHOME"
rm -rf $KDEHOME
# DBus
-source @NEPOMUK_TESTLIB_TOOLS_DIR@/dbus-session-end.sh
\ No newline at end of file
+source @NEPOMUK_TESTLIB_TOOLS_DIR@/dbus-session-end.sh
diff --git a/autotests/lib/tools/runNepomukTest.sh.in b/autotests/lib/tools/reallyRunNepomukTest.sh.in
similarity index 69%
copy from autotests/lib/tools/runNepomukTest.sh.in
copy to autotests/lib/tools/reallyRunNepomukTest.sh.in
index 2eac365..1cf0b14 100644
--- a/autotests/lib/tools/runNepomukTest.sh.in
+++ b/autotests/lib/tools/reallyRunNepomukTest.sh.in
@@ -3,8 +3,12 @@
# Start the test environment
source @NEPOMUK_TESTLIB_TOOLS_DIR@/nepomuk-sandbox-begin.sh
-eval '$@'
-ret=$?
+if ( $NEPOMUK_TESTLIB_RUNNING ); then
+ eval '$@'
+ ret=$?
+else
+ ret=1
+fi
# Destroy it
source @NEPOMUK_TESTLIB_TOOLS_DIR@/nepomuk-sandbox-end.sh
diff --git a/autotests/lib/tools/runNepomukTest.sh.in b/autotests/lib/tools/runNepomukTest.sh.in
index 2eac365..dfeb947 100644
--- a/autotests/lib/tools/runNepomukTest.sh.in
+++ b/autotests/lib/tools/runNepomukTest.sh.in
@@ -1,11 +1,15 @@
#!/bin/bash
-# Start the test environment
-source @NEPOMUK_TESTLIB_TOOLS_DIR@/nepomuk-sandbox-begin.sh
+XVFB="bash"
+# Start the test environment: use xvfb-run if available
+if [[ -e `which xvfb-run` ]]; then
+ XVFB="xvfb-run bash"
+fi
+$XVFB @NEPOMUK_TESTLIB_TOOLS_DIR@/reallyRunNepomukTest.sh $@
-eval '$@'
ret=$?
-# Destroy it
-source @NEPOMUK_TESTLIB_TOOLS_DIR@/nepomuk-sandbox-end.sh
+#Sleep for a bit to give the fake X server time to shutdown
+sleep 4
+
exit $ret
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic