|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
K_GLOBAL_STATIC and unittests?It seems that statics created with K_GLOBAL_STATIC aren't destroyed when they
are created in a unittest, though it works perfectly in a real application. Is that something known or intentional? -- Boudewijn Rempt | http://www.valdyas.org |
|
|
Re: K_GLOBAL_STATIC and unittests?Em Sábado 17. Outubro 2009, às 09.49.54, Boudewijn Rempt escreveu:
> It seems that statics created with K_GLOBAL_STATIC aren't destroyed when > they are created in a unittest, though it works perfectly in a real > application. Is that something known or intentional? Global statics are destroyed when the application exits. That's too late for the tests. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Senior Product Manager - Nokia, Qt Development Frameworks PGP/GPG: 0x6EF45358; fingerprint: E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358 Qt Developer Days 2009 | Registration Now Open! Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4 http://qt.nokia.com/qtdevdays2009 |
|
|
Re: K_GLOBAL_STATIC and unittests?On Saturday 17 October 2009, Thiago Macieira wrote:
> Em Sábado 17. Outubro 2009, às 09.49.54, Boudewijn Rempt escreveu: > > It seems that statics created with K_GLOBAL_STATIC aren't destroyed when > > they are created in a unittest, though it works perfectly in a real > > application. Is that something known or intentional? > > Global statics are destroyed when the application exits. That's too late > for the tests. Ah, I thought something defined by, say, QTEST_KDEMAIN(KisPaintDeviceActionTest, GUI) was an application, so I expected K_GLOBAL_STATIC to be destroyed on shutdown. -- Boudewijn Rempt | http://www.valdyas.org |
|
|
Re: K_GLOBAL_STATIC and unittests?On Saturday 17 October 2009, Boudewijn Rempt wrote:
> On Saturday 17 October 2009, Thiago Macieira wrote: > > Em Sábado 17. Outubro 2009, às 09.49.54, Boudewijn Rempt escreveu: > > > It seems that statics created with K_GLOBAL_STATIC aren't destroyed > > > when they are created in a unittest, though it works perfectly in a > > > real application. Is that something known or intentional? > > > > Global statics are destroyed when the application exits. That's too late > > for the tests. > > Ah, I thought something defined by, say, > QTEST_KDEMAIN(KisPaintDeviceActionTest, GUI) was an application, so I > expected K_GLOBAL_STATIC to be destroyed on shutdown. Yes, on shutdown, i.e. after main() returns. But that means you can't test it from any of your tests, that's what Thiago meant. But if you don't see the thing being deleted at all, i.e. if you see a memory leak, then that's very very surprising. It certainly works in the kdelibs unittests, AFAIK... -- David Faure, faure@..., http://www.davidfaure.fr Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org). |
|
|
Re: K_GLOBAL_STATIC and unittests?On Wednesday 04 November 2009, David Faure wrote:
> On Saturday 17 October 2009, Boudewijn Rempt wrote: > > On Saturday 17 October 2009, Thiago Macieira wrote: > > > Em Sábado 17. Outubro 2009, às 09.49.54, Boudewijn Rempt escreveu: > > > > It seems that statics created with K_GLOBAL_STATIC aren't destroyed > > > > when they are created in a unittest, though it works perfectly in a > > > > real application. Is that something known or intentional? > > > > > > Global statics are destroyed when the application exits. That's too > > > late for the tests. > > > > Ah, I thought something defined by, say, > > QTEST_KDEMAIN(KisPaintDeviceActionTest, GUI) was an application, so I > > expected K_GLOBAL_STATIC to be destroyed on shutdown. > > Yes, on shutdown, i.e. after main() returns. > But that means you can't test it from any of your tests, that's what Thiago > meant. > > But if you don't see the thing being deleted at all, i.e. if you see a > memory leak, then that's very very surprising. It certainly works in the > kdelibs unittests, AFAIK... Yes, that's what I seem to see: the various statics (and KOffice has too many of them) get destructed when running an app, but leak when running a test. -- Boudewijn Rempt | http://www.valdyas.org |
|
|
Re: K_GLOBAL_STATIC and unittests?On Wednesday 04 November 2009, Boudewijn Rempt wrote:
> On Wednesday 04 November 2009, David Faure wrote: > > On Saturday 17 October 2009, Boudewijn Rempt wrote: > > > On Saturday 17 October 2009, Thiago Macieira wrote: > > > > Em Sábado 17. Outubro 2009, às 09.49.54, Boudewijn Rempt escreveu: > > > > > It seems that statics created with K_GLOBAL_STATIC aren't destroyed > > > > > when they are created in a unittest, though it works perfectly in a > > > > > real application. Is that something known or intentional? > > > > > > > > Global statics are destroyed when the application exits. That's too > > > > late for the tests. > > > > > > Ah, I thought something defined by, say, > > > QTEST_KDEMAIN(KisPaintDeviceActionTest, GUI) was an application, so I > > > expected K_GLOBAL_STATIC to be destroyed on shutdown. > > > > Yes, on shutdown, i.e. after main() returns. > > But that means you can't test it from any of your tests, that's what > > Thiago meant. > > > > But if you don't see the thing being deleted at all, i.e. if you see a > > memory leak, then that's very very surprising. It certainly works in the > > kdelibs unittests, AFAIK... > > Yes, that's what I seem to see: the various statics (and KOffice has too > many of them) get destructed when running an app, but leak when running a > test. And what about the statics from kdelibs? Are they destroyed or leaked, in your unit tests? (and when you run the kdelibs unittests)? Can you try to reduce the problem to the smallest testcase that shows the issue? -- David Faure, faure@..., http://www.davidfaure.fr Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org). |
|
|
Re: K_GLOBAL_STATIC and unittests?On Thursday 05 November 2009, David Faure wrote:
> And what about the statics from kdelibs? Are they destroyed or leaked, in > your unit tests? (and when you run the kdelibs unittests)? I haven't got a kdelibs development environment, I'm afraid, I work with installed packages these days. > Can you try to reduce the problem to the smallest testcase that shows the > issue? I'll try. -- Boudewijn Rempt | http://www.valdyas.org |
| Free embeddable forum powered by Nabble | Forum Help |