Commit 464ba183 authored by Martin Flöser's avatar Martin Flöser
Browse files

[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.
parent ac1a3b8b
......@@ -133,7 +133,13 @@ void TestWaylandServerDisplay::testClientConnection()
ClientConnection *connection = display.getConnection(client);
QVERIFY(connection);
QCOMPARE(connection->client(), client);
if (getuid() == 0) {
QEXPECT_FAIL("", "Please don't run test as root", Continue);
}
QVERIFY(connection->userId() != 0);
if (getgid() == 0) {
QEXPECT_FAIL("", "Please don't run test as root", Continue);
}
QVERIFY(connection->groupId() != 0);
QVERIFY(connection->processId() != 0);
QCOMPARE(connection->display(), &display);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment