Make dcop tests run without X

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
(cherry picked from commit 7f6c0b1c7d)
v3.5.13-sru
Alexander Golubev 8 years ago committed by Slávek Banko
parent 311e027bb8
commit 6cab453afd

@ -53,8 +53,8 @@ int main(int argc, char** argv)
if ( argc < 2 ) { qWarning("Usage: driver <appid>"); return 1; } if ( argc < 2 ) { qWarning("Usage: driver <appid>"); return 1; }
const char* appname = strdup( argv[ 1 ] ); const char* appname = strdup( argv[ 1 ] );
argv[ 1 ] = 0; // sue me argv[ 1 ] = 0; // sue me
KCmdLineArgs::init( argc, argv, "TestAppDriver", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME KCmdLineArgs::init( argc, argv, argv[1], "TestAppDriver", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
KApplication app; KApplication app (/*stylesEnabled=*/ false, /*GUIEnabled=*/ false);
app.dcopClient()->attach( ); app.dcopClient()->attach( );
app.dcopClient()->registerAs( "TestAppDriver" ); app.dcopClient()->registerAs( "TestAppDriver" );
Driver * object = new Driver( appname ); Driver * object = new Driver( appname );

@ -5,18 +5,32 @@ clean_up() {
clean_up clean_up
../dcopserver --nofork &
DCOP_SERVER_PID=$!
die() {
kill $DCOP_SERVER_PID
echo "$1"
exit 1;
}
echo '* Running batch mode' 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 ' echo -n '* Starting test app '
./dcop_test >shell.stdout & ./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 ' started'
echo '* Running driver mode' 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' echo '* Running shell mode'
source ./shell.generated >shell.returns source ./shell.generated >shell.returns
@ -28,7 +42,7 @@ compare()
if ! diff -q --strip-trailing-cr $1 $2; then if ! diff -q --strip-trailing-cr $1 $2; then
echo "FAILED:" echo "FAILED:"
diff -u $1 $2 diff -u $1 $2
exit 1; die "$1 and $2 are different";
fi fi
} }
@ -39,6 +53,6 @@ compare batch.returns driver.returns
clean_up clean_up
kill $DCOP_SERVER_PID
echo "Passed" echo "Passed"
exit 0; exit 0;

@ -31,8 +31,8 @@ int main(int argc, char** argv)
batch(); batch();
return 0; return 0;
} }
KCmdLineArgs::init( argc, argv, "TestApp", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME KCmdLineArgs::init( argc, argv, argv[0], "TestApp", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
KApplication app; KApplication app (/*stylesEnabled=*/ false, /*GUIEnabled=*/ false);
if(!app.dcopClient()->attach( )) if(!app.dcopClient()->attach( ))
return 1; return 1;

Loading…
Cancel
Save