Merge remote-tracking branch 'wp/master'
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
// dirty, but I get OS header includes this way
|
// dirty, but I get OS header includes this way
|
||||||
#include "JGE.h"
|
#include "JGE.h"
|
||||||
|
|
||||||
|
#include "OutputCapturer.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@@ -29,12 +31,23 @@ std::string ToHex(T* pointer)
|
|||||||
#if defined (WIN32) || defined (LINUX)
|
#if defined (WIN32) || defined (LINUX)
|
||||||
|
|
||||||
#ifdef QT_CONFIG
|
#ifdef QT_CONFIG
|
||||||
|
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
#define DebugTrace(inString) \
|
#define DebugTrace(inString) \
|
||||||
{ \
|
{ \
|
||||||
std::ostringstream stream; \
|
std::ostringstream stream; \
|
||||||
stream << inString; \
|
stream << inString; \
|
||||||
qDebug("%s", stream.str().c_str()); \
|
OutputCapturer::add(stream.str()); \
|
||||||
}
|
}
|
||||||
|
#else // CAPTURE_STDERR
|
||||||
|
#define DebugTrace(inString) \
|
||||||
|
{ \
|
||||||
|
std::ostringstream stream; \
|
||||||
|
stream << inString; \
|
||||||
|
qDebug("%s", stream.str().c_str()); \
|
||||||
|
}
|
||||||
|
#endif // CAPTURE_STDERR
|
||||||
|
|
||||||
#elif defined (ANDROID)
|
#elif defined (ANDROID)
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
#define DebugTrace(inString) \
|
#define DebugTrace(inString) \
|
||||||
|
|||||||
23
JGE/include/OutputCapturer.h
Normal file
23
JGE/include/OutputCapturer.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef OUTPUTCAPTURER_H
|
||||||
|
#define OUTPUTCAPTURER_H
|
||||||
|
|
||||||
|
#if defined(QT_CONFIG)
|
||||||
|
#include <Qt>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
#include "Threading.h"
|
||||||
|
|
||||||
|
class OutputCapturer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static std::ostringstream stream;
|
||||||
|
static boost::mutex mMutex;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void add(const std::string& s);
|
||||||
|
static void debugAndClear();
|
||||||
|
static void clear();
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // OUTPUTCAPTURER_H
|
||||||
@@ -315,7 +315,6 @@ namespace boost
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "../include/DebugRoutines.h"
|
|
||||||
#include "../include/JLogger.h"
|
#include "../include/JLogger.h"
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
|
|||||||
22
JGE/src/OutputCapturer.cpp
Normal file
22
JGE/src/OutputCapturer.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include "../include/OutputCapturer.h"
|
||||||
|
|
||||||
|
std::ostringstream OutputCapturer::stream;
|
||||||
|
boost::mutex OutputCapturer::mMutex;
|
||||||
|
|
||||||
|
void OutputCapturer::add(const std::string& s)
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(mMutex);
|
||||||
|
stream << s << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputCapturer::debugAndClear()
|
||||||
|
{
|
||||||
|
stream.flush();
|
||||||
|
qDebug("%s", stream.str().c_str());
|
||||||
|
stream.str("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputCapturer::clear()
|
||||||
|
{
|
||||||
|
stream.str("");
|
||||||
|
}
|
||||||
@@ -96,7 +96,11 @@ int main(int argc, char* argv[])
|
|||||||
options.reloadProfile();
|
options.reloadProfile();
|
||||||
TestSuite testSuite("test/_tests.txt");
|
TestSuite testSuite("test/_tests.txt");
|
||||||
result = testSuite.run();
|
result = testSuite.run();
|
||||||
|
int totalTests = testSuite.nbTests + testSuite.nbAITests;
|
||||||
delete wagicCore;
|
delete wagicCore;
|
||||||
DebugTrace("TestSuite done: failed test: " << result);
|
DebugTrace("TestSuite done: failed test: " << result << " out of " << totalTests << " total");
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
|
OutputCapturer::debugAndClear();
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,6 +433,15 @@ void TestSuiteGame::assertGame()
|
|||||||
Log("<span class=\"success\">==Test Succesful !==</span>");
|
Log("<span class=\"success\">==Test Succesful !==</span>");
|
||||||
else
|
else
|
||||||
Log("<span class=\"error\">==Test Failed !==</span>");
|
Log("<span class=\"error\">==Test Failed !==</span>");
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
OutputCapturer::debugAndClear();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
OutputCapturer::clear();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
mMutex.unlock();
|
mMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,6 +594,9 @@ void TestSuite::ThreadProc(void* inParam)
|
|||||||
{
|
{
|
||||||
LOG("Entering TestSuite::ThreadProc");
|
LOG("Entering TestSuite::ThreadProc");
|
||||||
TestSuite* instance = reinterpret_cast<TestSuite*>(inParam);
|
TestSuite* instance = reinterpret_cast<TestSuite*>(inParam);
|
||||||
|
#ifdef CAPTURE_STDERR
|
||||||
|
OutputCapturer::debugAndClear();
|
||||||
|
#endif
|
||||||
if (instance)
|
if (instance)
|
||||||
{
|
{
|
||||||
string filename;
|
string filename;
|
||||||
|
|||||||
@@ -327,6 +327,7 @@ SOURCES += \
|
|||||||
../../JGE/src/pc/JSocket.cpp\
|
../../JGE/src/pc/JSocket.cpp\
|
||||||
../../JGE/src/pc/JSfx.cpp\
|
../../JGE/src/pc/JSfx.cpp\
|
||||||
../../JGE/src/JSprite.cpp\
|
../../JGE/src/JSprite.cpp\
|
||||||
|
../../JGE/src/OutputCapturer.cpp\
|
||||||
../../JGE/src/Vector2D.cpp\
|
../../JGE/src/Vector2D.cpp\
|
||||||
../../JGE/src/tinyxml/tinystr.cpp\
|
../../JGE/src/tinyxml/tinystr.cpp\
|
||||||
../../JGE/src/tinyxml/tinyxml.cpp\
|
../../JGE/src/tinyxml/tinyxml.cpp\
|
||||||
@@ -393,6 +394,7 @@ HEADERS += \
|
|||||||
../../JGE/include/JSpline.h\
|
../../JGE/include/JSpline.h\
|
||||||
../../JGE/include/JSprite.h\
|
../../JGE/include/JSprite.h\
|
||||||
../../JGE/include/JTypes.h\
|
../../JGE/include/JTypes.h\
|
||||||
|
../../JGE/include/OutputCapturer.h\
|
||||||
../../JGE/include/Vector2D.h\
|
../../JGE/include/Vector2D.h\
|
||||||
../../JGE/include/Vector3D.h\
|
../../JGE/include/Vector3D.h\
|
||||||
../../JGE/include/vram.h\
|
../../JGE/include/vram.h\
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ make -j 8
|
|||||||
|
|
||||||
# let's try an Intel linux binary
|
# let's try an Intel linux binary
|
||||||
cd ../..
|
cd ../..
|
||||||
qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug
|
qmake projects/mtg/wagic-qt.pro CONFIG+=console CONFIG+=debug DEFINES+=CAPTURE_STDERR
|
||||||
make -j 8
|
make -j 8
|
||||||
|
|
||||||
# and finish by running the testsuite
|
# and finish by running the testsuite
|
||||||
|
|||||||
Reference in New Issue
Block a user