From 60610e90b1258b37f6ae946cfc5b2737c192d2ae Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 1 Apr 2020 15:53:43 +0200 Subject: test/net/TestIPv[46]Address: fix Windows build errors --- test/net/TestIPv4Address.cxx | 13 +++++++++++-- test/net/TestIPv6Address.cxx | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/net/TestIPv4Address.cxx b/test/net/TestIPv4Address.cxx index aa7f727be..a6c05e681 100644 --- a/test/net/TestIPv4Address.cxx +++ b/test/net/TestIPv4Address.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 Max Kellermann + * Copyright 2012-2020 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,13 +34,22 @@ #include +#ifndef _WIN32 #include +#endif static std::string ToString(const struct in_addr &a) { +#ifdef _WIN32 + /* on mingw32, the parameter is non-const (PVOID) */ + const auto p = const_cast(&a); +#else + const auto p = &a; +#endif + char buffer[256]; - const char *result = inet_ntop(AF_INET, &a, buffer, sizeof(buffer)); + const char *result = inet_ntop(AF_INET, p, buffer, sizeof(buffer)); if (result == nullptr) throw std::runtime_error("inet_ntop() failed"); return result; diff --git a/test/net/TestIPv6Address.cxx b/test/net/TestIPv6Address.cxx index 325d25bbf..cdadf6a7f 100644 --- a/test/net/TestIPv6Address.cxx +++ b/test/net/TestIPv6Address.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 Max Kellermann + * Copyright 2012-2020 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,13 +34,22 @@ #include +#ifndef _WIN32 #include +#endif static std::string ToString(const struct in6_addr &a) { +#ifdef _WIN32 + /* on mingw32, the parameter is non-const (PVOID) */ + const auto p = const_cast(&a); +#else + const auto p = &a; +#endif + char buffer[256]; - const char *result = inet_ntop(AF_INET6, &a, buffer, sizeof(buffer)); + const char *result = inet_ntop(AF_INET6, p, buffer, sizeof(buffer)); if (result == nullptr) throw std::runtime_error("inet_ntop() failed"); return result; -- cgit v1.2.3 From a4c925c8d7b67ef8f099710682e16622746ce648 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 1 Apr 2020 16:10:49 +0200 Subject: test/meson.build: move TestTime to time/ --- test/TestISO8601.cxx | 92 ----------------------------------------------- test/meson.build | 14 +------- test/time/TestISO8601.cxx | 92 +++++++++++++++++++++++++++++++++++++++++++++++ test/time/meson.build | 16 +++++++++ 4 files changed, 109 insertions(+), 105 deletions(-) delete mode 100644 test/TestISO8601.cxx create mode 100644 test/time/TestISO8601.cxx create mode 100644 test/time/meson.build (limited to 'test') diff --git a/test/TestISO8601.cxx b/test/TestISO8601.cxx deleted file mode 100644 index cd0897c1a..000000000 --- a/test/TestISO8601.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2019 Content Management AG - * All rights reserved. - * - * author: Max Kellermann - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "time/ISO8601.hxx" - -#include - -static constexpr struct { - const char *s; - time_t t; - std::chrono::system_clock::duration d; -} parse_tests[] = { - /* full ISO8601 */ - { "1970-01-01T00:00:00Z", 0, std::chrono::seconds(1) }, - { "1970-01-01T00:00:01Z", 1, std::chrono::seconds(1) }, - { "2019-02-04T16:46:41Z", 1549298801, std::chrono::seconds(1) }, - { "2018-12-31T23:59:59Z", 1546300799, std::chrono::seconds(1) }, - { "2019-01-01T00:00:00Z", 1546300800, std::chrono::seconds(1) }, - - /* only date */ - { "1970-01-01", 0, std::chrono::hours(24) }, - { "2019-02-04", 1549238400, std::chrono::hours(24) }, - { "2018-12-31", 1546214400, std::chrono::hours(24) }, - { "2019-01-01", 1546300800, std::chrono::hours(24) }, - - /* date with time zone */ - { "2019-02-04Z", 1549238400, std::chrono::hours(24) }, - - /* without time zone */ - { "2019-02-04T16:46:41", 1549298801, std::chrono::seconds(1) }, - - /* without seconds */ - { "2019-02-04T16:46", 1549298760, std::chrono::minutes(1) }, - { "2019-02-04T16:46Z", 1549298760, std::chrono::minutes(1) }, - - /* without minutes */ - { "2019-02-04T16", 1549296000, std::chrono::hours(1) }, - { "2019-02-04T16Z", 1549296000, std::chrono::hours(1) }, - - /* with time zone */ - { "2019-02-04T16:46:41+02", 1549291601, std::chrono::seconds(1) }, - { "2019-02-04T16:46:41+0200", 1549291601, std::chrono::seconds(1) }, - { "2019-02-04T16:46:41+02:00", 1549291601, std::chrono::seconds(1) }, - { "2019-02-04T16:46:41-0200", 1549306001, std::chrono::seconds(1) }, - - /* without field separators */ - { "19700101T000000Z", 0, std::chrono::seconds(1) }, - { "19700101T000001Z", 1, std::chrono::seconds(1) }, - { "20190204T164641Z", 1549298801, std::chrono::seconds(1) }, - { "19700101", 0, std::chrono::hours(24) }, - { "20190204", 1549238400, std::chrono::hours(24) }, - { "20190204T1646", 1549298760, std::chrono::minutes(1) }, - { "20190204T16", 1549296000, std::chrono::hours(1) }, -}; - -TEST(ISO8601, Parse) -{ - for (const auto &i : parse_tests) { - const auto result = ParseISO8601(i.s); - EXPECT_EQ(std::chrono::system_clock::to_time_t(result.first), i.t); - EXPECT_EQ(result.second, i.d); - } -} diff --git a/test/meson.build b/test/meson.build index 4e3fbab49..f20a79aa0 100644 --- a/test/meson.build +++ b/test/meson.build @@ -24,6 +24,7 @@ gtest_dep = declare_dependency( ) subdir('net') +subdir('time') executable( 'read_conf', @@ -51,19 +52,6 @@ test('TestUtil', executable( ], )) -test( - 'TestTime', - executable( - 'TestTime', - 'TestISO8601.cxx', - include_directories: inc, - dependencies: [ - time_dep, - gtest_dep, - ], - ), -) - test('TestRewindInputStream', executable( 'TestRewindInputStream', 'TestRewindInputStream.cxx', diff --git a/test/time/TestISO8601.cxx b/test/time/TestISO8601.cxx new file mode 100644 index 000000000..cd0897c1a --- /dev/null +++ b/test/time/TestISO8601.cxx @@ -0,0 +1,92 @@ +/* + * Copyright 2019 Content Management AG + * All rights reserved. + * + * author: Max Kellermann + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "time/ISO8601.hxx" + +#include + +static constexpr struct { + const char *s; + time_t t; + std::chrono::system_clock::duration d; +} parse_tests[] = { + /* full ISO8601 */ + { "1970-01-01T00:00:00Z", 0, std::chrono::seconds(1) }, + { "1970-01-01T00:00:01Z", 1, std::chrono::seconds(1) }, + { "2019-02-04T16:46:41Z", 1549298801, std::chrono::seconds(1) }, + { "2018-12-31T23:59:59Z", 1546300799, std::chrono::seconds(1) }, + { "2019-01-01T00:00:00Z", 1546300800, std::chrono::seconds(1) }, + + /* only date */ + { "1970-01-01", 0, std::chrono::hours(24) }, + { "2019-02-04", 1549238400, std::chrono::hours(24) }, + { "2018-12-31", 1546214400, std::chrono::hours(24) }, + { "2019-01-01", 1546300800, std::chrono::hours(24) }, + + /* date with time zone */ + { "2019-02-04Z", 1549238400, std::chrono::hours(24) }, + + /* without time zone */ + { "2019-02-04T16:46:41", 1549298801, std::chrono::seconds(1) }, + + /* without seconds */ + { "2019-02-04T16:46", 1549298760, std::chrono::minutes(1) }, + { "2019-02-04T16:46Z", 1549298760, std::chrono::minutes(1) }, + + /* without minutes */ + { "2019-02-04T16", 1549296000, std::chrono::hours(1) }, + { "2019-02-04T16Z", 1549296000, std::chrono::hours(1) }, + + /* with time zone */ + { "2019-02-04T16:46:41+02", 1549291601, std::chrono::seconds(1) }, + { "2019-02-04T16:46:41+0200", 1549291601, std::chrono::seconds(1) }, + { "2019-02-04T16:46:41+02:00", 1549291601, std::chrono::seconds(1) }, + { "2019-02-04T16:46:41-0200", 1549306001, std::chrono::seconds(1) }, + + /* without field separators */ + { "19700101T000000Z", 0, std::chrono::seconds(1) }, + { "19700101T000001Z", 1, std::chrono::seconds(1) }, + { "20190204T164641Z", 1549298801, std::chrono::seconds(1) }, + { "19700101", 0, std::chrono::hours(24) }, + { "20190204", 1549238400, std::chrono::hours(24) }, + { "20190204T1646", 1549298760, std::chrono::minutes(1) }, + { "20190204T16", 1549296000, std::chrono::hours(1) }, +}; + +TEST(ISO8601, Parse) +{ + for (const auto &i : parse_tests) { + const auto result = ParseISO8601(i.s); + EXPECT_EQ(std::chrono::system_clock::to_time_t(result.first), i.t); + EXPECT_EQ(result.second, i.d); + } +} diff --git a/test/time/meson.build b/test/time/meson.build new file mode 100644 index 000000000..0aba67ac2 --- /dev/null +++ b/test/time/meson.build @@ -0,0 +1,16 @@ +test_time_sources = [ + 'TestISO8601.cxx', +] + +test( + 'TestTime', + executable( + 'TestTime', + test_time_sources, + include_directories: inc, + dependencies: [ + time_dep, + gtest_dep, + ], + ), +) -- cgit v1.2.3 From 62229f14da8d7794f73491c28db47fd9e1c25b3f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 1 Apr 2020 16:16:11 +0200 Subject: test/time: add test for LocalTime(), GmTime() --- test/time/TestConvert.cxx | 65 +++++++++++++++++++++++++++++++++++++++++++++++ test/time/meson.build | 1 + 2 files changed, 66 insertions(+) create mode 100644 test/time/TestConvert.cxx (limited to 'test') diff --git a/test/time/TestConvert.cxx b/test/time/TestConvert.cxx new file mode 100644 index 000000000..ff31d7097 --- /dev/null +++ b/test/time/TestConvert.cxx @@ -0,0 +1,65 @@ +/* + * Copyright 2020 Max Kellermann + * All rights reserved. + * + * author: Max Kellermann + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "time/Convert.hxx" + +#include + +static constexpr time_t times[] = { + 1234567890, + 1580566807, + 1585750807, + 1590934807, +}; + +TEST(Time, LocalTime) +{ + /* convert back and forth using local time zone */ + + for (const auto t : times) { + auto tp = std::chrono::system_clock::from_time_t(t); + auto tm = LocalTime(tp); + EXPECT_EQ(MakeTime(tm), tp); + } +} + +TEST(Time, GmTime) +{ + /* convert back and forth using UTC */ + + for (const auto t : times) { + auto tp = std::chrono::system_clock::from_time_t(t); + auto tm = GmTime(tp); + EXPECT_EQ(std::chrono::system_clock::to_time_t(TimeGm(tm)), + t); + } +} diff --git a/test/time/meson.build b/test/time/meson.build index 0aba67ac2..53b583cf1 100644 --- a/test/time/meson.build +++ b/test/time/meson.build @@ -1,4 +1,5 @@ test_time_sources = [ + 'TestConvert.cxx', 'TestISO8601.cxx', ] -- cgit v1.2.3 From 9c66b0414a02ff03fcf3c122dbeb83d8017ff1b8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 2 Apr 2020 16:40:18 +0200 Subject: test/*: fix Windows build using class FromNarrowPath --- test/ContainerScan.cxx | 3 ++- test/DumpDatabase.cxx | 3 ++- test/ReadApeTags.cxx | 3 ++- test/WriteFile.cxx | 3 ++- test/dump_playlist.cxx | 3 ++- test/read_conf.cxx | 4 ++-- test/read_tags.cxx | 9 +++++---- test/run_decoder.cxx | 7 ++++--- test/run_filter.cxx | 3 ++- test/run_gunzip.cxx | 3 ++- test/run_input.cxx | 5 +++-- test/run_output.cxx | 3 ++- 12 files changed, 30 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/ContainerScan.cxx b/test/ContainerScan.cxx index 6512ba9cb..ac1fca3d3 100644 --- a/test/ContainerScan.cxx +++ b/test/ContainerScan.cxx @@ -23,6 +23,7 @@ #include "decoder/DecoderList.hxx" #include "decoder/DecoderPlugin.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "fs/io/StdioOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx" #include "util/UriUtil.hxx" @@ -63,7 +64,7 @@ try { return EXIT_FAILURE; } - const Path path = Path::FromFS(argv[1]); + const FromNarrowPath path = argv[1]; const ScopeDecoderPluginsInit decoder_plugins_init({}); diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx index 76315c133..39801baf2 100644 --- a/test/DumpDatabase.cxx +++ b/test/DumpDatabase.cxx @@ -29,6 +29,7 @@ #include "ConfigGlue.hxx" #include "tag/Config.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "event/Thread.hxx" #include "util/ScopeExit.hxx" #include "util/PrintException.hxx" @@ -107,7 +108,7 @@ try { return 1; } - const Path config_path = Path::FromFS(argv[1]); + const FromNarrowPath config_path = argv[1]; const char *const plugin_name = argv[2]; const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name); diff --git a/test/ReadApeTags.cxx b/test/ReadApeTags.cxx index 7afba2b49..028874edc 100644 --- a/test/ReadApeTags.cxx +++ b/test/ReadApeTags.cxx @@ -21,6 +21,7 @@ #include "tag/ApeLoader.hxx" #include "thread/Mutex.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "input/InputStream.hxx" #include "input/LocalOpen.hxx" #include "util/StringView.hxx" @@ -58,7 +59,7 @@ try { return EXIT_FAILURE; } - const Path path = Path::FromFS(argv[1]); + const FromNarrowPath path = argv[1]; Mutex mutex; diff --git a/test/WriteFile.cxx b/test/WriteFile.cxx index 9cba451e9..1feeed1d8 100644 --- a/test/WriteFile.cxx +++ b/test/WriteFile.cxx @@ -18,6 +18,7 @@ */ #include "fs/io/FileOutputStream.hxx" +#include "fs/NarrowPath.hxx" #include "util/PrintException.hxx" #include @@ -54,7 +55,7 @@ try { return EXIT_FAILURE; } - const Path path = Path::FromFS(argv[1]); + const FromNarrowPath path = argv[1]; FileOutputStream fos(path); diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx index c4aea7de8..ea3be3a3f 100644 --- a/test/dump_playlist.cxx +++ b/test/dump_playlist.cxx @@ -28,6 +28,7 @@ #include "playlist/PlaylistRegistry.hxx" #include "playlist/PlaylistPlugin.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "fs/io/BufferedOutputStream.hxx" #include "fs/io/StdioOutputStream.hxx" #include "thread/Cond.hxx" @@ -54,7 +55,7 @@ try { return EXIT_FAILURE; } - const Path config_path = Path::FromFS(argv[1]); + const FromNarrowPath config_path = argv[1]; uri = argv[2]; /* initialize MPD */ diff --git a/test/read_conf.cxx b/test/read_conf.cxx index f6a8019e7..0f9873056 100644 --- a/test/read_conf.cxx +++ b/test/read_conf.cxx @@ -21,7 +21,7 @@ #include "config/Param.hxx" #include "config/File.hxx" #include "fs/Path.hxx" -#include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "util/PrintException.hxx" #include "util/RuntimeError.hxx" @@ -36,7 +36,7 @@ try { return EXIT_FAILURE; } - const Path config_path = Path::FromFS(argv[1]); + const FromNarrowPath config_path = argv[1]; const char *name = argv[2]; const auto option = ParseConfigOptionName(name); diff --git a/test/read_tags.cxx b/test/read_tags.cxx index a8ab2a061..7c392dc2b 100644 --- a/test/read_tags.cxx +++ b/test/read_tags.cxx @@ -27,6 +27,7 @@ #include "tag/Handler.hxx" #include "tag/Generic.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "AudioFormat.hxx" #include "util/ScopeExit.hxx" #include "util/StringBuffer.hxx" @@ -88,7 +89,7 @@ try { } decoder_name = argv[1]; - const Path path = Path::FromFS(argv[2]); + const char *path = argv[2]; EventThread io_thread; io_thread.Start(); @@ -107,7 +108,7 @@ try { DumpTagHandler h; bool success; try { - success = plugin->ScanFile(path, h); + success = plugin->ScanFile(FromNarrowPath(path), h); } catch (...) { PrintException(std::current_exception()); success = false; @@ -117,7 +118,7 @@ try { InputStreamPtr is; if (!success && plugin->scan_stream != NULL) { - is = InputStream::OpenReady(path.c_str(), mutex); + is = InputStream::OpenReady(path, mutex); success = plugin->ScanStream(*is, h); } @@ -130,7 +131,7 @@ try { if (is) ScanGenericTags(*is, h); else - ScanGenericTags(path, h); + ScanGenericTags(FromNarrowPath(path), h); } return 0; diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index f7e3d6739..8d78534da 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -26,6 +26,7 @@ #include "input/Init.hxx" #include "input/InputStream.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "AudioFormat.hxx" #include "util/OptionDef.hxx" #include "util/OptionParser.hxx" @@ -44,7 +45,7 @@ struct CommandLine { const char *decoder = nullptr; const char *uri = nullptr; - Path config_path = nullptr; + FromNarrowPath config_path; bool verbose = false; }; @@ -68,7 +69,7 @@ ParseCommandLine(int argc, char **argv) while (auto o = option_parser.Next()) { switch (Option(o.index)) { case OPTION_CONFIG: - c.config_path = Path::FromFS(o.value); + c.config_path = o.value; break; case OPTION_VERBOSE: @@ -118,7 +119,7 @@ try { DumpDecoderClient client; if (plugin->file_decode != nullptr) { try { - plugin->FileDecode(client, Path::FromFS(c.uri)); + plugin->FileDecode(client, FromNarrowPath(c.uri)); } catch (StopDecoder) { } } else if (plugin->stream_decode != nullptr) { diff --git a/test/run_filter.cxx b/test/run_filter.cxx index 31452f440..5a70d6828 100644 --- a/test/run_filter.cxx +++ b/test/run_filter.cxx @@ -19,6 +19,7 @@ #include "ConfigGlue.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "AudioParser.hxx" #include "AudioFormat.hxx" #include "filter/LoadOne.hxx" @@ -68,7 +69,7 @@ try { return EXIT_FAILURE; } - const Path config_path = Path::FromFS(argv[1]); + const FromNarrowPath config_path = argv[1]; AudioFormat audio_format(44100, SampleFormat::S16, 2); diff --git a/test/run_gunzip.cxx b/test/run_gunzip.cxx index f8a0e618e..3a8619836 100644 --- a/test/run_gunzip.cxx +++ b/test/run_gunzip.cxx @@ -20,6 +20,7 @@ #include "fs/io/GunzipReader.hxx" #include "fs/io/FileReader.hxx" #include "fs/io/StdioOutputStream.hxx" +#include "fs/NarrowPath.hxx" #include "util/PrintException.hxx" #include @@ -62,7 +63,7 @@ try { return EXIT_FAILURE; } - Path path = Path::FromFS(argv[1]); + FromNarrowPath path = argv[1]; CopyGunzip(stdout, path); return EXIT_SUCCESS; diff --git a/test/run_input.cxx b/test/run_input.cxx index e5deafda8..a3b5e7277 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -32,6 +32,7 @@ #include "Log.hxx" #include "LogBackend.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "fs/io/BufferedOutputStream.hxx" #include "fs/io/StdioOutputStream.hxx" #include "util/ConstBuffer.hxx" @@ -51,7 +52,7 @@ struct CommandLine { const char *uri = nullptr; - Path config_path = nullptr; + FromNarrowPath config_path; bool verbose = false; @@ -79,7 +80,7 @@ ParseCommandLine(int argc, char **argv) while (auto o = option_parser.Next()) { switch (Option(o.index)) { case OPTION_CONFIG: - c.config_path = Path::FromFS(o.value); + c.config_path = o.value; break; case OPTION_VERBOSE: diff --git a/test/run_output.cxx b/test/run_output.cxx index c69e8f67b..d6fc0ada6 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -23,6 +23,7 @@ #include "ConfigGlue.hxx" #include "event/Thread.hxx" #include "fs/Path.hxx" +#include "fs/NarrowPath.hxx" #include "AudioParser.hxx" #include "pcm/PcmConvert.hxx" #include "util/StringBuffer.hxx" @@ -111,7 +112,7 @@ try { return EXIT_FAILURE; } - const Path config_path = Path::FromFS(argv[1]); + const FromNarrowPath config_path = argv[1]; AudioFormat audio_format(44100, SampleFormat::S16, 2); -- cgit v1.2.3 From bad829509e43479a4c06d4f7cc36e37246b7b2ed Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 2 Apr 2020 17:10:27 +0200 Subject: test/ShutdownHandler: add `inline` to work around Windows linker problems --- test/ShutdownHandler.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ShutdownHandler.hxx b/test/ShutdownHandler.hxx index 2283225d2..58ae74790 100644 --- a/test/ShutdownHandler.hxx +++ b/test/ShutdownHandler.hxx @@ -29,8 +29,8 @@ public: }; #ifdef _WIN32 -ShutdownHandler::ShutdownHandler(EventLoop &loop) {} -ShutdownHandler::~ShutdownHandler() {} +inline ShutdownHandler::ShutdownHandler(EventLoop &) {} +inline ShutdownHandler::~ShutdownHandler() {} #endif #endif -- cgit v1.2.3 From a689b881d3a909c9075a832034c61c823443c2bc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 2 Apr 2020 17:13:50 +0200 Subject: test/meson.build: work around linker failure due to statically linked CURL --- test/meson.build | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/meson.build b/test/meson.build index f20a79aa0..a1dc7840d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -336,6 +336,11 @@ if curl_dep.found() include_directories: inc, dependencies: [ curl_dep, + + # Explicitly linking with zlib here works around a linker + # failure on Windows, because our Windows CURL build is + # statically linked and thus declares no dependency on zlib + zlib_dep, ], ) -- cgit v1.2.3