From 92d60231e5a08accb8b07d5bf63bd9aac2426103 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Thu, 3 Dec 2026 17:37:14 +0300 Subject: [PATCH] tests: fix warnings exposed by -Werror and a non-recursive Storage copy --- tests/standalone/Archive/Archive.cpp | 4 +++- tests/standalone/Containers/LRU.cpp | 4 ++-- tests/standalone/Containers/Ring.cpp | 6 +++--- tests/standalone/Net/HttpDuplex.cpp | 11 ----------- tests/standalone/Storage/Storage.cpp | 3 ++- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/standalone/Archive/Archive.cpp b/tests/standalone/Archive/Archive.cpp index 32805c8..11a8d68 100644 --- a/tests/standalone/Archive/Archive.cpp +++ b/tests/standalone/Archive/Archive.cpp @@ -44,7 +44,9 @@ namespace } } - void write_raw_tar(const std::filesystem::path& path, + // Used only when the upstream LibArchive backend is absent; keep it + // compiled so the pure-C++ fallback path is covered in that build. + [[maybe_unused]] void write_raw_tar(const std::filesystem::path& path, std::span entries) { std::ofstream out{path, std::ios::binary | std::ios::trunc}; diff --git a/tests/standalone/Containers/LRU.cpp b/tests/standalone/Containers/LRU.cpp index 4e2ba0f..0ea9f32 100644 --- a/tests/standalone/Containers/LRU.cpp +++ b/tests/standalone/Containers/LRU.cpp @@ -67,7 +67,7 @@ Void::Testing::Test lru_get_promotes_entry() c.put(1, "a"); c.put(2, "b"); c.put(3, "c"); - c.get(1); // promote 1 to MRU + (void)c.get(1); // promote 1 to MRU c.put(4, "d"); // evicts 2 (now LRU) Void::Testing::expect(c.contains(1)); Void::Testing::expect(!c.contains(2)); @@ -106,7 +106,7 @@ Void::Testing::Test lru_peek_does_not_promote() c.put(1, "a"); c.put(2, "b"); c.put(3, "c"); - c.peek(1); // peek 1 but do NOT promote + (void)c.peek(1); // peek 1 but do NOT promote c.put(4, "d"); // evicts 1 (still LRU despite peek) Void::Testing::expect(!c.contains(1)); } diff --git a/tests/standalone/Containers/Ring.cpp b/tests/standalone/Containers/Ring.cpp index 68154a0..833a2f5 100644 --- a/tests/standalone/Containers/Ring.cpp +++ b/tests/standalone/Containers/Ring.cpp @@ -44,7 +44,7 @@ Void::Testing::Test spsc_full_push_returns_false() Void::Testing::Test spsc_fifo_order() { Void::Ring::SpscRing ring; - for (int i = 0; i < 5; ++i) ring.push(i); + for (int i = 0; i < 5; ++i) (void)ring.push(i); for (int i = 0; i < 5; ++i) { const auto v = ring.pop(); Void::Testing::expect(v.has_value()); @@ -61,14 +61,14 @@ Void::Testing::Test spsc_capacity_is_n_minus_one() Void::Testing::Test spsc_full_flag() { Void::Ring::SpscRing ring; - ring.push(1); ring.push(2); ring.push(3); + (void)ring.push(1); (void)ring.push(2); (void)ring.push(3); Void::Testing::expect(ring.full()); } Void::Testing::Test spsc_string_values() { Void::Ring::SpscRing ring; - ring.push(std::string{"hello"}); + (void)ring.push(std::string{"hello"}); const auto v = ring.pop(); Void::Testing::expect(v.has_value()); Void::Testing::expect_eq(*v, std::string{"hello"}); diff --git a/tests/standalone/Net/HttpDuplex.cpp b/tests/standalone/Net/HttpDuplex.cpp index a69f3e7..32cd694 100644 --- a/tests/standalone/Net/HttpDuplex.cpp +++ b/tests/standalone/Net/HttpDuplex.cpp @@ -140,17 +140,6 @@ namespace return true; } - std::size_t count_occurrences(std::string_view haystack, - std::string_view needle) - { - std::size_t count = 0; - std::size_t pos = 0; - while ((pos = haystack.find(needle, pos)) != std::string_view::npos) { - ++count; - pos += needle.size(); - } - return count; - } } // namespace Void::Testing::Test http_duplex_upload_while_reading_fixed_response() diff --git a/tests/standalone/Storage/Storage.cpp b/tests/standalone/Storage/Storage.cpp index 18c1cc0..d9bf939 100644 --- a/tests/standalone/Storage/Storage.cpp +++ b/tests/standalone/Storage/Storage.cpp @@ -441,7 +441,8 @@ Void::Testing::Test storage_wal_recovery_byte_truncation_corruption_and_rotation { TempStorageDir bad_dir; std::filesystem::copy(base_dir.path, bad_dir.path, - std::filesystem::copy_options::overwrite_existing); + std::filesystem::copy_options::recursive | + std::filesystem::copy_options::overwrite_existing); (void)std::filesystem::remove(bad_dir.path / "LOCK"); { auto port = make_posix_file_port();