mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
Add -ignore <file> option to get rid of DOS script issues.
Rollback to previous rendering.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="debug_shared|Win32">
|
||||
@@ -125,7 +125,6 @@
|
||||
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_NO_AUTOMATIC_LIBS;CppUnit_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
@@ -136,7 +135,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\bin\PocoCppUnitd.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
@@ -156,7 +156,7 @@
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_NO_AUTOMATIC_LIBS;CppUnit_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_NO_AUTOMATIC_LIBS;CppUnit_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
@@ -167,7 +167,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>..\bin\PocoCppUnit.dll</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
@@ -186,7 +187,6 @@
|
||||
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;POCO_STATIC;POCO_NO_AUTOMATIC_LIBS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
@@ -198,7 +198,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>..\lib\PocoCppUnitMTd.lib</OutputFile>
|
||||
</Lib>
|
||||
@@ -222,7 +223,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>..\lib\PocoCppUnitMT.lib</OutputFile>
|
||||
</Lib>
|
||||
@@ -233,7 +235,6 @@
|
||||
<AdditionalIncludeDirectories>.\include;..\Foundation\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;POCO_STATIC;POCO_NO_AUTOMATIC_LIBS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
@@ -245,7 +246,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>..\lib\PocoCppUnitMDd.lib</OutputFile>
|
||||
</Lib>
|
||||
@@ -270,7 +272,8 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat />
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation></ClCompile>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>..\lib\PocoCppUnitMD.lib</OutputFile>
|
||||
</Lib>
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
void addTest(const std::string& name, Test* test);
|
||||
|
||||
protected:
|
||||
bool run(Test* test);
|
||||
bool run(Test* test, const std::string& ignore);
|
||||
void printBanner();
|
||||
void print(const std::string& name, Test* pTest, int indent);
|
||||
Test* find(const std::string& name, Test* pTest, const std::string& testName);
|
||||
|
||||
@@ -20,7 +20,9 @@ class CppUnit_API TextTestResult: public TestResult
|
||||
{
|
||||
public:
|
||||
TextTestResult();
|
||||
TextTestResult(const std::string& ignore);
|
||||
TextTestResult(std::ostream& ostr);
|
||||
TextTestResult(std::ostream& ostr, const std::string& ignore);
|
||||
|
||||
virtual void addError(Test* test, CppUnitException* e);
|
||||
virtual void addFailure(Test* test, CppUnitException* e);
|
||||
@@ -33,6 +35,7 @@ public:
|
||||
protected:
|
||||
std::string shortName(const std::string& testName);
|
||||
void setup();
|
||||
void ignoring(const std::string ignore);
|
||||
|
||||
private:
|
||||
std::ostream& _ostr;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "CppUnit/TextTestResult.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
@@ -35,7 +36,7 @@ TestRunner::~TestRunner()
|
||||
void TestRunner::printBanner()
|
||||
{
|
||||
_ostr
|
||||
<< "Usage: driver [-all] [-long] [-print] [-wait] [name] ..." << std::endl
|
||||
<< "Usage: driver [-all] [-ignore <file> ] [-long] [-print] [-wait] [name] ..." << std::endl
|
||||
<< " where name is the name of a test case class" << std::endl;
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
bool wait = false;
|
||||
bool printed = false;
|
||||
bool long_running = false;
|
||||
std::string ignore;
|
||||
|
||||
std::vector<std::string> setup;
|
||||
|
||||
@@ -71,6 +73,11 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
long_running = true;
|
||||
continue;
|
||||
}
|
||||
else if (arg == "-ignore")
|
||||
{
|
||||
ignore = args[++i];
|
||||
continue;
|
||||
}
|
||||
else if (arg == "-print")
|
||||
{
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
@@ -114,7 +121,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "ignore file:" << ignore << std::endl;
|
||||
if (all)
|
||||
{
|
||||
tests.clear();
|
||||
@@ -131,7 +138,7 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
continue;
|
||||
if (setup.size() > 0)
|
||||
testToRun->addSetup(setup);
|
||||
if (!run(testToRun)) success = false;
|
||||
if (!run(testToRun, ignore)) success = false;
|
||||
numberOfTests++;
|
||||
}
|
||||
|
||||
@@ -151,9 +158,9 @@ bool TestRunner::run(const std::vector<std::string>& args)
|
||||
}
|
||||
|
||||
|
||||
bool TestRunner::run(Test* test)
|
||||
bool TestRunner::run(Test* test, const std::string& ignore)
|
||||
{
|
||||
TextTestResult result(_ostr);
|
||||
TextTestResult result(_ostr, ignore);
|
||||
|
||||
test->run(&result);
|
||||
_ostr << result << std::endl;
|
||||
|
||||
@@ -8,17 +8,47 @@
|
||||
#include "CppUnit/Test.h"
|
||||
#include "CppUnit/estring.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
#include <exception>
|
||||
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
|
||||
|
||||
TextTestResult::TextTestResult() :
|
||||
_ostr(std::cout)
|
||||
{
|
||||
}
|
||||
TextTestResult::TextTestResult(const std::string& ignore):
|
||||
_ostr(std::cout)
|
||||
{
|
||||
if (!ignore.empty())
|
||||
{
|
||||
try {
|
||||
std::ifstream ifs(ignore);
|
||||
if (ifs.is_open()) {
|
||||
char line[256];
|
||||
while (ifs.getline(line, sizeof(line)))
|
||||
{
|
||||
if (line[0] == '#')
|
||||
continue;
|
||||
std::string ignored(line);
|
||||
std::string::const_iterator it = ignored.begin();
|
||||
std::string::const_iterator end = ignored.end();
|
||||
ignoring(ignored);
|
||||
}
|
||||
ifs.close();
|
||||
}
|
||||
}
|
||||
catch (std::exception e) {
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
setup();
|
||||
}
|
||||
|
||||
@@ -26,10 +56,45 @@ TextTestResult::TextTestResult():
|
||||
TextTestResult::TextTestResult(std::ostream& ostr):
|
||||
_ostr(ostr)
|
||||
{
|
||||
}
|
||||
TextTestResult::TextTestResult(std::ostream& ostr, const std::string& ignore) :
|
||||
_ostr(ostr)
|
||||
{
|
||||
if (!ignore.empty())
|
||||
{
|
||||
std::ifstream ifs(ignore);
|
||||
if (ifs.is_open()) {
|
||||
char line[256];
|
||||
while (ifs.getline(line, sizeof(line)))
|
||||
{
|
||||
if (line[0] == '#')
|
||||
continue;
|
||||
std::string ignored(line);
|
||||
std::string::const_iterator it = ignored.begin();
|
||||
std::string::const_iterator end = ignored.end();
|
||||
ignoring(ignored);
|
||||
}
|
||||
ifs.close();
|
||||
}
|
||||
}
|
||||
setup();
|
||||
}
|
||||
|
||||
void TextTestResult::ignoring(const std::string ignore)
|
||||
{
|
||||
std::string::const_iterator it = ignore.begin();
|
||||
std::string::const_iterator end = ignore.end();
|
||||
for (;;)
|
||||
{
|
||||
while (it != end && (std::isspace(*it) || *it == '"' || *it == ',' || *it == '\'')) ++it;
|
||||
if (it == end)
|
||||
break;
|
||||
|
||||
std::string test;
|
||||
while (it != end && *it != ',' && *it != '"' && *it != '\'') test += *it++;
|
||||
if (!test.empty()) _ignored.insert(test.erase(test.find_last_not_of(" \n\r\t") + 1));
|
||||
}
|
||||
}
|
||||
void TextTestResult::setup()
|
||||
{
|
||||
#if !defined(_WIN32_WCE)
|
||||
@@ -39,17 +104,9 @@ void TextTestResult::setup()
|
||||
std::string ignored = env;
|
||||
std::string::const_iterator it = ignored.begin();
|
||||
std::string::const_iterator end = ignored.end();
|
||||
for (;;)
|
||||
{
|
||||
while (it != end && (std::isspace(*it) || *it == '"' || *it == ',' || *it == '\'')) ++it;
|
||||
if (it == end)
|
||||
break;
|
||||
ignoring(ignored);
|
||||
}
|
||||
|
||||
std::string test;
|
||||
while (it != end && *it != ',' && *it != '"' && *it != '\'') test += *it++;
|
||||
if (!test.empty()) _ignored.insert(test);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -196,18 +253,11 @@ void TextTestResult::print(std::ostream& stream)
|
||||
|
||||
void TextTestResult::printHeader(std::ostream& stream)
|
||||
{
|
||||
if (wasSuccessful())
|
||||
stream << "OK ("
|
||||
<< runTests() << " tests)"
|
||||
<< std::endl;
|
||||
else
|
||||
if (!wasSuccessful())
|
||||
stream << "!!!FAILURES!!!" << std::endl
|
||||
<< "Runs: "
|
||||
<< runTests ()
|
||||
<< " Failures: "
|
||||
<< testFailures ()
|
||||
<< " Errors: "
|
||||
<< testErrors ()
|
||||
<< "Runs: " << runTests()
|
||||
<< " Failures: " << testFailures()
|
||||
<< " Errors: " << testErrors()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ if "%1" =="-d" (
|
||||
shift
|
||||
)
|
||||
|
||||
set PATH=%CD%\%BINDIR%;%PATH%
|
||||
echo PATH=%PATH%
|
||||
set PATH=%POCO_BASE%\%BINDIR%;%PATH%
|
||||
set IGNORE=-ignore %POCO_BASE%\cppignore.txt
|
||||
|
||||
if not "%1" == "" (
|
||||
set TESTCOMPONENTS="%1"
|
||||
@@ -69,7 +69,8 @@ for /f %%C in ( %TESTCOMPONENTS% ) do (
|
||||
set /a runs=!runs! + 1
|
||||
set dir=%CD%
|
||||
cd %%C\testsuite
|
||||
%BINDIR%\%TESTRUNNER% %TESTRUNNERARGS%
|
||||
echo %BINDIR%\%TESTRUNNER% %IGNORE% %TESTRUNNERARGS%
|
||||
%BINDIR%\%TESTRUNNER% %IGNORE% %TESTRUNNERARGS%
|
||||
if !ERRORLEVEL! neq 0 (
|
||||
set /a failures=!failures! + 1
|
||||
set failedTests=!failedTests! %%C
|
||||
|
||||
17
cppignore.txt
Normal file
17
cppignore.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
class CppUnit::TestCaller<class NTPClientTest>.testTimeSync
|
||||
class CppUnit::TestCaller<class GlobTest>.testGlob
|
||||
class CppUnit::TestCaller<class RawSocketTest>.testEchoIPv4
|
||||
class CppUnit::TestCaller<class RawSocketTest>.testSendToReceiveFromIPv4
|
||||
class CppUnit::TestCaller<class ICMPClientTest>.testPing
|
||||
class CppUnit::TestCaller<class ICMPClientTest>.testBigPing
|
||||
class CppUnit::TestCaller<class HTTPSClientSessionTest>.testProxy
|
||||
class CppUnit::TestCaller<class HTTPSStreamFactoryTest>.testProxy
|
||||
class CppUnit::TestCaller<class TCPServerTest>.testReuseSocket
|
||||
class CppUnit::TestCaller<class HTTPSClientSessionTest>.testInterop
|
||||
class CppUnit::TestCaller<class PathTest>.testFind
|
||||
class CppUnit::TestCaller<class ThreadTest>.testSleep
|
||||
class CppUnit::TestCaller<class TimerTest>.testTimer
|
||||
class CppUnit::TestCaller<class TimerTest>.testScheduleInterval
|
||||
class CppUnit::TestCaller<class TimerTest>.testScheduleIntervalTimestamp
|
||||
class CppUnit::TestCaller<class TimerTest>.testScheduleIntervalClock
|
||||
class CppUnit::TestCaller<class TimerTest>.testScheduleAtFixedRate
|
||||
Reference in New Issue
Block a user