[Development] Danger when excluding auto tests with pre-processor macro.
Olivier Goffart
olivier at woboq.com
Sat Nov 3 13:28:49 CET 2012
Hi,
In the paragraph "Use appropriate mechanisms to exclude inapplicable tests" of
https://qt-project.org/wiki/Writing_Unit_Tests
the policy to exclude tests depending on platforms or compiler features is to
use pre-processor #ifdef.
I just eddited that page to add a Warning there.
the MOC does not know all the built-ins defined by the compiler. And as a
result, disabling a test based on one of those define actually disable the
test all the time, since the moc will not generate the slot for it so the test
system don't call that function.
I write that now because I just saw many changes recently that effectively
just remove tests on all platform.
For example, I don't think QT_OS_WIN is visible to moc,
and i'm pretty sure QT_COMPILER_* is not visible
So in effect, all those recent commit just disabled some tests that should
probably not be disabled.
--
Olivier
Woboq - Qt services and support - http://woboq.com
More information about the Development
mailing list