Fix the qlocalsocket test

This test is broken in a couple of ways. A few one line fixes
combined into a single patch.

1. Linux is the only OS that does
abstract unix domain sockets by prepending a null as the first
character.  Don't test this on non-Linux platforms and expect
it to pass.

2. Change QVERIFY2 to QCOMPARE so we can see why this
fails in CI but no on the local system.  Use QCOMPARE
where possible.

Change-Id: Ic3d2cf9696730dc4d6589539fdfe8a48ccf28de5
Reviewed-by: Alex <alex.blasche@nokia.com>
bb10
Andrew Stanley-Jones 2012-02-21 08:11:49 +01:00 committed by Qt by Nokia
parent 511e447b70
commit d1abf3e3e7
1 changed files with 3 additions and 1 deletions

View File

@ -1129,7 +1129,7 @@ void tst_QLocalSocket::verifyListenWithDescriptor()
} else if (abstract) {
QVERIFY2(server.fullServerName().at(0) == QLatin1Char('@'), "abstract sockets should start with a '@'");
} else {
QVERIFY2(server.fullServerName() == path, "full server path doesn't match patch provided");
QCOMPARE(server.fullServerName(), path);
if (path.contains(QLatin1String("/"))) {
QVERIFY2(server.serverName() == path.mid(path.lastIndexOf(QLatin1Char('/'))+1), "server name invalid short name");
} else {
@ -1153,8 +1153,10 @@ void tst_QLocalSocket::verifyListenWithDescriptor_data()
QTest::addColumn<bool>("bound");
QTest::newRow("normal") << QDir::tempPath() + QLatin1Literal("/testsocket") << false << true;
#ifdef Q_OS_LINUX
QTest::newRow("absrtact") << QString::fromLatin1("abstractsocketname") << true << true;
QTest::newRow("abstractwithslash") << QString::fromLatin1("abstractsocketwitha/inthename") << true << true;
#endif
QTest::newRow("no path") << QString::fromLatin1("/invalid/no path name speficied") << true << false;
#endif