From bbc976c920f161b630129aa152c7031c8c10d33a Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 1 Feb 2024 15:48:40 +0100 Subject: [PATCH] gather more information on exceptions that happen when running tests Signed-off-by: Matthieu Gallien --- test/testsyncengine.cpp | 60 +++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 8ef503956..15ac965f1 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -15,6 +15,8 @@ #include #include +#include + using namespace OCC; namespace { @@ -813,36 +815,42 @@ private slots: QVERIFY(fakeFolder.currentLocalState().find("A/t𠜎t")); #if !defined(Q_OS_MAC) && !defined(Q_OS_WIN) - // Try again with a locale that can represent ö but not 𠜎 (4-byte utf8). - QTextCodec::setCodecForLocale(QTextCodec::codecForName("ISO-8859-15")); - QVERIFY(QTextCodec::codecForLocale()->mibEnum() == 111); + try { + // Try again with a locale that can represent ö but not 𠜎 (4-byte utf8). + QTextCodec::setCodecForLocale(QTextCodec::codecForName("ISO-8859-15")); + QVERIFY(QTextCodec::codecForLocale()->mibEnum() == 111); - fakeFolder.remoteModifier().insert("B/tößt"); - fakeFolder.remoteModifier().insert("B/t𠜎t"); - QVERIFY(fakeFolder.syncOnce()); - QVERIFY(fakeFolder.currentLocalState().find("B/tößt")); - QVERIFY(!fakeFolder.currentLocalState().find("B/t𠜎t")); - QVERIFY(!fakeFolder.currentLocalState().find("B/t?t")); - QVERIFY(!fakeFolder.currentLocalState().find("B/t??t")); - QVERIFY(!fakeFolder.currentLocalState().find("B/t???t")); - QVERIFY(!fakeFolder.currentLocalState().find("B/t????t")); - QVERIFY(fakeFolder.syncOnce()); - QVERIFY(fakeFolder.currentRemoteState().find("B/tößt")); - QVERIFY(fakeFolder.currentRemoteState().find("B/t𠜎t")); + fakeFolder.remoteModifier().insert("B/tößt"); + fakeFolder.remoteModifier().insert("B/t𠜎t"); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(fakeFolder.currentLocalState().find("B/tößt")); + QVERIFY(!fakeFolder.currentLocalState().find("B/t𠜎t")); + QVERIFY(!fakeFolder.currentLocalState().find("B/t?t")); + QVERIFY(!fakeFolder.currentLocalState().find("B/t??t")); + QVERIFY(!fakeFolder.currentLocalState().find("B/t???t")); + QVERIFY(!fakeFolder.currentLocalState().find("B/t????t")); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(fakeFolder.currentRemoteState().find("B/tößt")); + QVERIFY(fakeFolder.currentRemoteState().find("B/t𠜎t")); - // Try again with plain ascii - QTextCodec::setCodecForLocale(QTextCodec::codecForName("ASCII")); - QVERIFY(QTextCodec::codecForLocale()->mibEnum() == 3); + // Try again with plain ascii + QTextCodec::setCodecForLocale(QTextCodec::codecForName("ASCII")); + QVERIFY(QTextCodec::codecForLocale()->mibEnum() == 3); - fakeFolder.remoteModifier().insert("C/tößt"); - QVERIFY(fakeFolder.syncOnce()); - QVERIFY(!fakeFolder.currentLocalState().find("C/tößt")); - QVERIFY(!fakeFolder.currentLocalState().find("C/t??t")); - QVERIFY(!fakeFolder.currentLocalState().find("C/t????t")); - QVERIFY(fakeFolder.syncOnce()); - QVERIFY(fakeFolder.currentRemoteState().find("C/tößt")); + fakeFolder.remoteModifier().insert("C/tößt"); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(!fakeFolder.currentLocalState().find("C/tößt")); + QVERIFY(!fakeFolder.currentLocalState().find("C/t??t")); + QVERIFY(!fakeFolder.currentLocalState().find("C/t????t")); + QVERIFY(fakeFolder.syncOnce()); + QVERIFY(fakeFolder.currentRemoteState().find("C/tößt")); - QTextCodec::setCodecForLocale(utf8Locale); + QTextCodec::setCodecForLocale(utf8Locale); + } + catch (const std::filesystem::filesystem_error &e) + { + qCritical() << e.what() << e.path1().c_str() << e.path2().c_str() << e.code().message().c_str(); + } #endif }