From c9f26c4cbca654417d304c9214aa3a7709631159 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 23 May 2016 14:43:26 +0200 Subject: Propagate test-mode to resources. This way we can run tests in completely separate data-directories. --- synchronizer/main.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'synchronizer') diff --git a/synchronizer/main.cpp b/synchronizer/main.cpp index e000e03..8335e67 100644 --- a/synchronizer/main.cpp +++ b/synchronizer/main.cpp @@ -28,6 +28,7 @@ #include "listener.h" #include "log.h" +#include "test.h" #undef DEBUG_AREA #define DEBUG_AREA "resource" @@ -123,13 +124,23 @@ int main(int argc, char *argv[]) QCoreApplication app(argc, argv); - if (argc < 3) { + QByteArrayList arguments; + for (int i = 0; i < argc; i++) { + arguments << argv[i]; + } + if (arguments.contains("--test")) { + Log() << "Running in test-mode"; + arguments.removeAll("--test"); + Sink::Test::setTestModeEnabled(true); + } + + if (arguments.count() < 3) { Warning() << "Not enough args passed, no resource loaded."; return app.exec(); } - const QByteArray instanceIdentifier = argv[1]; - const QByteArray resourceType = argv[2]; + const QByteArray instanceIdentifier = arguments.at(1); + const QByteArray resourceType = arguments.at(2); app.setApplicationName(instanceIdentifier); QLockFile lockfile(instanceIdentifier + ".lock"); -- cgit v1.2.3