[autotests/server] Check whether test is run as root
If the test is run as root we cannot compare the user id to not be 0. Thus let's check for that and expect fail.
This commit is contained in:
parent
ac1a3b8b90
commit
464ba18321
1 changed files with 6 additions and 0 deletions
|
@ -133,7 +133,13 @@ void TestWaylandServerDisplay::testClientConnection()
|
||||||
ClientConnection *connection = display.getConnection(client);
|
ClientConnection *connection = display.getConnection(client);
|
||||||
QVERIFY(connection);
|
QVERIFY(connection);
|
||||||
QCOMPARE(connection->client(), client);
|
QCOMPARE(connection->client(), client);
|
||||||
|
if (getuid() == 0) {
|
||||||
|
QEXPECT_FAIL("", "Please don't run test as root", Continue);
|
||||||
|
}
|
||||||
QVERIFY(connection->userId() != 0);
|
QVERIFY(connection->userId() != 0);
|
||||||
|
if (getgid() == 0) {
|
||||||
|
QEXPECT_FAIL("", "Please don't run test as root", Continue);
|
||||||
|
}
|
||||||
QVERIFY(connection->groupId() != 0);
|
QVERIFY(connection->groupId() != 0);
|
||||||
QVERIFY(connection->processId() != 0);
|
QVERIFY(connection->processId() != 0);
|
||||||
QCOMPARE(connection->display(), &display);
|
QCOMPARE(connection->display(), &display);
|
||||||
|
|
Loading…
Reference in a new issue