TEST: Silence logs by default

Else tests on INI parser spam with expected warnings.
This commit is contained in:
Le Philousophe 2023-08-29 12:16:04 +02:00 committed by Eugene Sandulenko
parent 5e373fbffe
commit 154fab3952
2 changed files with 21 additions and 7 deletions

View File

@ -77,7 +77,7 @@ typedef void (*sighandler_t)(int);
class OSystem_NULL : public ModularMixerBackend, public ModularGraphicsBackend, Common::EventSource { class OSystem_NULL : public ModularMixerBackend, public ModularGraphicsBackend, Common::EventSource {
public: public:
OSystem_NULL(); OSystem_NULL(bool silenceLogs);
virtual ~OSystem_NULL(); virtual ~OSystem_NULL();
virtual void initBackend(); virtual void initBackend();
@ -101,9 +101,11 @@ private:
#elif defined(WIN32) #elif defined(WIN32)
DWORD _startTime; DWORD _startTime;
#endif #endif
bool _silenceLogs;
}; };
OSystem_NULL::OSystem_NULL() { OSystem_NULL::OSystem_NULL(bool silenceLogs) :
_silenceLogs(silenceLogs) {
#if defined(__amigaos4__) #if defined(__amigaos4__)
_fsFactory = new AmigaOSFilesystemFactory(); _fsFactory = new AmigaOSFilesystemFactory();
#elif defined(__MORPHOS__) #elif defined(__MORPHOS__)
@ -228,6 +230,9 @@ void OSystem_NULL::quit() {
} }
void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) { void OSystem_NULL::logMessage(LogMessageType::Type type, const char *message) {
if (_silenceLogs)
return;
FILE *output = 0; FILE *output = 0;
if (type == LogMessageType::kInfo || type == LogMessageType::kDebug) if (type == LogMessageType::kInfo || type == LogMessageType::kDebug)
@ -244,13 +249,13 @@ void OSystem_NULL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority)
s.add("gui/themes", new Common::FSDirectory("gui/themes", 4), priority); s.add("gui/themes", new Common::FSDirectory("gui/themes", 4), priority);
} }
OSystem *OSystem_NULL_create() { OSystem *OSystem_NULL_create(bool silenceLogs) {
return new OSystem_NULL(); return new OSystem_NULL(silenceLogs);
} }
#ifndef NULL_DRIVER_USE_FOR_TEST #ifndef NULL_DRIVER_USE_FOR_TEST
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
g_system = OSystem_NULL_create(); g_system = OSystem_NULL_create(false);
assert(g_system); assert(g_system);
// Invoke the actual ScummVM main entry point: // Invoke the actual ScummVM main entry point:
@ -262,7 +267,8 @@ int main(int argc, char *argv[]) {
#else /* USE_NULL_DRIVER */ #else /* USE_NULL_DRIVER */
OSystem *OSystem_NULL_create() { OSystem *OSystem_NULL_create(bool silenceLogs) {
(void)silenceLogs;
return NULL; return NULL;
} }

View File

@ -3,8 +3,16 @@
#include "null_osystem.h" #include "null_osystem.h"
#include "../backends/platform/null/null.cpp" #include "../backends/platform/null/null.cpp"
//#define DISPLAY_ERROR_MESSAGES
void Common::install_null_g_system() { void Common::install_null_g_system() {
g_system = OSystem_NULL_create(); #ifdef DISPLAY_ERROR_MESSAGES
const bool silenceLogs = false;
#else
const bool silenceLogs = true;
#endif
g_system = OSystem_NULL_create(silenceLogs);
} }
bool BaseBackend::setScaler(const char *name, int factor) { bool BaseBackend::setScaler(const char *name, int factor) {