CodeCoverage: Remove releaseCoverageTool() function.

QLibraryPrivate::release() can be called multiple times and it is not
appropriate to unregister and save the executed data for a library there.
The library may still be used when it is released and it seems safer to save
its data only once and probably when the application ends.

Not calling __coveragescanner_unregister_library does not affect the
coverage data. Calling __coveragescanner_register_library at load time
without calling __coveragescanner_unregister_library means the plugin will
stay loaded until the application ends. Removing the call to
releaseCoverageTool() is so acceptable since the data will be saved
when the application exits.

Task-number: QTQAINFRA-416.

Change-Id: I3135d2e203ecacfeff4a5b8ffdcd4d62fbc1db33
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
Caroline Chao 2012-01-03 10:26:32 +01:00 committed by Qt by Nokia
parent 1d63b9beb9
commit a8495549d0

View File

@ -430,25 +430,6 @@ static void installCoverageTool(QLibraryPrivate *libPrivate)
#endif
}
static void releaseCoverageTool(QLibraryPrivate *libPrivate)
{
#ifdef __COVERAGESCANNER__
/*
__COVERAGESCANNER__ is defined when Qt has been instrumented for code
coverage by TestCocoon.
Here is the code to save the execution data.
See comments about initialization in QLibraryPrivate::load().
*/
if (libPrivate->pHnd) {
__coveragescanner_save();
__coveragescanner_clear();
__coveragescanner_unregister_library(libPrivate->fileName.toLocal8Bit());
}
#else
Q_UNUSED(libPrivate);
#endif
}
typedef QMap<QString, QLibraryPrivate*> LibraryMap;
struct LibraryData {
@ -545,8 +526,6 @@ bool QLibraryPrivate::unload()
void QLibraryPrivate::release()
{
releaseCoverageTool(this);
QMutexLocker locker(qt_library_mutex());
if (!libraryRefCount.deref())
delete this;