Random test failures...

Cyrille Berger Skott cberger at cberger.net
Fri Sep 2 17:59:22 BST 2011


On Thursday 01 September 2011, Dag Andersen wrote:
> > The weird thing is that it seems to only affect a limited subset of test.
> 
> Yes, I've only seen the calendar test for plan, noone else.
> Could be a coincidence, of course, but...
I think I have figured it out...

The following code is kind of not nice... Especially the "share/config" part... 
Well anyway, is that really necesserary ?

void CalendarTester::cleanupTestCase()
{
    removeDir(QLatin1String("kdatetimetest/Africa"));
    removeDir(QLatin1String("kdatetimetest/America"));
    removeDir(QLatin1String("kdatetimetest/Europe"));
    removeDir(QLatin1String("kdatetimetest"));
    removeDir(QLatin1String("share/config"));
    QDir().rmpath(QDir::homePath() + "/.kde-unit-test/share");
}

void CalendarTester::removeDir(const QString &subdir)
{
    QDir local = QDir::homePath() + QLatin1String("/.kde-unit-test/") + 
subdir;
    foreach(const QString &file, local.entryList(QDir::Files))
        if(!local.remove(file))
            qWarning("%s: removing failed", qPrintable( file ));
    QCOMPARE((int)local.entryList(QDir::Files).count(), 0);
    local.cdUp();
    QString subd = subdir;
    subd.remove(QRegExp("^.*/"));
    local.rmpath(subd);
}


-- 
Cyrille Berger Skott



More information about the calligra-devel mailing list