summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2016-09-30 04:23:57 +0300
committerSlávek Banko <slavek.banko@axis.cz>2017-01-29 02:27:15 +0100
commit7f6c0b1c7d39628a7c1f3cc4271f92054fe151eb (patch)
tree8c421c61d2f25e1ab9c9177b71a94bf52e4b7869
parent8e14cc0e4a7e0c607bef37828de96b487b07da16 (diff)
downloadtdelibs-7f6c0b1c7d39628a7c1f3cc4271f92054fe151eb.tar.gz
tdelibs-7f6c0b1c7d39628a7c1f3cc4271f92054fe151eb.zip
Make dcop tests run without X
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--dcop/tests/driver.cpp4
-rw-r--r--dcop/tests/run-tests.sh26
-rw-r--r--dcop/tests/test.cpp4
3 files changed, 24 insertions, 10 deletions
diff --git a/dcop/tests/driver.cpp b/dcop/tests/driver.cpp
index 73a98fc0d..a129d7d6f 100644
--- a/dcop/tests/driver.cpp
+++ b/dcop/tests/driver.cpp
@@ -53,8 +53,8 @@ int main(int argc, char** argv)
if ( argc < 2 ) { tqWarning("Usage: driver <appid>"); return 1; }
const char* appname = strdup( argv[ 1 ] );
argv[ 1 ] = 0; // sue me
- TDECmdLineArgs::init( argc, argv, "TestAppDriver", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
- TDEApplication app;
+ TDECmdLineArgs::init( argc, argv, argv[1], "TestAppDriver", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
+ TDEApplication app (/*stylesEnabled=*/ false, /*GUIEnabled=*/ false);
app.dcopClient()->attach( );
app.dcopClient()->registerAs( "TestAppDriver" );
Driver * object = new Driver( appname );
diff --git a/dcop/tests/run-tests.sh b/dcop/tests/run-tests.sh
index b088905b0..1645b0696 100644
--- a/dcop/tests/run-tests.sh
+++ b/dcop/tests/run-tests.sh
@@ -5,30 +5,44 @@ clean_up() {
clean_up
+../dcopserver --nofork &
+DCOP_SERVER_PID=$!
+
+die() {
+ kill $DCOP_SERVER_PID
+ echo "$1"
+ exit 1;
+}
+
echo '* Running batch mode'
-./dcop_test --batch >batch.stdout
+./dcop_test --batch >batch.stdout || die "Failed to run dcop_test"
echo -n '* Starting test app '
./dcop_test >shell.stdout &
+DCOP_TEST_PID=$!
-while ! dcop | grep -q TestApp; do echo -n '.'; sleep 2; done
+while ! ../client/dcop | grep -q "TestApp-$DCOP_TEST_PID"; do
+ echo -n '.'
+ sleep 2
+ kill -0 "$DCOP_TEST_PID" || die "dcop_test died unexpectadly"
+done
echo ' started'
echo '* Running driver mode'
-./driver `dcop 'TestApp-*'` >driver.stdout
+./driver "TestApp-$DCOP_TEST_PID" >driver.stdout || die "Failed to start driver"
echo '* Running shell mode'
source ./shell.generated >shell.returns
echo -n '* Comparing ... '
-compare()
+compare()
{
if ! diff -q --strip-trailing-cr $1 $2; then
echo "FAILED:"
diff -u $1 $2
- exit 1;
+ die "$1 and $2 are different";
fi
}
@@ -39,6 +53,6 @@ compare batch.returns driver.returns
clean_up
+kill $DCOP_SERVER_PID
echo "Passed"
exit 0;
-
diff --git a/dcop/tests/test.cpp b/dcop/tests/test.cpp
index 4a751c358..5665bd6de 100644
--- a/dcop/tests/test.cpp
+++ b/dcop/tests/test.cpp
@@ -31,8 +31,8 @@ int main(int argc, char** argv)
batch();
return 0;
}
- TDECmdLineArgs::init( argc, argv, "TestApp", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
- TDEApplication app;
+ TDECmdLineArgs::init( argc, argv, argv[0], "TestApp", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
+ TDEApplication app (/*stylesEnabled=*/ false, /*GUIEnabled=*/ false);
if(!app.dcopClient()->attach( ))
return 1;