mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
test cleanups
This commit is contained in:
parent
c5ea708dd9
commit
db1c3d9f4e
@ -50,9 +50,7 @@ typedef SInt32 SRefCon;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include "qgspluginregistry.h"
|
||||
#include "qgsbench.h"
|
||||
//#include "qgsmapcanvas.h"
|
||||
#include "qgsapplication.h"
|
||||
#include <qgsconfig.h>
|
||||
#include <qgsversion.h>
|
||||
|
@ -50,12 +50,9 @@ void TestQgsVectorAnalyzer::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::init( INSTALL_PREFIX );
|
||||
QgsApplication::initQgis( );
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
// Instantiate the plugin directory so that providers are loaded
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
|
||||
//create some objects that will be used in all tests...
|
||||
//create a map layer that will be used in all tests...
|
||||
@ -91,7 +88,6 @@ void TestQgsVectorAnalyzer::cleanup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestQgsVectorAnalyzer::singleToMulti( )
|
||||
{
|
||||
|
||||
@ -116,9 +112,7 @@ void TestQgsVectorAnalyzer::simplifyGeometry( )
|
||||
{
|
||||
QString myTmpDir = QDir::tempPath() + QDir::separator() ;
|
||||
QString myFileName = myTmpDir + "simplify_layer.shp";
|
||||
QVERIFY( mAnalyzer.simplify( mpLineLayer,
|
||||
myFileName,
|
||||
1.0 ) );
|
||||
QVERIFY( mAnalyzer.simplify( mpLineLayer, myFileName, 1.0 ) );
|
||||
}
|
||||
|
||||
void TestQgsVectorAnalyzer::polygonCentroids( )
|
||||
@ -137,4 +131,3 @@ void TestQgsVectorAnalyzer::layerExtent( )
|
||||
|
||||
QTEST_MAIN( TestQgsVectorAnalyzer )
|
||||
#include "moc_testqgsvectoranalyzer.cxx"
|
||||
|
||||
|
@ -71,11 +71,9 @@ void Regression1141::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
// Instantiate the plugin directory so that providers are loaded
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
// compute our test file name:
|
||||
QString myTmpDir = QDir::tempPath() + QDir::separator() ;
|
||||
mFileName = myTmpDir + "ąęćń.shp";
|
||||
@ -149,6 +147,4 @@ void Regression1141::diacriticalTest()
|
||||
|
||||
|
||||
QTEST_MAIN( Regression1141 )
|
||||
|
||||
#include "moc_regression1141.cxx"
|
||||
|
||||
|
@ -70,7 +70,7 @@ void Regression992::initTestCase()
|
||||
QgsApplication::showSettings();
|
||||
// QgsApplication::skipGdalDriver( "JP2ECW" );
|
||||
// QgsApplication::skipGdalDriver( "JP2MrSID" );
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
QgsApplication::initQgis();
|
||||
|
||||
//create some objects that will be used in all tests...
|
||||
//create a raster layer that will be used in all tests...
|
||||
@ -132,4 +132,3 @@ void Regression992::regression992()
|
||||
|
||||
QTEST_MAIN( Regression992 )
|
||||
#include "moc_regression992.cxx"
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
#***************************************************************************
|
||||
# runtests.sh
|
||||
# --------------------------------------
|
||||
# Date : Sun Sep 16 12:21:45 AKDT 2007
|
||||
# Copyright : (C) 2007 by Gary E. Sherman
|
||||
# Email : sherman at mrcc dot com
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU General Public License as published by *
|
||||
#* the Free Software Foundation; either version 2 of the License, or *
|
||||
#* (at your option) any later version. *
|
||||
#* *
|
||||
#***************************************************************************/
|
||||
|
||||
#set -x
|
||||
LIST=`ls -lah |grep rwxr-xr-x |grep -v ^d |grep -v pl$ |grep -v ~$ |grep -v .sh$ |awk '{print $8}'|awk '$1=$1' RS=`
|
||||
|
||||
TOTALEXES=0
|
||||
TOTALFAILED=0
|
||||
TOTALPASSED=0
|
||||
TOTALSKIPPED=0
|
||||
for FILE in $LIST;
|
||||
do
|
||||
RESULT=`./${FILE} | tail -2 |head -1`
|
||||
PASSED=`echo ${RESULT} | awk '{print $2}'`
|
||||
FAILED=`echo ${RESULT} | awk '{print $4}'`
|
||||
SKIPPED=`echo ${RESULT} | awk '{print $6}'`
|
||||
TOTALFAILED=`expr $TOTALFAILED + $FAILED`
|
||||
TOTALPASSED=`expr $TOTALPASSED + $PASSED`
|
||||
TOTALSKIPPED=`expr $TOTALSKIPPED + $SKIPPED`
|
||||
TOTALEXES=`expr $TOTALEXES + 1`
|
||||
done
|
||||
echo "-------------------------------"
|
||||
echo "TOTAL TESTS : ${TOTALEXES}"
|
||||
echo "-------------------------------"
|
||||
echo "TOTAL TEST CASES PASSED : ${TOTALPASSED}"
|
||||
echo "TOTAL TEST CASES FAILED : ${TOTALFAILED}"
|
||||
echo "TOTAL TEST CASES SKIPPED : ${TOTALSKIPPED}"
|
||||
echo "-------------------------------"
|
@ -1,188 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#***************************************************************************
|
||||
# test_builder.pl
|
||||
# --------------------------------------
|
||||
# Date : Sun Sep 16 12:22:00 AKDT 2007
|
||||
# Copyright : (C) 2007 by Gary E. Sherman
|
||||
# Email : sherman at mrcc dot com
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU General Public License as published by *
|
||||
#* the Free Software Foundation; either version 2 of the License, or *
|
||||
#* (at your option) any later version. *
|
||||
#* *
|
||||
#***************************************************************************/
|
||||
|
||||
use Cwd;
|
||||
|
||||
#####################################################
|
||||
# A script to automate creation of a new unit test
|
||||
# Authors TSutton
|
||||
# April 08, 2006
|
||||
#####################################################
|
||||
# $Id: plugin_builder.pl 5212 2006-04-07 23:21:38Z timlinux $ #
|
||||
|
||||
#make sure we are in a the tests/src/core dir
|
||||
$myDir = fastgetcwd;
|
||||
$sourceDir = "../../../src/core";
|
||||
print "\n\nChecking that we are in the <qgis dir>/test/src/core/ directory....";
|
||||
if ($myDir =~ m/tests\/src\/core$/)
|
||||
{
|
||||
print "yes\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no\n";
|
||||
print $myDir;
|
||||
print "\nPlease relocate to the /test/src/core/ directory before attempting to run this script.\n";
|
||||
exit;
|
||||
}
|
||||
# get the needed information from the user
|
||||
$testClass="";
|
||||
$argCount = $#ARGV+1;
|
||||
if ($argCount > 0)
|
||||
{
|
||||
$testClass=@ARGV[ 0 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\n\nEnter the name of the class for which the test will be created.\n";
|
||||
print "Used mixed case notation.\n";
|
||||
print "e.g. QgsSymbol\n";
|
||||
$testClass =<STDIN>;
|
||||
chop $testClass;
|
||||
}
|
||||
|
||||
$testClassLowerCaseName = lc($testClass); #todo convert to lower case
|
||||
|
||||
#
|
||||
# Check source file is ok
|
||||
#
|
||||
|
||||
if ($testClass eq "")
|
||||
{
|
||||
print "ClassName not supplied ...exiting...";
|
||||
exit;
|
||||
}
|
||||
print "Checking if source class exists in filesystem ...";
|
||||
if (-e "${sourceDir}/${testClassLowerCaseName}.cpp" )
|
||||
{
|
||||
print "yes\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "no, exiting\n";
|
||||
print "${sourceDir}/${testClassLowerCaseName}.cpp does not exist!\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
print "Stubs will be created for the following methods:\n";
|
||||
open CPPFILE, "<$sourceDir/$testClassLowerCaseName.cpp"|| die 'Unable to open header file $testClassLowerCaseName.cpp';
|
||||
$stubString="";
|
||||
$lastLine="";
|
||||
while(<CPPFILE>)
|
||||
{
|
||||
if(m/${testClass}::[A-Za-z0-9]*\(/)
|
||||
{
|
||||
#get the matched part of the line
|
||||
$line = $&;
|
||||
#strip off the ::
|
||||
$line =~ s/:://g;
|
||||
#strip off the (
|
||||
$line =~ s/\(//g;
|
||||
if ($lastLine eq $line)
|
||||
{
|
||||
#duplicate entry
|
||||
}
|
||||
else
|
||||
{
|
||||
#add it to our stub code
|
||||
$stubString = $stubString . " void $line()\n\{\n\n\};\n";
|
||||
#show the user the list
|
||||
print $line;
|
||||
print "\n";
|
||||
}
|
||||
$lastLine=$line;
|
||||
}
|
||||
}
|
||||
$createIt="n";
|
||||
if ($argCount eq 0)
|
||||
{
|
||||
print "-----------------------------\n";
|
||||
print "Create the unit test? [y/n]: ";
|
||||
$createIt = <STDIN>;
|
||||
chop $createIt;
|
||||
}
|
||||
else
|
||||
{
|
||||
$createIt="y";
|
||||
}
|
||||
|
||||
if(($createIt eq 'y') || ($createIt eq 'Y'))
|
||||
{
|
||||
#
|
||||
# its a go -- create the unit test and modify the build files
|
||||
#
|
||||
system("cp test_template.cpp test$testClassLowerCaseName.cpp");
|
||||
|
||||
# Substitute the class name in the file
|
||||
system("perl -pi -e 's/\\\[testClassLowerCaseName\\\]/$testClassLowerCaseName/g' test$testClassLowerCaseName.cpp");
|
||||
system("perl -pi -e 's/\\\[testClassCamelCaseName\\\]/$testClass/g' test$testClassLowerCaseName.cpp");
|
||||
system("perl -pi -e 's/\\\[TestMethods\\\]/$stubString/g' test$testClassLowerCaseName.cpp");
|
||||
# Add an entry to Makefile.am
|
||||
open MAKEFILE, "<./Makefile.am" || die 'Unable to open Makefile.am';
|
||||
open MAKEFILEMOD, ">./Makefile.am.mod" || die 'Unable to create Makefile.am.mod';
|
||||
# read through Makefile.am and write each line to Makefile.am.mod
|
||||
while(<MAKEFILE>)
|
||||
{
|
||||
if(/^\s*bin_PROGRAMS =*/)
|
||||
{
|
||||
# add our application binary name to the next line
|
||||
print MAKEFILEMOD;
|
||||
print MAKEFILEMOD "\t\ttest$testClassLowerCaseName \\\n";
|
||||
}
|
||||
elsif(/^\s*BUILT_SOURCES =*/)
|
||||
{
|
||||
# add our application binary name to the next line
|
||||
print MAKEFILEMOD;
|
||||
print MAKEFILEMOD "\t\t\$(test${testClassLowerCaseName}_MOC) \\\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print MAKEFILEMOD;
|
||||
}
|
||||
}
|
||||
#before closing the file add the lines for our new test class
|
||||
print MAKEFILEMOD "\n";
|
||||
print MAKEFILEMOD "test${testClassLowerCaseName}_MOC = test${testClassLowerCaseName}.moc.cpp\n";
|
||||
print MAKEFILEMOD "test${testClassLowerCaseName}_SOURCES = test${testClassLowerCaseName}.cpp\n";
|
||||
print MAKEFILEMOD "test${testClassLowerCaseName}_LDADD = \$(GLOBALLDADD)\n";
|
||||
print MAKEFILEMOD "test${testClassLowerCaseName}_CXXFLAGS = \$(GLOBALCXXFLAGS)\n";
|
||||
|
||||
# close the Makefile file handles
|
||||
close MAKEFILEMOD;
|
||||
close MAKEFILE;
|
||||
|
||||
# save Makefile.am in case we die before done moving things around
|
||||
system("mv Makefile.am Makefile.am.save");
|
||||
# move the new Makefile.am to where it belongs
|
||||
system("mv Makefile.am.mod Makefile.am");
|
||||
# delete the original Makefile.am
|
||||
unlink("Makefile.am.save");
|
||||
|
||||
|
||||
print << "EOP";
|
||||
|
||||
Your test unit has been created now as ${testClassLowerCaseName}.cpp.
|
||||
|
||||
EOP
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# user cancelled
|
||||
print "Test unit not created\n";
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
#***************************************************************************
|
||||
# test_suite_builder.sh
|
||||
# --------------------------------------
|
||||
# Date : Sun Sep 16 12:22:12 AKDT 2007
|
||||
# Copyright : (C) 2007 by Gary E. Sherman
|
||||
# Email : sherman at mrcc dot com
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU General Public License as published by *
|
||||
#* the Free Software Foundation; either version 2 of the License, or *
|
||||
#* (at your option) any later version. *
|
||||
#* *
|
||||
#***************************************************************************/
|
||||
|
||||
LIST=`ls ../../../src/core/ |grep .cpp |grep ^qgs |grep -v ~$ |grep -v moc.cpp$ | sed 's/.cpp//g' |awk '$1=$1' RS= |sort`
|
||||
for FILE in $LIST
|
||||
do
|
||||
CLASSNAME=`grep -o "::Qgs[A-Za-z0-9]*(" ../../../src/core/${FILE}.cpp |head -1 | sed 's/:://g'| sed 's/(//g'`
|
||||
./test_builder.pl $CLASSNAME
|
||||
#svn add test${FILE}.cpp
|
||||
done
|
||||
make install
|
@ -41,8 +41,8 @@ void TestQgsApplication::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
//QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::init( INSTALL_PREFIX );
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
qDebug( "%s", QgsApplication::showSettings().toUtf8().constData() );
|
||||
};
|
||||
|
||||
|
@ -185,8 +185,8 @@ void TestQgsGeometry::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
mReport += "<h1>Geometry Tests</h1>\n";
|
||||
mReport += "<p><font color=\"green\">Green = polygonA</font></p>\n";
|
||||
|
@ -52,8 +52,8 @@ void TestQgsMapLayer::initTestCase()
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
|
||||
//create some objects that will be used in all tests...
|
||||
//create a map layer that will be used in all tests...
|
||||
@ -71,4 +71,3 @@ void TestQgsMapLayer::isValid()
|
||||
|
||||
QTEST_MAIN( TestQgsMapLayer )
|
||||
#include "moc_testqgsmaplayer.cxx"
|
||||
|
||||
|
@ -78,8 +78,8 @@ void TestQgsMapRenderer::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
|
||||
//create some objects that will be used in all tests...
|
||||
mEncoding = "UTF-8";
|
||||
|
@ -72,8 +72,7 @@ void TestQgsPoint::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::init( INSTALL_PREFIX );
|
||||
QgsApplication::init();
|
||||
QgsApplication::showSettings();
|
||||
mReport += "<h1>Point Tests</h1>\n";
|
||||
}
|
||||
|
@ -66,19 +66,12 @@ void TestQgsRenderers::initTestCase()
|
||||
{
|
||||
mTestHasError = false;
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::init( INSTALL_PREFIX );
|
||||
QgsApplication::initQgis( );
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
// Instantiate the plugin directory so that providers are loaded
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
|
||||
//create some objects that will be used in all tests...
|
||||
|
||||
std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl;
|
||||
|
||||
//
|
||||
//create a point layer that will be used in all tests...
|
||||
@ -225,4 +218,3 @@ bool TestQgsRenderers::imageCheck( QString theTestType )
|
||||
|
||||
QTEST_MAIN( TestQgsRenderers )
|
||||
#include "moc_testqgsrenderers.cxx"
|
||||
|
||||
|
@ -92,8 +92,7 @@ void TestQgsVectorFileWriter::initTestCase()
|
||||
"(the ERROR comes from OGR and is not very intuitive)\n"
|
||||
"******************\n" );
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
|
||||
QgsApplication::init();
|
||||
QgsApplication::showSettings();
|
||||
//create some objects that will be used in all tests...
|
||||
|
||||
|
@ -58,17 +58,11 @@ class TestQgsVectorLayer: public QObject
|
||||
{
|
||||
mTestHasError = false;
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
// Instantiate the plugin directory so that providers are loaded
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
|
||||
//create some objects that will be used in all tests...
|
||||
|
||||
std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl;
|
||||
std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl;
|
||||
|
||||
//
|
||||
//create a non spatial layer that will be used in all tests...
|
||||
//
|
||||
@ -649,7 +643,3 @@ class TestQgsVectorLayer: public QObject
|
||||
|
||||
QTEST_MAIN( TestQgsVectorLayer )
|
||||
#include "moc_testqgsvectorlayer.cxx"
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -211,7 +211,7 @@ int TestZipLayer::getLayerTransparency( QString myFileName, QString myProviderKe
|
||||
void TestZipLayer::initTestCase()
|
||||
{
|
||||
QgsApplication::init();
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
QgsApplication::initQgis();
|
||||
// save data dir
|
||||
mDataDir = QString( TEST_DATA_DIR ) + QDir::separator();
|
||||
// set zipSetting to 1 (Passthru) and save current value
|
||||
@ -358,6 +358,5 @@ void TestZipLayer::testGZipItemRasterTransparency()
|
||||
QVERIFY2(( myTransparency == myTarget ), QString( "Transparency is %1, should be %2" ).arg( myTransparency ).arg( myTarget ).toLocal8Bit().data() );
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN( TestZipLayer )
|
||||
#include "moc_testziplayer.cxx"
|
||||
|
@ -40,8 +40,8 @@ class TestQgsMapToolZoom: public QObject
|
||||
|
||||
void TestQgsMapToolZoom::initTestCase()
|
||||
{
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
|
||||
QgsApplication::init();
|
||||
QgsApplication::initQgis();
|
||||
QgsApplication::showSettings();
|
||||
}
|
||||
|
||||
|
@ -62,11 +62,9 @@ void TestQgsQuickPrint::initTestCase()
|
||||
// Runs once before any tests are run
|
||||
//
|
||||
// init QGIS's paths - true means that all path will be inited from prefix
|
||||
QString qgisPath = QCoreApplication::applicationDirPath();
|
||||
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
|
||||
QgsApplication.init();
|
||||
QgsApplication.initQgis();
|
||||
QgsApplication::showSettings();
|
||||
// Instantiate the plugin directory so that providers are loaded
|
||||
QgsProviderRegistry::instance( QgsApplication::pluginPath() );
|
||||
|
||||
//
|
||||
//create a point layer that will be used in all tests...
|
||||
|
@ -1,156 +0,0 @@
|
||||
#***************************************************************************
|
||||
# runtests.sh
|
||||
# --------------------------------------
|
||||
# Date : Sun Sep 16 12:21:00 AKDT 2007
|
||||
# Copyright : (C) 2007 by Gary E. Sherman
|
||||
# Email : sherman at mrcc dot com
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU General Public License as published by *
|
||||
#* the Free Software Foundation; either version 2 of the License, or *
|
||||
#* (at your option) any later version. *
|
||||
#* *
|
||||
#***************************************************************************/
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
DIRS=`ls -1F | grep '/$'`
|
||||
OUTFILE=/tmp/qgistest.`date +%d%h%Y_%H%M`.html
|
||||
TOTALDIRS=0
|
||||
TOTALEXES=0
|
||||
TOTALFAILED=0
|
||||
TOTALPASSED=0
|
||||
TOTALSKIPPED=0
|
||||
echo "<html>" > ${OUTFILE}
|
||||
echo "<head>" >> ${OUTFILE}
|
||||
echo "<style type="text/css">" >> ${OUTFILE}
|
||||
echo "body {background: white; text-align: center; min-width: 33em; }" >> ${OUTFILE}
|
||||
echo "#wrapper { margin:0 auto; width:33em; text-align: left; }" >> ${OUTFILE}
|
||||
|
||||
echo "h1 {text-align: center;}" >> ${OUTFILE}
|
||||
echo "h2 {text-align: center;}" >> ${OUTFILE}
|
||||
|
||||
echo ".statusPass {background: green; width: 1em; float:left;}" >> ${OUTFILE}
|
||||
echo ".statusFail {background: crimson; width: 1em; float:left;}" >> ${OUTFILE}
|
||||
|
||||
echo ".unitSummary {background: #EFEFEF; width: 20em; float:left;}" >> ${OUTFILE}
|
||||
echo ".unitTotalExes {background: #EFEFEF; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".unitTotalPasses {background: #EFEFEF; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".unitTotalFails {background: #EFEFEF; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".unitTotalSkipped {background: #EFEFEF; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
|
||||
echo ".colSummary {background: #FEB87F; font-weight: bold; width: 21em; float:left;}" >> ${OUTFILE}
|
||||
echo ".colTotalExes {background: #FEB87F;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".colTotalPasses {background: #FEB87F;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".colTotalFails {background: #FEB87F;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".colTotalSkipped {background: #FEB87F;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
|
||||
echo ".module {background: #FF9D4D; width: 33em;}" >> ${OUTFILE}
|
||||
echo ".moduleHeader {background: #EB6E08; font-size: bigger; font-weight: bold; text-align: center; width: 33em; margin-top: 1em; margin-bottom: 0em; }" >> ${OUTFILE}
|
||||
echo ".moduleSummary {background: #FCBA82; font-weight: bold; width: 20em; float:left;}" >> ${OUTFILE}
|
||||
echo ".moduleTotalExes {background: #FCBA82;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".moduleTotalPasses {background: #FCBA82;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".moduleTotalFails {background: #FCBA82;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".moduleTotalSkipped {background: #FCBA82;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
|
||||
echo ".suiteSummary {background: #FF9946; font-weight: bold; width: 20em; float:left;}" >> ${OUTFILE}
|
||||
echo ".suiteTotalExes {background: #FF9946;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".suiteTotalPasses {background: #FF9946;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".suiteTotalFails {background: #FF9946;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
echo ".suiteTotalSkipped {background: #FF9946;font-weight: bold; width: 3em; text-align: center; float:left;}" >> ${OUTFILE}
|
||||
|
||||
echo "</style>" >> ${OUTFILE}
|
||||
echo "</head>" >> ${OUTFILE}
|
||||
echo "<body>" >> ${OUTFILE}
|
||||
echo "<div id="wrapper">" >> ${OUTFILE}
|
||||
echo "<h1>QGIS Unit Tests</h1>" >> ${OUTFILE}
|
||||
echo "<h2>`date +'%d %h %Y : %H h %M'`</h2>" >> ${OUTFILE}
|
||||
for DIR in $DIRS
|
||||
do
|
||||
echo "<div class='module'>" >> ${OUTFILE}
|
||||
echo "<div class='moduleHeader'>Module : ${DIR}</div><br/>" >> ${OUTFILE}
|
||||
#print col headers
|
||||
echo "<div class="colSummary"> </div>" >> ${OUTFILE}
|
||||
echo "<div class="colTotalExes">#</div>" >> ${OUTFILE}
|
||||
echo "<div class="colTotalPasses">P</div>" >> ${OUTFILE}
|
||||
echo "<div class="colTotalFails">F</div>" >> ${OUTFILE}
|
||||
echo "<div class="colTotalSkipped">S</div>" >> ${OUTFILE}
|
||||
echo "<br/>" >> ${OUTFILE}
|
||||
TOTALDIREXES=0
|
||||
TOTALDIRFAILED=0
|
||||
TOTALDIRPASSED=0
|
||||
TOTALDIRSKIPPED=0
|
||||
LIST=`find $DIR -maxdepth 1 -type f -perm +111 | egrep -v '(\.sh$|\.pl$)'`
|
||||
for FILE in $LIST
|
||||
do
|
||||
RESULT=`${FILE} | grep '^Totals:'`
|
||||
PASSED=`echo ${RESULT} | awk '{print $2}'`
|
||||
FAILED=`echo ${RESULT} | awk '{print $4}'`
|
||||
SKIPPED=`echo ${RESULT} | awk '{print $6}'`
|
||||
TOTALDIRFAILED=`expr $TOTALDIRFAILED + $FAILED`
|
||||
TOTALDIRPASSED=`expr $TOTALDIRPASSED + $PASSED`
|
||||
TOTALDIRSKIPPED=`expr $TOTALDIRSKIPPED + $SKIPPED`
|
||||
TOTALDIREXES=`expr $TOTALDIREXES + 1`
|
||||
TOTALFAILED=`expr $TOTALFAILED + $FAILED`
|
||||
TOTALPASSED=`expr $TOTALPASSED + $PASSED`
|
||||
TOTALSKIPPED=`expr $TOTALSKIPPED + $SKIPPED`
|
||||
TOTALEXES=`expr $TOTALEXES + 1`
|
||||
if (( $FAILED ))
|
||||
then
|
||||
echo "<div class="statusFail"> </div>" >> ${OUTFILE}
|
||||
else
|
||||
echo "<div class="statusPass"> </div>" >> ${OUTFILE}
|
||||
fi
|
||||
echo "<div class="unitSummary">$FILE</div>" >> ${OUTFILE}
|
||||
echo "<div class="unitTotalExes"> </div>" >> ${OUTFILE}
|
||||
echo "<div class="unitTotalPasses">$PASSED</div>" >> ${OUTFILE}
|
||||
echo "<div class="unitTotalFails">$FAILED</div>" >> ${OUTFILE}
|
||||
echo "<div class="unitTotalSkipped">$SKIPPED</div>" >> ${OUTFILE}
|
||||
echo "<br/>" >> ${OUTFILE}
|
||||
done
|
||||
TOTALDIRS=`expr $TOTALDIRS + 1`
|
||||
echo "-------------------------------"
|
||||
echo "MODULE : $DIR"
|
||||
echo "-------------------------------"
|
||||
echo "MODULE TESTS : ${TOTALDIREXES}"
|
||||
echo "MODULE TEST CASES PASSED : ${TOTALDIRPASSED}"
|
||||
echo "MODULE TEST CASES FAILED : ${TOTALDIRFAILED}"
|
||||
echo "MODULE TEST CASES SKIPPED : ${TOTALDIRSKIPPED}"
|
||||
if (( $DIRFAILED ))
|
||||
then
|
||||
echo "<div class="statusFail"> </div>" >> ${OUTFILE}
|
||||
else
|
||||
echo "<div class="statusPass"> </div>" >> ${OUTFILE}
|
||||
fi
|
||||
echo "<div class="moduleSummary">Totals:</div>" >> ${OUTFILE}
|
||||
echo "<div class="moduleTotalExes">$TOTALDIREXES</div>" >> ${OUTFILE}
|
||||
echo "<div class="moduleTotalPasses">$TOTALDIRPASSED</div>" >> ${OUTFILE}
|
||||
echo "<div class="moduleTotalFails">$TOTALDIRFAILED</div>" >> ${OUTFILE}
|
||||
echo "<div class="moduleTotalSkipped">$TOTALDIRSKIPPED</div>" >> ${OUTFILE}
|
||||
echo "<br/>" >> ${OUTFILE}
|
||||
echo "</div><!--end of module -->" >> ${OUTFILE}
|
||||
done
|
||||
echo "-------------------------------"
|
||||
echo " TOTALS :"
|
||||
echo "-------------------------------"
|
||||
echo "TOTAL TESTS : ${TOTALEXES}"
|
||||
echo "TOTAL TEST CASES PASSED : ${TOTALPASSED}"
|
||||
echo "TOTAL TEST CASES FAILED : ${TOTALFAILED}"
|
||||
echo "TOTAL TEST CASES SKIPPED : ${TOTALSKIPPED}"
|
||||
echo "<div class='moduleHeader'>Global Summary:</div><br/>" >> ${OUTFILE}
|
||||
if (( $TOTALFAILED ))
|
||||
then
|
||||
echo "<div class="statusFail"> </div>" >> ${OUTFILE}
|
||||
else
|
||||
echo "<div class="statusPass"> </div>" >> ${OUTFILE}
|
||||
fi
|
||||
echo "<div class="suiteSummary">Totals:</div>" >> ${OUTFILE}
|
||||
echo "<div class="suiteTotalExes">$TOTALEXES</div>" >> ${OUTFILE}
|
||||
echo "<div class="suiteTotalPasses">$TOTALPASSED</div>" >> ${OUTFILE}
|
||||
echo "<div class="suiteTotalFails">$TOTALFAILED</div>" >> ${OUTFILE}
|
||||
echo "<div class="suiteTotalSkipped">$TOTALSKIPPED</div>" >> ${OUTFILE}
|
||||
echo "<br/>" >> ${OUTFILE}
|
||||
echo "</div> <!-- end of wrapper -->" >> ${OUTFILE}
|
||||
echo "</body>" >> ${OUTFILE}
|
||||
echo "</html>" >> ${OUTFILE}
|
||||
firefox ${OUTFILE}
|
Loading…
x
Reference in New Issue
Block a user