Fix network tests on qemu/arm

Function if_indextoname fails on qemu because SIOCGIFNAME is not
supported. Expect failure if emulation is detected.

Change-Id: I53b41286d82458661e7fa723af385f323582ce7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Sami Nurmenniemi 2017-04-04 12:03:10 +03:00
parent 4387202f31
commit 42b3ed763f
2 changed files with 5 additions and 0 deletions

View File

@ -1,5 +1,7 @@
CONFIG += testcase
TARGET = tst_qnetworkinterface
SOURCES += tst_qnetworkinterface.cpp
INCLUDEPATH += ../../../../shared/
HEADERS += ../../../../shared/emulationdetector.h
QT = core network testlib

View File

@ -38,6 +38,7 @@
#include <QNetworkSession>
#endif
#include "../../../network-settings.h"
#include "emulationdetector.h"
class tst_QNetworkInterface : public QObject
{
@ -220,6 +221,8 @@ void tst_QNetworkInterface::interfaceFromXXX()
QVERIFY(QNetworkInterface::interfaceFromName(iface.name()).isValid());
if (int idx = iface.index()) {
QVERIFY(QNetworkInterface::interfaceFromIndex(idx).isValid());
if (EmulationDetector::isRunningArmOnX86())
QEXPECT_FAIL("", "SIOCGIFNAME fails on QEMU", Continue);
QCOMPARE(QNetworkInterface::interfaceNameFromIndex(idx), iface.name());
QCOMPARE(QNetworkInterface::interfaceIndexFromName(iface.name()), idx);
}