PortGatherer: Add test for Mac's netstat output.

Change-Id: I6df357502e5621e858a848c567fe1590762d5fc1
Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2017-08-30 13:54:59 +02:00
parent 2ebd51fca3
commit e404ba9de1

View File

@@ -233,6 +233,16 @@ void tst_StringUtils::testParseUsedPortFromNetstatOutput_data()
// Linux // Linux
QTest::newRow("Linux1") << "sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt ..." << -1; QTest::newRow("Linux1") << "sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt ..." << -1;
QTest::newRow("Linux2") << "0: 00000000:2805 00000000:0000 0A 00000000:00000000 00:00000000 00000000 ..." << 10245; QTest::newRow("Linux2") << "0: 00000000:2805 00000000:0000 0A 00000000:00000000 00:00000000 00000000 ..." << 10245;
// Mac
QTest::newRow("Mac1") << "Active Internet connections (including servers)" << -1;
QTest::newRow("Mac2") << "Proto Recv-Q Send-Q Local Address Foreign Address (state)" << -1;
QTest::newRow("Mac3") << "tcp4 0 0 192.168.1.12.55687 88.198.14.66.443 ESTABLISHED" << 55687;
QTest::newRow("Mac4") << "tcp6 0 0 2a01:e34:ee42:d0.55684 2a02:26f0:ff::5c.443 ESTABLISHED" << 55684;
QTest::newRow("Mac5") << "tcp4 0 0 *.631 *.* LISTEN" << 631;
QTest::newRow("Mac6") << "tcp6 0 0 *.631 *.* LISTEN" << 631;
QTest::newRow("Mac7") << "udp4 0 0 192.168.79.1.123 *.*" << 123;
QTest::newRow("Mac9") << "udp4 0 0 192.168.8.1.123 *.*" << 123;
} }
QTEST_MAIN(tst_StringUtils) QTEST_MAIN(tst_StringUtils)