Skip to content
Snippets Groups Projects
Commit e8f15c93 authored by Jan Möbius's avatar Jan Möbius
Browse files

Moved tests directory into OpenFlipper subdir

parent 50a782b4
No related branches found
No related tags found
No related merge requests found
Showing
with 23474 additions and 0 deletions
# Include Testing package
INCLUDE(CTest)
if(BUILD_TESTING)
SET (CTEST_DROP_SITE_CDASH FALSE)
# ========================================================================
# Copy converter files from ctest output to correctly generate xml output
# ========================================================================
if ( WIN32 )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run_tests.bat
${CMAKE_BINARY_DIR}/tests/run_tests.bat COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/head.bat
${CMAKE_BINARY_DIR}/tests/head.bat COPYONLY)
else(WIN32)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run_tests.sh
${CMAKE_BINARY_DIR}/tests/run_tests.sh COPYONLY)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/globalTestFiles/cube1.obj
${OPENFLIPPER_TEST_FILES}/cube1.obj COPYONLY)
make_directory(${OPENFLIPPER_TEST_RESULTS})
make_directory(${OPENFLIPPER_TEST_BINARIES})
# ========================================================================
# ========================================================================
# ========================================================================
# Run OpenMesh tests
# ========================================================================
# ========================================================================
# ========================================================================
if ( NOT DEFINED OPENFLIPPER_BUILD_UNIT_TESTS )
set( OPENFLIPPER_BUILD_UNIT_TESTS false CACHE BOOL "Enable or disable unit tests on all integrated libraries." )
endif()
if ( OPENFLIPPER_BUILD_UNIT_TESTS )
#enable the OpenMesh unit tests
set (OPENMESH_BUILD_UNIT_TESTS true CACHE BOOL "Enable or disable unit test builds in OpenMesh.")
#enable the ACG unit tests
set (ACG_BUILD_UNIT_TESTS true CACHE BOOL "Enable or disable unit test builds in ACG.")
find_package(GoogleTest)
if(GTEST_FOUND)
add_subdirectory(${CMAKE_SOURCE_DIR}/OpenFlipper/libs_required/OpenMesh/src/Unittests ${CMAKE_BINARY_DIR}/OpenFlipper/libs_required/OpenMesh/src/Unittests)
endif()
endif()
# ========================================================================
# ========================================================================
# Internal global tests start here
# ========================================================================
# ========================================================================
# ========================================================================
# ========================================================================
# ========================================================================
# Add tests from subdirectories
# ========================================================================
# ========================================================================
# ========================================================================
# search all libs in the libs directory
file (
GLOB _local_tests_in
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt"
)
# add all found tests to the build
foreach (_localTest ${_local_tests_in})
get_filename_component (_local_test_dir ${_localTest} PATH)
add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/${_local_test_dir})
endforeach ()
# ========================================================================
# ========================================================================
# ========================================================================
# Start OpenFlipper Headless in batch mode, to see if all plugins
# that pretend to be scriptable without ui are correct and the core
# can start
# ========================================================================
# ========================================================================
# ========================================================================
ADD_TEST(BatchStart "${OPENFLIPPER_EXECUTABLE}" -b -c )
# Timeout after 60 seconds if we havean endless loop
# Should be run serial to avoid collisons with other instances
# Only one processor required
set_tests_properties (
BatchStart PROPERTIES
TIMEOUT 180
RUN_SERIAL TRUE
PROCESSORS 1
)
# ========================================================================
# ========================================================================
# ========================================================================
# Add tests from plugins
# ========================================================================
# ========================================================================
# ========================================================================
file (
GLOB _plugins_in
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/PluginCollection-*/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/Package-*/Plugin-*/CMakeLists.txt"
"${CMAKE_SOURCE_DIR}/Package-*/PluginCollection-*/Plugin-*/CMakeLists.txt"
)
foreach (_plugin ${_plugins_in})
get_filename_component (_plugin_dir ${_plugin} PATH)
# If a test subdir exists, we add it here
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${_plugin_dir}/tests)
# Only get the plugins name without possible collection:
string (REGEX MATCH "Plugin-.+[/\\]?$" _plugin_name ${_plugin_dir})
add_subdirectory(${CMAKE_SOURCE_DIR}/${_plugin_dir}/tests ${CMAKE_BINARY_DIR}/tests/${_plugin_name} )
endif()
endforeach ()
endif()
from lxml import etree
import StringIO
import sys
TAGfile = open("./Testing/TAG", 'r')
dirname = TAGfile.readline().strip()
xmlfile = open("./Testing/"+dirname+"/Test.xml", 'r')
xslfile = open("CTest2JUnit.xsl", 'r')
xmlcontent = xmlfile.read()
xslcontent = xslfile.read()
xmldoc = etree.parse(StringIO.StringIO(xmlcontent))
xslt_root = etree.XML(xslcontent)
transform = etree.XSLT(xslt_root)
result_tree = transform(xmldoc)
print(result_tree)
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/Site">
<testsuite>
<xsl:variable name="BuildName"><xsl:value-of select="@BuildName"/></xsl:variable>
<xsl:variable name="BuildStamp"><xsl:value-of select="@BuildStamp"/></xsl:variable>
<xsl:variable name="Name"><xsl:value-of select="@Name"/></xsl:variable>
<xsl:variable name="Generator"><xsl:value-of select="@Generator"/></xsl:variable>
<xsl:variable name="CompilerName"><xsl:value-of select="@CompilerName"/></xsl:variable>
<xsl:variable name="OSName"><xsl:value-of select="@OSName"/></xsl:variable>
<xsl:variable name="Hostname"><xsl:value-of select="@Hostname"/></xsl:variable>
<xsl:variable name="OSRelease"><xsl:value-of select="@OSRelease"/></xsl:variable>
<xsl:variable name="OSVersion"><xsl:value-of select="@OSVersion"/></xsl:variable>
<xsl:variable name="OSPlatform"><xsl:value-of select="@OSPlatform"/></xsl:variable>
<xsl:variable name="Is64Bits"><xsl:value-of select="@Is64Bits"/></xsl:variable>
<xsl:variable name="VendorString"><xsl:value-of select="@VendorString"/></xsl:variable>
<xsl:variable name="VendorID"><xsl:value-of select="@VendorID"/></xsl:variable>
<xsl:variable name="FamilyID"><xsl:value-of select="@FamilyID"/></xsl:variable>
<xsl:variable name="ModelID"><xsl:value-of select="@ModelID"/></xsl:variable>
<xsl:variable name="ProcessorCacheSize"><xsl:value-of select="@ProcessorCacheSize"/></xsl:variable>
<xsl:variable name="NumberOfLogicalCPU"><xsl:value-of select="@NumberOfLogicalCPU"/></xsl:variable>
<xsl:variable name="NumberOfPhysicalCPU"><xsl:value-of select="@NumberOfPhysicalCPU"/></xsl:variable>
<xsl:variable name="TotalVirtualMemory"><xsl:value-of select="@TotalVirtualMemory"/></xsl:variable>
<xsl:variable name="TotalPhysicalMemory"><xsl:value-of select="@TotalPhysicalMemory"/></xsl:variable>
<xsl:variable name="LogicalProcessorsPerPhysical"><xsl:value-of select="@LogicalProcessorsPerPhysical"/></xsl:variable>
<xsl:variable name="ProcessorClockFrequency"><xsl:value-of select="@ProcessorClockFrequency"/></xsl:variable>
<properties>
<property name="BuildName" value="{$BuildName}" />
<property name="BuildStamp" value="{$BuildStamp}" />
<property name="Name" value="{$Name}" />
<property name="Generator" value="{$Generator}" />
<property name="CompilerName" value="{$CompilerName}" />
<property name="OSName" value="{$OSName}" />
<property name="Hostname" value="{$Hostname}" />
<property name="OSRelease" value="{$OSRelease}" />
<property name="OSVersion" value="{$OSVersion}" />
<property name="OSPlatform" value="{$OSPlatform}" />
<property name="Is64Bits" value="{$Is64Bits}" />
<property name="VendorString" value="{$VendorString}" />
<property name="VendorID" value="{$VendorID}" />
<property name="FamilyID" value="{$FamilyID}" />
<property name="ModelID" value="{$ModelID}" />
<property name="ProcessorCacheSize" value="{$ProcessorCacheSize}" />
<property name="NumberOfLogicalCPU" value="{$NumberOfLogicalCPU}" />
<property name="NumberOfPhysicalCPU" value="{$NumberOfPhysicalCPU}" />
<property name="TotalVirtualMemory" value="{$TotalVirtualMemory}" />
<property name="TotalPhysicalMemory" value="{$TotalPhysicalMemory}" />
<property name="LogicalProcessorsPerPhysical" value="{$LogicalProcessorsPerPhysical}" />
<property name="ProcessorClockFrequency" value="{$ProcessorClockFrequency}" />
</properties>
<xsl:apply-templates select="Testing/Test"/>
<system-out>
BuildName: <xsl:value-of select="$BuildName" />
BuildStamp: <xsl:value-of select="$BuildStamp" />
Name: <xsl:value-of select="$Name" />
Generator: <xsl:value-of select="$Generator" />
CompilerName: <xsl:value-of select="$CompilerName" />
OSName: <xsl:value-of select="$OSName" />
Hostname: <xsl:value-of select="$Hostname" />
OSRelease: <xsl:value-of select="$OSRelease" />
OSVersion: <xsl:value-of select="$OSVersion" />
OSPlatform: <xsl:value-of select="$OSPlatform" />
Is64Bits: <xsl:value-of select="$Is64Bits" />
VendorString: <xsl:value-of select="$VendorString" />
VendorID: <xsl:value-of select="$VendorID" />
FamilyID: <xsl:value-of select="$FamilyID" />
ModelID: <xsl:value-of select="$ModelID" />
ProcessorCacheSize: <xsl:value-of select="$ProcessorCacheSize" />
NumberOfLogicalCPU: <xsl:value-of select="$NumberOfLogicalCPU" />
NumberOfPhysicalCPU: <xsl:value-of select="$NumberOfPhysicalCPU" />
TotalVirtualMemory: <xsl:value-of select="$TotalVirtualMemory" />
TotalPhysicalMemory: <xsl:value-of select="$TotalPhysicalMemory" />
LogicalProcessorsPerPhysical: <xsl:value-of select="$LogicalProcessorsPerPhysical" />
ProcessorClockFrequency: <xsl:value-of select="$ProcessorClockFrequency" />
</system-out>
</testsuite>
</xsl:template>
<xsl:template match="Testing/Test">
<xsl:variable name="testcasename"><xsl:value-of select= "Name"/></xsl:variable>
<xsl:variable name="exectime">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Execution Time'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<testcase name="{$testcasename}" classname="TestSuite" time="{$exectime}">
<xsl:if test="@Status = 'passed'">
</xsl:if>
<xsl:if test="@Status = 'failed'">
<xsl:variable name="failtype">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Code'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="failcode">
<xsl:for-each select="Results/NamedMeasurement">
<xsl:if test="@name = 'Exit Value'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<error message="{$failtype} ({$failcode})"><xsl:value-of select="Results/Measurement/Value/text()" /></error>
</xsl:if>
<xsl:if test="@Status = 'notrun'">
<skipped><xsl:value-of select="Results/Measurement/Value/text()" /></skipped>
</xsl:if>
</testcase>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
if(BUILD_TESTING)
add_executable (minimalExecutionTest minimalExecutionTest.cc )
set_target_properties( minimalExecutionTest PROPERTIES
RUNTIME_OUTPUT_NAME "minimalExecTest"
RUNTIME_OUTPUT_DIRECTORY "${OPENFLIPPER_TEST_BINARIES}"
LIBRARY_OUTPUT_DIRECTORY "${OPENFLIPPER_TEST_BINARIES}"
)
if (WIN32)
add_custom_command (TARGET minimalExecutionTest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${OPENFLIPPER_TEST_BINARIES}/${CMAKE_CFG_INTDIR}/minimalExecTest.exe
${OPENFLIPPER_TEST_BINARIES}/minimalExecTest.exe)
GROUP_PROJECT(minimalExecutionTest Tests)
endif()
ADD_TEST(NAME "Minimal_Execution_Test"
COMMAND ${OPENFLIPPER_TEST_BINARIES}/minimalExecTest )
set_tests_properties( Minimal_Execution_Test PROPERTIES
TIMEOUT 10
)
endif()
// C++ Minimal execution test
#include <iostream>
class test {
public:
test() {
std::cout << "Constructor Minimal execution test" << std::endl;
};
};
int main()
{
test a;
std::cout << "Minimal execution test!";
return 0;
}
if(BUILD_TESTING)
FIND_PACKAGE( Qt5Widgets REQUIRED QUIET )
add_executable (compareTool compareTool.cc )
GROUP_PROJECT(compareTool Tests)
target_link_libraries (compareTool
${QT_LIBRARIES}
)
set_target_properties ( compareTool PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${OPENFLIPPER_TEST_BINARIES}"
LIBRARY_OUTPUT_DIRECTORY "${OPENFLIPPER_TEST_BINARIES}"
)
if (WIN32)
add_custom_command (TARGET compareTool POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${OPENFLIPPER_TEST_BINARIES}/${CMAKE_CFG_INTDIR}/compareTool.exe
${OPENFLIPPER_TEST_BINARIES}/compareTool.exe)
endif()
endif()
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#include <QString>
#include <QStringList>
#include <QSettings>
#include <QFileInfo>
#include <QTextStream>
#include <cmath>
#include <limits>
#include <iostream>
/* Test File specification:
Doubles can be given as:
Exact test:
VALUE_DOUBLE=1.0
Tolerance test (0.0001)
VALUE_DOUBLE=1.0,0.0001
*/
bool compareDouble(QString _key , QVariant _result, QVariant _reference) {
// maximal allowed double tolerance
double tolerance = std::numeric_limits<double>::epsilon();
// Check if the reference consists of two colon separated values
// Second value would specify maximal allowed tolerance
QStringList referenceData = _reference.toString().split(':');
if ( referenceData.size() == 2) {
tolerance = referenceData[1].toDouble();
}
double result = _result.toDouble();
double reference = referenceData[0].toDouble();
if ( fabs(result-reference) <= tolerance ) {
return true;
} else {
//qcerr.setRealNumberPrecision(40);
std::cerr.precision(40);
std::cerr << "===================================================================\n";
std::cerr << "Comparison failed for key " << _key.toStdString() << " :\n";
std::cerr << "Result: " << result << "\n";
std::cerr << "Expected: " << reference << "\n";
std::cerr << "Difference: " << fabs(result-reference) << "\n";
std::cerr << "Allowed tolerance was: " << tolerance << "\n";
std::cerr << "===================================================================\n";
return false;
}
}
bool compareString(QString _key ,QVariant _result, QVariant _reference) {
QString resultStr = _result.toString().simplified();
QString resultRef = _reference.toString().simplified();
if (resultStr == resultRef ) {
return true;
} else {
std::cerr << "Comparison failed for key " << _key.toStdString() << " :\n";
std::cerr << "Result: " << resultStr.toStdString() << " ; Expected: " << resultRef.toStdString() << "\n";
return false;
}
}
int main(int argv, char **args)
{
std::cout << "============================================================\n" ;
std::cout << "Executing compare tool\n";
std::cout << "Comparing results to reference:\n" ;
// Flag if everything went fine
bool ok = true;
// Return if we did not get exactly two arguments
if ( argv != 3 ) {
std::cerr << "Wrong number of arguments!\n";
std::cerr << "Usage:\n";
std::cerr << "compareTool ResultFile ReferenceFile\n";
return(1);
}
QString file1(args[1]);
QString file2(args[2]);
QFileInfo resultFileInfo(file1);
if ( !resultFileInfo.exists() ) {
std::cerr << "ERROR! Result file: " << file1.toStdString() << " does not exist!\n";
return 1;
}
QFileInfo referenceFileInfo(file2);
if ( !referenceFileInfo.exists() ) {
std::cerr << "ERROR! Reference file: " << file2.toStdString() << " does not exist!\n";
return 1;
}
QSettings resultFile(file1,QSettings::IniFormat);
QSettings referenceFile(file2,QSettings::IniFormat);
if ( resultFile.status() != QSettings::NoError) {
std::cerr << "QSettings error when opening result file: " << file1.toStdString() << "\n";
return 1;
}
if ( referenceFile.status() != QSettings::NoError) {
std::cerr << "QSettings error when opening result reference file: " << file2.toStdString() << "\n";
return 1;
}
QStringList toplevelKeys = referenceFile.childKeys();
QStringList groups = referenceFile.childGroups();
if ( groups.size() == 0 ) {
for ( int i = 0 ; i < toplevelKeys.size(); ++i) {
if ( resultFile.contains(toplevelKeys[i]) ) {
if ( toplevelKeys[i].endsWith("_DOUBLE") ) {
ok &= compareDouble(toplevelKeys[i],resultFile.value(toplevelKeys[i]), referenceFile.value(toplevelKeys[i]));
} else
ok &= compareString( toplevelKeys[i],resultFile.value(toplevelKeys[i]), referenceFile.value(toplevelKeys[i]));
} else {
std::cerr << "Missing key in result file: " << toplevelKeys[i].toStdString() << "\n";
ok = false;
}
}
} else {
std::cerr << "Multiple levels!" << "\n";
return 1;
}
if ( ! ok ) {
std::cerr << "At least one of the tests failed!\n";
return 1;
}
return(0);
}
// Plugin-PoissonReconstruction General suppressions
negativeIndex:Plugin-PoissonReconstruction/PoissonReconstruction/BSplineData.h:39
negativeIndex:Plugin-PoissonReconstruction/PoissonReconstruction/BSplineData.h:40
bufferAccessOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/BSplineData.h:41
memsetZeroBytes:Plugin-PoissonReconstruction/PoissonReconstruction/BSplineData.h:41
arrayIndexOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/BSplineData.h:42
arrayIndexOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/BSplineData.h:43
bufferAccessOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:38
bufferAccessOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:42
arrayIndexOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:59
arrayIndexOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:70
bufferAccessOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:109
arrayIndexOutOfBounds:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:296
negativeIndex:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:37
negativeIndex:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl:75
memsetZeroBytes:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.inl
negativeIndex:Plugin-PoissonReconstruction/PoissonReconstruction/Polynomial.h:37
// Plugin-FileOBJ: False positives in branches without spline support
unusedVariable:PluginCollection-FilePlugins/Plugin-FileOBJ/FileOBJ.cc:584
unusedVariable:PluginCollection-FilePlugins/Plugin-FileOBJ/FileOBJ.cc:585
// OpenVolumeMesh: False positives
uselessCallsRemove:libs_required/OpenVolumeMesh/src/OpenVolumeMesh/Core/TopologyKernel.cc:479
uselessCallsRemove:libs_required/OpenVolumeMesh/src/OpenVolumeMesh/Core/TopologyKernel.cc:480
uselessCallsRemove:libs_required/OpenVolumeMesh/src/OpenVolumeMesh/Core/TopologyKernel.cc:507
uselessCallsRemove:libs_required/OpenVolumeMesh/src/OpenVolumeMesh/Core/TopologyKernel.cc:509
// OpenMesh: Tutorial warnings
redundantAssignment:libs_required/OpenMesh/Doc/Tutorial/09-persistence/fill_props.hh
// OpenFlipper Core: False positives due to undetected dependencies
unnecessaryForwardDeclaration:OpenFlipper/common/BaseObjectData.hh:81
unnecessaryForwardDeclaration:OpenFlipper/common/BaseObjectData.hh:87
redundantAssignment:OpenFlipper/LicenseManager/LicenseManagerActive.cc:310
// purgedConfiguration
purgedConfiguration
// Missing includes from system libraries
missingIncludeSystem
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<testsuites>
<xsl:variable name="buildName" select="//Site/@BuildName"/>
<xsl:variable name="numberOfTests" select="count(//Site/Testing/Test)"/>
<xsl:variable name="numberOfFailures" select="count(//Site/Testing/Test[@Status!='passed'])" />
<testsuite name="CTest"
tests="{$numberOfTests}" time="0"
failures="{$numberOfFailures}" errors="0"
skipped="0">
<xsl:for-each select="//Site/Testing/Test">
<xsl:variable name="testName" select="translate(Name, '-', '_')"/>
<xsl:variable name="duration" select="Results/NamedMeasurement[@name='Execution Time']/Value"/>
<xsl:variable name="status" select="@Status"/>
<xsl:variable name="output" select="Results/Measurement/Value"/>
<xsl:variable name="className" select="translate(Path, '/.', '.')"/>
<testcase classname="projectroot{$className}"
name="{$testName}"
time="{$duration}">
<xsl:if test="@Status!='passed'">
<failure>
<xsl:value-of select="$output" />
</failure>
</xsl:if>
<system-out>
<xsl:value-of select="$output" />
</system-out>
</testcase>
</xsl:for-each>
</testsuite>
</testsuites>
</xsl:template>
</xsl:stylesheet>
var file = @FILEPLUGIN@.loadObject("@OPENFLIPPER_TEST_FILES@/@TEST_FILE@");
var name = datacontrol.getObjectName(file);
var vertexCount = infomeshobject.vertexCount(file);
var edgeCount = infomeshobject.edgeCount(file);
var faceCount = infomeshobject.faceCount(file);
var componentCount = infomeshobject.componentCount(file)
var groupCount = datacontrol.groupCount();
printToFile("@OUTPUT_TEST_DATA_FILE@","TESTNAME=@TESTNAME@");
printToFile("@OUTPUT_TEST_DATA_FILE@","LOADEDFILE=@OPENFLIPPER_TEST_FILES@/@TEST_FILE@");
printToFile("@OUTPUT_TEST_DATA_FILE@","OBJECTNAME=",name);
printToFile("@OUTPUT_TEST_DATA_FILE@","VERTEXCOUNT=",vertexCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","EDGECOUNT=",edgeCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","FACECOUNT=",faceCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","COMPONENTCOUNT=",componentCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","GROUPCOUNT=",groupCount);
core.exitApplication();
var file = @FILEPLUGIN@.loadObject("@OPENFLIPPER_TEST_FILES@/@TEST_FILE@");
var name = datacontrol.getObjectName(file);
var groupCount = datacontrol.groupCount();
var jointCount = infoskeletonobject.jointCount(file)
var branchCount = infoskeletonobject.branchCount(file)
var leafCount = infoskeletonobject.leafCount(file);
printToFile("@OUTPUT_TEST_DATA_FILE@","TEST=@TESTNAME@");
printToFile("@OUTPUT_TEST_DATA_FILE@","LOADEDFILE=@OPENFLIPPER_TEST_FILES@/@TEST_FILE@");
printToFile("@OUTPUT_TEST_DATA_FILE@","OBJECTNAME=",name);
printToFile("@OUTPUT_TEST_DATA_FILE@","GROUPCOUNT=",groupCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","BRANCHCOUNT=",branchCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","LEAFCOUNT=",leafCount);
core.exitApplication();
var file = @FILEPLUGIN@.loadObject("@OPENFLIPPER_TEST_FILES@/@TEST_FILE@");
var name = datacontrol.getObjectName(file);
var vertexCount = infovolumemeshobject.vertexCount(file);
var edgeCount = infovolumemeshobject.edgeCount(file);
var faceCount = infovolumemeshobject.faceCount(file);
var cellCount = infovolumemeshobject.cellCount(file)
printToFile("@OUTPUT_TEST_DATA_FILE@","TESTNAME=@TESTNAME@");
printToFile("@OUTPUT_TEST_DATA_FILE@","LOADEDFILE=@OPENFLIPPER_TEST_FILES@/@TEST_FILE@");
printToFile("@OUTPUT_TEST_DATA_FILE@","OBJECTNAME=",name);
printToFile("@OUTPUT_TEST_DATA_FILE@","VERTEXCOUNT=",vertexCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","EDGECOUNT=",edgeCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","FACECOUNT=",faceCount);
printToFile("@OUTPUT_TEST_DATA_FILE@","CELLCOUNT=",cellCount);
core.exitApplication();
This diff is collapsed.
@echo off
setlocal enabledelayedexpansion
if [%1] == [] goto usage
if [%2] == [] goto usage
SET /a counter=0
for /f "usebackq delims=" %%a in (%2) do (
if "!counter!"=="%1" goto exit
echo %%a
set /a counter+=1
)
goto exit
:usage
echo Usage: head.bat COUNT FILENAME
:exit
#!/bin/sh
for i in $(find . -name "*.png"); do
if ( identify -verbose $i | grep -q iCCP ) then
echo "BAD: $i"
#convert $i -strip $i
fi
done
cppcheck --xml \
--verbose \
--xml-version=2 \
--quiet \
-i libs_required/OpenMesh/src/OpenMesh \
-i libs_required/OpenMesh/src/OpenVolumeMesh \
-i Plugin-MemInfo/procps \
-i Plugin-PoissonReconstruction \
-i build-release \
-i build-debug \
-i .svn \
--force \
-UDOXY_IGNORE_THIS \
--suppress=unusedPrivateFunction \
--suppress=ConfigurationNotChecked \
--suppressions-list=tests/cppcheck-suppressions.txt \
--enable=style \
--enable=performance \
--enable=portability \
--enable=information \
--enable=missingInclude -j2 \
. 2> cppcheck-result.xml
#--enable=all
# some argument checking:
# test_cmd is the command to run with all its arguments
if( NOT test_cmd )
message( FATAL_ERROR "Variable test_cmd not defined" )
endif( NOT test_cmd )
# output_test contains the name of the output file the test_cmd will produce
if( NOT output_test )
message( FATAL_ERROR "Variable output_test not defined" )
endif( NOT output_test )
# output_test contains the info about the loaded file
if( NOT test_file_info )
message( FATAL_ERROR "Variable test_file_info not defined" )
endif( NOT test_file_info )
if( NOT result_checker )
message( FATAL_ERROR "Variable result_checker not defined" )
endif( NOT result_checker )
# convert the space-separated string to a list
separate_arguments( test_args )
# ===================================================
# Run OpenFlipper with the given script
# ===================================================
if ( NOT EXISTS ${test_cmd} )
message("Unable to find test command : ${test_cmd}")
message(SEND_ERROR "Test Executable missing!")
endif()
# clear previous test results
if ( EXISTS ${output_test} )
file(REMOVE ${output_test})
endif()
# Execute the process with the given arguments
# Timeout after 5 minutes
execute_process(
COMMAND ${test_cmd} ${test_args}
TIMEOUT 300
RESULT_VARIABLE PROCESSRESULT
)
if ( NOT ${PROCESSRESULT} EQUAL 0 )
message("Problem when executing proccess. Return code was ${PROCESSRESULT}")
message("Test command: ${test_cmd} ${test_args}")
message(SEND_ERROR "Process execution failed!")
endif()
# ===================================================
# Compare
# ===================================================
if ( WIN32 )
set(result_checker "${result_checker}.exe")
endif()
if ( NOT EXISTS ${result_checker} )
message("Unable to find result checkr : ${result_checker}")
message(SEND_ERROR "Result checker missing!")
endif()
message( "Executing: ${result_checker} ${output_test} ${test_file_info} " )
# Timeout after 2 minutes
execute_process(
COMMAND ${result_checker} ${output_test} ${test_file_info}
TIMEOUT 60
RESULT_VARIABLE PROCESSRESULT
)
if ( NOT ${PROCESSRESULT} EQUAL 0 )
message(SEND_ERROR "Compare Tool execution failed!")
set(test_not_successful TRUE)
endif()
if( test_not_successful )
message( SEND_ERROR "Test Failed! See messages above to see what went wrong!" )
endif( test_not_successful )
# some argument checking:
# test_cmd is the command to run with all its arguments
if( NOT test_cmd )
message( FATAL_ERROR "Variable test_cmd not defined" )
endif( NOT test_cmd )
# convert the space-separated string to a list
separate_arguments( test_args )
# ===================================================
# Run OpenFlipper with the given script
# ===================================================
if ( NOT EXISTS ${test_cmd} )
message("Unable to find test command : ${test_cmd}")
message(SEND_ERROR "Test Executable missing!")
endif()
# Execute the process with the given arguments
# Timeout after 5 minutes
execute_process(
COMMAND ${test_cmd} ${test_args}
TIMEOUT 300
RESULT_VARIABLE PROCESSRESULT
)
if ( NOT ${PROCESSRESULT} EQUAL 0 )
message("Problem when executing proccess. Return code was ${PROCESSRESULT}")
message("Test command: ${test_cmd} ${test_args}")
message(SEND_ERROR "Process execution failed!")
endif()
REM Add the cmake path
set PATH=%PATH%;C:\Program Files (x86)\CMake\bin\
REM Run tests from toplevel build dir
cd ..
REM Delete old test results which are generated by OpenFlipper
del /Q tests\testResults\*
REM Delete old test result collection generated by ctest
del /Q CTestResults.xml
REM Run the tests
ctest -D ExperimentalTest -C Release --no-compress-output
REM Call head on the TAG to get the current folder where the test results are
FOR /F "tokens=1 delims= " %%i IN ('tests\head.bat 1 Testing\TAG') DO @set result=%%i
REM Go into that folder
cd Testing
cd %result%
REM copy generated xml results file to the location where jenkins expects it
copy /Y Test.xml ..\..\CTestResults.xml
REM Go back to start directory
REM cd ..
REM cd ..
#!/bin/sh
#remove old results
rm -f testResults/*
#Run tests
cd ..
CTEST_BINARY=ctest
if [ $(uname) == Darwin ]; then
CTEST_BINARY=/opt/local/bin/ctest
fi
$CTEST_BINARY -D ExperimentalTest --no-compress-output
cp Testing/`head -n 1 Testing/TAG`/Test.xml CTestResults.xml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment