Skip to content
Permalink
Browse files

Fix some race condition segfaults of tests on exit

  • Loading branch information
m-kuhn committed Nov 21, 2014
1 parent 78c5195 commit 95f64838555ce06f44d03330b18174f947eb8ed1
Showing with 109 additions and 25 deletions.
  1. +1 −1 tests/src/analysis/testqgsvectoranalyzer.cpp
  2. +6 −1 tests/src/analysis/testqgszonalstatistics.cpp
  3. +1 −0 tests/src/app/testqgisappclipboard.cpp
  4. +1 −1 tests/src/core/regression992.cpp
  5. +6 −0 tests/src/core/testqgsapplication.cpp
  6. +3 −1 tests/src/core/testqgsblendmodes.cpp
  7. +1 −1 tests/src/core/testqgscomposerdd.cpp
  8. +2 −0 tests/src/core/testqgscomposereffects.cpp
  9. +2 −1 tests/src/core/testqgscomposerlabel.cpp
  10. +2 −1 tests/src/core/testqgscomposermap.cpp
  11. +2 −0 tests/src/core/testqgscomposermapgrid.cpp
  12. +1 −1 tests/src/core/testqgscomposermapoverview.cpp
  13. +3 −2 tests/src/core/testqgscomposerrotation.cpp
  14. +2 −1 tests/src/core/testqgscomposerscalebar.cpp
  15. +2 −1 tests/src/core/testqgscomposertable.cpp
  16. +2 −0 tests/src/core/testqgscomposerutils.cpp
  17. +6 −0 tests/src/core/testqgscoordinatereferencesystem.cpp
  18. +6 −0 tests/src/core/testqgscoordinatetransform.cpp
  19. +3 −1 tests/src/core/testqgsdataitem.cpp
  20. +1 −4 tests/src/core/testqgsdiagram.cpp
  21. +1 −0 tests/src/core/testqgsdiagramexpression.cpp
  22. +6 −0 tests/src/core/testqgsdistancearea.cpp
  23. +5 −0 tests/src/core/testqgsexpression.cpp
  24. +1 −0 tests/src/core/testqgsgeometry.cpp
  25. +2 −0 tests/src/core/testqgsgradients.cpp
  26. +2 −0 tests/src/core/testqgsinvertedpolygonrenderer.cpp
  27. +6 −1 tests/src/core/testqgsmaplayer.cpp
  28. +2 −0 tests/src/core/testqgsmaprenderer.cpp
  29. +1 −0 tests/src/core/testqgsrasterfilewriter.cpp
  30. +2 −0 tests/src/core/testqgsrasterfill.cpp
  31. +2 −1 tests/src/core/testqgsrasterlayer.cpp
  32. +1 −1 tests/src/core/testqgsrastersublayer.cpp
  33. +2 −1 tests/src/core/testqgsrenderers.cpp
  34. +5 −0 tests/src/core/testqgsrulebasedrenderer.cpp
  35. +2 −0 tests/src/core/testqgsshapeburst.cpp
  36. +2 −1 tests/src/core/testqgsvectorlayercache.cpp
  37. +1 −1 tests/src/core/testqgsvectorlayerjoinbuffer.cpp
  38. +2 −0 tests/src/core/testziplayer.cpp
  39. +2 −1 tests/src/gui/testprojectionissues.cpp
  40. +1 −0 tests/src/gui/testqgsdualview.cpp
  41. +4 −1 tests/src/gui/testqgsmaptoolzoom.cpp
  42. +2 −0 tests/src/gui/testqgsrubberband.cpp
  43. +2 −0 tests/src/providers/testqgswcsprovider.cpp
@@ -78,7 +78,7 @@ void TestQgsVectorAnalyzer::initTestCase()
}
void TestQgsVectorAnalyzer::cleanupTestCase()
{

QgsApplication::exitQgis();
}
void TestQgsVectorAnalyzer::init()
{
@@ -28,7 +28,7 @@ class TestQgsZonalStatistics: public QObject
Q_OBJECT;
private slots:
void initTestCase();
void cleanupTestCase() {};
void cleanupTestCase();
void init() {};
void cleanup() {};

@@ -62,6 +62,11 @@ void TestQgsZonalStatistics::initTestCase()
mRasterPath = myTempPath + "edge_problem.asc";
}

void TestQgsZonalStatistics::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgsZonalStatistics::testStatistics()
{
QgsZonalStatistics zs( mVectorLayer, mRasterPath, "", 1 );
@@ -63,6 +63,7 @@ void TestQgisAppClipboard::initTestCase()
//runs after all tests
void TestQgisAppClipboard::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgisAppClipboard::copyPaste()
@@ -105,7 +105,7 @@ void Regression992::cleanupTestCase()
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

delete mpRasterLayer;
QgsApplication::exitQgis();
}

void Regression992::regression992()
@@ -30,6 +30,7 @@ class TestQgsApplication: public QObject
void checkPaths();
void checkGdalSkip();
void initTestCase();
void cleanupTestCase();
private:
QString getQgisPath();
};
@@ -46,6 +47,11 @@ void TestQgsApplication::initTestCase()
qDebug( "%s", QgsApplication::showSettings().toUtf8().constData() );
};

void TestQgsApplication::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgsApplication::checkPaths()
{
QString myPath = QgsApplication::authorsFilePath();
@@ -112,7 +112,7 @@ void TestQgsBlendModes::initTestCase()
rasterFileInfo.completeBaseName() );
QgsMultiBandColorRenderer* rasterRenderer = new QgsMultiBandColorRenderer( mRasterLayer1->dataProvider(), 2, 3, 4 );
mRasterLayer1->setRenderer( rasterRenderer );
mRasterLayer2->setRenderer( rasterRenderer );
mRasterLayer2->setRenderer(( QgsRasterRenderer* ) rasterRenderer->clone() );
QgsMapLayerRegistry::instance()->addMapLayers(
QList<QgsMapLayer *>() << mRasterLayer1 );
QgsMapLayerRegistry::instance()->addMapLayers(
@@ -131,6 +131,8 @@ void TestQgsBlendModes::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsBlendModes::vectorBlending()
@@ -105,7 +105,6 @@ void TestQgsComposerDD::initTestCase()
void TestQgsComposerDD::cleanupTestCase()
{
delete mComposition;
delete mVectorLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
@@ -115,6 +114,7 @@ void TestQgsComposerDD::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerDD::init()
@@ -77,6 +77,8 @@ void TestQgsComposerEffects::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsComposerEffects::init()
@@ -78,7 +78,8 @@ void TestQgsComposerLabel::initTestCase()
void TestQgsComposerLabel::cleanupTestCase()
{
delete mComposition;
delete mVectorLayer;

QgsApplication::exitQgis();
}

void TestQgsComposerLabel::init()
@@ -76,7 +76,6 @@ void TestQgsComposerMap::initTestCase()
void TestQgsComposerMap::cleanupTestCase()
{
delete mComposition;
delete mRasterLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
@@ -86,6 +85,8 @@ void TestQgsComposerMap::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsComposerMap::init()
@@ -91,6 +91,8 @@ void TestQgsComposerMapGrid::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsComposerMapGrid::init()
@@ -80,7 +80,6 @@ void TestQgsComposerMapOverview::initTestCase()
void TestQgsComposerMapOverview::cleanupTestCase()
{
delete mComposition;
delete mRasterLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
@@ -90,6 +89,7 @@ void TestQgsComposerMapOverview::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerMapOverview::init()
@@ -97,10 +97,9 @@ void TestQgsComposerRotation::initTestCase()

mReport = "<h1>Composer Rotation Tests</h1>\n";
}

void TestQgsComposerRotation::cleanupTestCase()
{
delete mComposition;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -109,6 +108,8 @@ void TestQgsComposerRotation::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsComposerRotation::init()
@@ -101,7 +101,6 @@ void TestQgsComposerScaleBar::initTestCase()
void TestQgsComposerScaleBar::cleanupTestCase()
{
delete mComposition;
delete mRasterLayer;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
@@ -111,6 +110,8 @@ void TestQgsComposerScaleBar::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
};

void TestQgsComposerScaleBar::init()
@@ -92,7 +92,8 @@ void TestQgsComposerTable::initTestCase()
void TestQgsComposerTable::cleanupTestCase()
{
delete mComposition;
delete mVectorLayer;

QgsApplication::exitQgis();
}

void TestQgsComposerTable::init()
@@ -84,6 +84,8 @@ void TestQgsComposerUtils::initTestCase()

void TestQgsComposerUtils::cleanupTestCase()
{
QgsApplication::exitQgis();

delete mComposition;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
@@ -34,6 +34,7 @@ class TestQgsCoordinateReferenceSystem: public QObject
Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
void wktCtor();
void idCtor();
void copyCtor();
@@ -101,6 +102,11 @@ void TestQgsCoordinateReferenceSystem::initTestCase()

}

void TestQgsCoordinateReferenceSystem::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgsCoordinateReferenceSystem::wktCtor()
{
QString myWkt = GEOWKT;
@@ -25,6 +25,7 @@ class TestQgsCoordinateTransform: public QObject

private slots:
void initTestCase();
void cleanupTestCase();
void transformBoundingBox();

private:
@@ -39,6 +40,11 @@ void TestQgsCoordinateTransform::initTestCase()

}

void TestQgsCoordinateTransform::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgsCoordinateTransform::transformBoundingBox()
{
//test transforming a bounding box which crosses the 180 degree longitude line
@@ -33,7 +33,7 @@ class TestQgsDataItem: public QObject

private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase();;// will be called after the last testfunction was executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init() {};// will be called before each testfunction is executed.
void cleanup() {};// will be called after every testfunction.

@@ -75,6 +75,8 @@ void TestQgsDataItem::cleanupTestCase()
settings.setValue( "/qgis/scanItemsInBrowser2", mScanItemsSetting );
if ( mDirItem )
delete mDirItem;

QgsApplication::exitQgis();
}

bool TestQgsDataItem::isValidDirItem( QgsDirectoryItem *item )
@@ -109,6 +109,7 @@ class TestQgsDiagram: public QObject
// will be called after the last testfunction was executed.
void cleanupTestCase()
{
QgsApplication::exitQgis();
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -118,10 +119,6 @@ class TestQgsDiagram: public QObject
myFile.close();
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

delete mComposerMap;
delete mComposition;
delete mPointsLayer;
}
void init() {};// will be called before each testfunction is executed.
void cleanup() {};// will be called after every testfunction.
@@ -114,6 +114,7 @@ class TestQgsDiagramExpression: public QObject
// will be called after the last testfunction was executed.
void cleanupTestCase()
{
QgsApplication::exitQgis();
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -30,6 +30,7 @@ class TestQgsDistanceArea: public QObject
Q_OBJECT;
private slots:
void initTestCase();
void cleanupTestCase();
void basic();
void test_distances();
void unit_conversions();
@@ -46,6 +47,11 @@ void TestQgsDistanceArea::initTestCase()
QgsApplication::showSettings();
}

void TestQgsDistanceArea::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgsDistanceArea::basic()
{
QgsPoint p1( 1.0, 3.0 ), p2( -2.0, -1.0 );
@@ -59,6 +59,11 @@ class TestQgsExpression: public QObject
QgsApplication::showSettings();
}

void cleanupTestCase()
{
QgsApplication::exitQgis();
}

void parsing_data()
{
QTest::addColumn<QString>( "string" );
@@ -320,6 +320,7 @@ void TestQgsGeometry::cleanupTestCase()
//QDesktopServices::openUrl( "file:///" + myReportFile );
}

QgsApplication::exitQgis();
}

// MK, Disabled 14.11.2014
@@ -128,6 +128,8 @@ void TestQgsGradients::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsGradients::gradientSymbol()
@@ -101,6 +101,8 @@ void TestQgsInvertedPolygon::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}

QgsApplication::exitQgis();
}

void TestQgsInvertedPolygon::singleSubRenderer()
@@ -50,7 +50,7 @@ class TestQgsMapLayer: public QObject
Q_OBJECT;
private slots:
void initTestCase();// will be called before the first testfunction is executed.
void cleanupTestCase() {};// will be called after the last testfunction was executed.
void cleanupTestCase();// will be called after the last testfunction was executed.
void init() {};// will be called before each testfunction is executed.
void cleanup() {};// will be called after every testfunction.

@@ -80,6 +80,11 @@ void TestQgsMapLayer::initTestCase()
myMapFileInfo.completeBaseName(), "ogr" );
}

void TestQgsMapLayer::cleanupTestCase()
{
QgsApplication::exitQgis();
}

void TestQgsMapLayer::isValid()
{
QVERIFY( mpLayer->isValid() );
@@ -171,6 +171,8 @@ void TestQgsMapRenderer::initTestCase()

void TestQgsMapRenderer::cleanupTestCase()
{
QgsApplication::exitQgis();

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -74,6 +74,7 @@ void TestQgsRasterFileWriter::initTestCase()
//runs after all tests
void TestQgsRasterFileWriter::cleanupTestCase()
{
QgsApplication::exitQgis();
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )

0 comments on commit 95f6483

Please sign in to comment.
You can’t perform that action at this time.