From bf87e1cfbd6c29a28e4ead8c9b41c578a1a5fba8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 17 Feb 2018 13:57:15 -0800 Subject: tst_QMimeDatabase: detect executables as shared libraries too They can be, if compiled with -Wl,-pie. Example: $ file /usr/bin/ping /usr/bin/ping: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0 And you can't detect via the interpreter, since libraries can have them too: $ file /lib64/libc-2.26.so libQt5Core.so.5.11.0 /lib64/libc-2.26.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2 libQt5Core.so.5.11.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.17.0 Change-Id: I940917d6763842499b18fffd15143bb80ce0e531 Reviewed-by: David Faure --- tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib/mimetypes') diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index e3504de732..995fbc13c0 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -222,8 +222,10 @@ void tst_QMimeDatabase::mimeTypeForName() qWarning() << "ls not found"; else { const QString executableType = QString::fromLatin1("application/x-executable"); + const QString sharedLibType = QString::fromLatin1("application/x-sharedlib"); //QTest::newRow("executable") << exePath << executableType; - QCOMPARE(db.mimeTypeForFile(exePath).name(), executableType); + QVERIFY(db.mimeTypeForFile(exePath).name() == executableType || + db.mimeTypeForFile(exePath).name() == sharedLibType); } #endif -- cgit v1.2.3