From b1096a9935e033e078ecdfe4fb70cf0ffb37e8dd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 14 Feb 2022 16:36:55 +0100 Subject: [PATCH] test/{visit_archive,dump_text_file}: add basic config file support (not wired yet) --- test/dump_text_file.cxx | 14 ++++++++------ test/run_input.cxx | 5 ++--- test/visit_archive.cxx | 12 +++++++----- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index 73874fe0e..ced972123 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -18,11 +18,11 @@ */ #include "config.h" +#include "ConfigGlue.hxx" #include "event/Thread.hxx" #include "input/Init.hxx" #include "input/InputStream.hxx" #include "input/TextInputStream.hxx" -#include "config/Data.hxx" #include "util/PrintException.hxx" #ifdef ENABLE_ARCHIVE @@ -36,17 +36,19 @@ #include class GlobalInit { + const ConfigData config; + EventThread io_thread; #ifdef ENABLE_ARCHIVE const ScopeArchivePluginsInit archive_plugins_init; #endif - const ScopeInputPluginsInit input_plugins_init; + const ScopeInputPluginsInit input_plugins_init{config, io_thread.GetEventLoop()}; public: - GlobalInit() - :input_plugins_init(ConfigData(), io_thread.GetEventLoop()) + explicit GlobalInit(Path config_path) + :config(AutoLoadConfigFile(config_path)) { io_thread.Start(); } @@ -77,13 +79,13 @@ dump_input_stream(InputStreamPtr &&is) int main(int argc, char **argv) try { if (argc != 2) { - fprintf(stderr, "Usage: run_input URI\n"); + fprintf(stderr, "Usage: dump_text_file URI\n"); return EXIT_FAILURE; } /* initialize MPD */ - const GlobalInit init; + const GlobalInit init{nullptr}; /* open the stream and dump it */ diff --git a/test/run_input.cxx b/test/run_input.cxx index 8c8adfcd6..8ba9fe491 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -140,12 +140,11 @@ class GlobalInit { const ScopeArchivePluginsInit archive_plugins_init; #endif - const ScopeInputPluginsInit input_plugins_init; + const ScopeInputPluginsInit input_plugins_init{config, io_thread.GetEventLoop()}; public: explicit GlobalInit(Path config_path) - :config(AutoLoadConfigFile(config_path)), - input_plugins_init(config, io_thread.GetEventLoop()) + :config(AutoLoadConfigFile(config_path)) { io_thread.Start(); } diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx index e84cb31a2..5a89c0e85 100644 --- a/test/visit_archive.cxx +++ b/test/visit_archive.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "tag/Tag.hxx" -#include "config/Data.hxx" +#include "ConfigGlue.hxx" #include "event/Thread.hxx" #include "input/Init.hxx" #include "archive/ArchiveList.hxx" @@ -36,17 +36,19 @@ #include class GlobalInit { + const ConfigData config; + EventThread io_thread; #ifdef ENABLE_ARCHIVE const ScopeArchivePluginsInit archive_plugins_init; #endif - const ScopeInputPluginsInit input_plugins_init; + const ScopeInputPluginsInit input_plugins_init{config, io_thread.GetEventLoop()}; public: - GlobalInit() - :input_plugins_init(ConfigData(), io_thread.GetEventLoop()) + explicit GlobalInit(Path config_path) + :config(AutoLoadConfigFile(config_path)) { io_thread.Start(); } @@ -72,7 +74,7 @@ try { /* initialize MPD */ - const GlobalInit init; + const GlobalInit init{nullptr}; /* open the archive and dump it */