Random test failures...

Dag Andersen danders at get2net.dk
Mon Sep 5 10:25:02 BST 2011


Fredag 02 september 2011 18:59:22 skrev Cyrille Berger Skott:
> 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 ?
Agree it's not nice so I'm looking onto how to change it.

I dug into the test macros and find some strange code that afaics makes it 
impossible to run tests concurrently from the same user, see:
kdelibs/kdecore/util/qtest_kde.h
I found code like this in main():
QFile::remove(QDir::homePath() + QString::fromLatin1("/.kde-unit-
test/share/config/qttestrc"))
which imho will break concurrent testing.

I don't see any easy way around this, maybe running tests from diffrent users 
is the only possibility?
Or have I missed something?
> 
> 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);
> }

-- 
Mvh.
Dag Andersen



More information about the calligra-devel mailing list