wasm: Add the qdir test
There is a problem in that all the tests share the same resource system, to not interfere with other tests, the resource files are placed in its own subdirectory. Also, wrt long filenames, it seems wasm truncates them but does not fail. This is visible in the long filename test. There are two bugs created due to test failures: QTBUG-127767 QTBUG-127766 Change-Id: Ie3c08b4a105f1122284d1f99677597cc37dc91a7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
e358f3158c
commit
3339535006
@ -72,6 +72,7 @@ if(QT_BUILD_WASM_BATCHED_TESTS)
|
||||
add_subdirectory(corelib/io/qstandardpaths)
|
||||
add_subdirectory(corelib/io/qfileselector)
|
||||
add_subdirectory(corelib/io/qfile)
|
||||
add_subdirectory(corelib/io/qdir)
|
||||
add_subdirectory(corelib/serialization)
|
||||
add_subdirectory(corelib/text)
|
||||
add_subdirectory(corelib/thread)
|
||||
|
@ -12,86 +12,105 @@ if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
|
||||
endif()
|
||||
|
||||
# Collect test data
|
||||
list(APPEND test_data "testdir")
|
||||
list(APPEND test_data "testData")
|
||||
list(APPEND test_data "searchdir")
|
||||
list(APPEND test_data "resources")
|
||||
list(APPEND test_data "entrylist")
|
||||
list(APPEND test_data "types")
|
||||
list(APPEND test_data "tst_qdir.cpp")
|
||||
list(APPEND test_data_dirs "testdir")
|
||||
list(APPEND test_data_dirs "testData")
|
||||
list(APPEND test_data_dirs "searchdir")
|
||||
list(APPEND test_data_dirs "resources")
|
||||
list(APPEND test_data_dirs "entrylist")
|
||||
list(APPEND test_data_dirs "types")
|
||||
list(APPEND test_data_dirs "tst_qdir.cpp")
|
||||
|
||||
qt_internal_add_test(tst_qdir
|
||||
SOURCES
|
||||
tst_qdir.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::TestPrivate
|
||||
TESTDATA ${test_data}
|
||||
|
||||
set(test_data_files)
|
||||
|
||||
foreach(dir ${test_data_dirs})
|
||||
set(out)
|
||||
file(GLOB_RECURSE out true RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${dir}/*)
|
||||
if (NOT out)
|
||||
set(out ${dir})
|
||||
endif()
|
||||
set(test_data_files ${test_data_files} ${out})
|
||||
endforeach()
|
||||
|
||||
set(android_testdata_resource_files
|
||||
"entrylist/directory/dummy"
|
||||
"entrylist/file"
|
||||
"resources/entryList/file1.data"
|
||||
"resources/entryList/file2.data"
|
||||
"resources/entryList/file3.data"
|
||||
"resources/entryList/file4.nothing"
|
||||
"searchdir/subdir1/picker.png"
|
||||
"searchdir/subdir2/picker.png"
|
||||
"testData/empty"
|
||||
"testdir/dir/qdir.pro"
|
||||
"testdir/dir/qrc_qdir.cpp"
|
||||
"testdir/dir/tmp/empty"
|
||||
"testdir/dir/tst_qdir.cpp"
|
||||
"testdir/spaces/foo. bar"
|
||||
"testdir/spaces/foo.bar"
|
||||
"tst_qdir.cpp"
|
||||
"types/a"
|
||||
"types/a.a"
|
||||
"types/a.b"
|
||||
"types/a.c"
|
||||
"types/b"
|
||||
"types/b.a"
|
||||
"types/b.b"
|
||||
"types/b.c"
|
||||
"types/c"
|
||||
"types/c.a"
|
||||
"types/c.b"
|
||||
"types/c.c"
|
||||
"types/d.a/dummy"
|
||||
"types/d.b/dummy"
|
||||
"types/d.c/dummy"
|
||||
"types/d/dummy"
|
||||
"types/e.a/dummy"
|
||||
"types/e.b/dummy"
|
||||
"types/e.c/dummy"
|
||||
"types/e/dummy"
|
||||
"types/f.a/dummy"
|
||||
"types/f.b/dummy"
|
||||
"types/f.c/dummy"
|
||||
"types/f/dummy"
|
||||
)
|
||||
|
||||
# Resources:
|
||||
set(qdir_resource_files
|
||||
"resources/entryList/"
|
||||
)
|
||||
|
||||
qt_internal_add_resource(tst_qdir "qdir"
|
||||
PREFIX
|
||||
"/tst_qdir/"
|
||||
FILES
|
||||
${qdir_resource_files}
|
||||
)
|
||||
if (WASM)
|
||||
qt_internal_add_test(tst_qdir
|
||||
SOURCES
|
||||
tst_qdir.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::TestPrivate
|
||||
TESTDATA
|
||||
)
|
||||
qt_internal_add_resource(tst_qdir "tst_qdir"
|
||||
PREFIX
|
||||
"/tst_qdir"
|
||||
FILES
|
||||
${test_data_files}
|
||||
)
|
||||
elseif (ANDROID)
|
||||
qt_internal_add_test(tst_qdir
|
||||
SOURCES
|
||||
tst_qdir.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::TestPrivate
|
||||
TESTDATA ${test_data_dirs}
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_extend_target(tst_qdir CONDITION CONFIG___contains___builtin_testdata
|
||||
DEFINES
|
||||
BUILTIN_TESTDATA
|
||||
)
|
||||
|
||||
if(ANDROID)
|
||||
# Resources:
|
||||
set(android_testdata_resource_files
|
||||
"entrylist/directory/dummy"
|
||||
"entrylist/file"
|
||||
"resources/entryList/file1.data"
|
||||
"resources/entryList/file2.data"
|
||||
"resources/entryList/file3.data"
|
||||
"resources/entryList/file4.nothing"
|
||||
"searchdir/subdir1/picker.png"
|
||||
"searchdir/subdir2/picker.png"
|
||||
"testData/empty"
|
||||
"testdir/dir/qdir.pro"
|
||||
"testdir/dir/qrc_qdir.cpp"
|
||||
"testdir/dir/tmp/empty"
|
||||
"testdir/dir/tst_qdir.cpp"
|
||||
"testdir/spaces/foo. bar"
|
||||
"testdir/spaces/foo.bar"
|
||||
"tst_qdir.cpp"
|
||||
"types/a"
|
||||
"types/a.a"
|
||||
"types/a.b"
|
||||
"types/a.c"
|
||||
"types/b"
|
||||
"types/b.a"
|
||||
"types/b.b"
|
||||
"types/b.c"
|
||||
"types/c"
|
||||
"types/c.a"
|
||||
"types/c.b"
|
||||
"types/c.c"
|
||||
"types/d.a/dummy"
|
||||
"types/d.b/dummy"
|
||||
"types/d.c/dummy"
|
||||
"types/d/dummy"
|
||||
"types/e.a/dummy"
|
||||
"types/e.b/dummy"
|
||||
"types/e.c/dummy"
|
||||
"types/e/dummy"
|
||||
"types/f.a/dummy"
|
||||
"types/f.b/dummy"
|
||||
"types/f.c/dummy"
|
||||
"types/f/dummy"
|
||||
set(qdir_resource_files
|
||||
"resources/entryList/"
|
||||
)
|
||||
|
||||
qt_internal_add_resource(tst_qdir "qdir"
|
||||
PREFIX
|
||||
"/tst_qdir/"
|
||||
FILES
|
||||
${qdir_resource_files}
|
||||
)
|
||||
|
||||
qt_internal_add_resource(tst_qdir "android_testdata"
|
||||
@ -100,4 +119,35 @@ if(ANDROID)
|
||||
FILES
|
||||
${android_testdata_resource_files}
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
qt_internal_add_test(tst_qdir
|
||||
SOURCES
|
||||
tst_qdir.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::TestPrivate
|
||||
TESTDATA ${test_data_dirs}
|
||||
)
|
||||
|
||||
# Resources:
|
||||
set(qdir_resource_files
|
||||
"resources/entryList/"
|
||||
)
|
||||
|
||||
qt_internal_add_resource(tst_qdir "qdir"
|
||||
PREFIX
|
||||
"/tst_qdir/"
|
||||
FILES
|
||||
${qdir_resource_files}
|
||||
)
|
||||
endif()
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_extend_target(tst_qdir CONDITION CONFIG___contains___builtin_testdata
|
||||
DEFINES
|
||||
BUILTIN_TESTDATA
|
||||
)
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qstringlist.h>
|
||||
#include <QDirIterator>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
#include <QtCore/private/qfsfileengine_p.h>
|
||||
@ -263,7 +264,11 @@ void tst_QDir::init()
|
||||
void tst_QDir::initTestCase()
|
||||
{
|
||||
#ifdef BUILTIN_TESTDATA
|
||||
#ifdef Q_OS_WASM
|
||||
m_dataDir = QEXTRACTTESTDATA("/tst_qdir");
|
||||
#else
|
||||
m_dataDir = QEXTRACTTESTDATA("/");
|
||||
#endif
|
||||
QVERIFY2(!m_dataDir.isNull(), qPrintable("Did not find testdata. Is this builtin?"));
|
||||
m_dataPath = m_dataDir->path();
|
||||
#elif QT_CONFIG(cxx17_filesystem) // This code doesn't work in QNX on the CI
|
||||
@ -450,6 +455,9 @@ void tst_QDir::mkdirOnSymlink()
|
||||
fi.setFile(path);
|
||||
#if defined(Q_OS_QNX)
|
||||
QSKIP("Fails on QNX QTBUG-98561");
|
||||
#endif
|
||||
#if defined (Q_OS_WASM)
|
||||
QEXPECT_FAIL("", "fails on wasm, see bug: QTBUG-127766", Continue);
|
||||
#endif
|
||||
QVERIFY2(fi.exists() && fi.isDir(), msgDoesNotExist(path).constData());
|
||||
#endif
|
||||
@ -514,6 +522,9 @@ void tst_QDir::makedirReturnCode()
|
||||
|
||||
// the next line specifically targets Windows and macOS (QTBUG-85997, QTBUG-97110)
|
||||
// calling mkpath on an existing drive name (Windows) or root path (macOS) shall pass
|
||||
#ifdef Q_OS_WASM
|
||||
QEXPECT_FAIL("", "fails on wasm, see bug QTBUG-127767", Continue);
|
||||
#endif
|
||||
QVERIFY(QDir().mkpath(QDir::rootPath()));
|
||||
QVERIFY(!QDir().mkdir(QDir::rootPath()));
|
||||
|
||||
@ -1933,11 +1944,13 @@ void tst_QDir::longFileName_data()
|
||||
QTest::addColumn<int>("length");
|
||||
|
||||
QTest::newRow("128") << 128;
|
||||
#ifndef Q_OS_WASM
|
||||
QTest::newRow("256") << 256;
|
||||
QTest::newRow("512") << 512;
|
||||
QTest::newRow("1024") << 1024;
|
||||
QTest::newRow("2048") << 2048;
|
||||
QTest::newRow("4096") << 4096;
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDir::longFileName()
|
||||
@ -2287,6 +2300,8 @@ void tst_QDir::equalityOperator_data()
|
||||
QString pathinroot("/boot/..");
|
||||
#elif defined(Q_OS_VXWORKS)
|
||||
QString pathinroot("/tmp/..");
|
||||
#elif defined(Q_OS_WASM)
|
||||
QString pathinroot("/tmp/..");
|
||||
#else
|
||||
QString pathinroot("/usr/..");
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user