[Development] Danger when excluding auto tests with pre-processor macro.

Olivier Goffart olivier at woboq.com
Thu Jan 31 14:18:25 CET 2013


On Sunday 04 November 2012 12:26:12 Thiago Macieira wrote:
> On domingo, 4 de novembro de 2012 10.42.39, Olivier Goffart wrote:
> > > At some point Jason McDonald was going over all the tests and fixing
> > > this, but maybe someone needs to take a second round now...
> > 
> > I already let Jason know at that time, and he fixed most of them
> > (commit a8fd0c3654f8352773638633778cd8003680cbc7 )
> > 
> > But since Jason has left (AFAIK?), the history repeat again
> 
> There have been a series of commits doing it in the other direction.

That is what motivated my first email.  But no action has been taken since to 
fix the problem.
As a result, many of the platform specific tests are not run at all even on the 
said platform.

For rappel, when , in a test, there is something like

class tst_QStyle : public QObject
{
    Q_OBJECT
private slots:
#ifdef Q_OS_MAC
    void testMacStyle();
#endif

The moc does not know that Q_OS_MAC is defined.  That's because Q_OS_MAC is 
defined in qsystemdetection.h, detected using #if defined(__APPLE__) 
and moc does not know __APPLE__ or __GNUC__ or __cplusplus or any other 
builtin compiler define.

so moc will think this is ifdef'ed out, and will not generate the slot. 
Therefore, even if the slot is compiled by the compiler (because the compiler 
has the builtin define __APPLE__) the test will not be run by the test system 
because moc thought it was disabled.


git log -p -i --grep "remove.*QSKIP" -- tests/auto/

To see many of the wrong commits.

-- 
Olivier (Who is not going to fix the problem, just complaining :-p)

Woboq - Qt services and support - http://woboq.com



More information about the Development mailing list