Skip to content

Commit 3570569

Browse files
tests: clang-tidy clean six single-finding test files
- test_log_env, test_thread_pool, test_decode_budget: reserve before the fill loops - legacy_qwen35: HALO_CHECK that the decoder layer has FFN weights before *l.ffn - test_template_limits: deep() takes const std::string& - test_vk_host: starts_with('/') char overload Test-only. clang-tidy on these files: 6 findings before, 0 after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9784310 commit 3570569

6 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎tests/unit/core/test_log_env.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class LogEnv : public ::testing::Test {
6666
}
6767
env.insert(env.end(), vars.begin(), vars.end());
6868
std::vector<char*> envp;
69+
envp.reserve(env.size() + 1);
6970
for (auto& e : env) envp.push_back(e.data());
7071
envp.push_back(nullptr);
7172
std::string exe = HALO_LOG_ENV_HELPER;

‎tests/unit/cpu_kernels/test_thread_pool.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ TEST(ThreadPool, ConcurrentExternalCallersAreSerializedCorrectly) {
9595
std::atomic<long> total{0};
9696
{
9797
std::vector<std::jthread> callers;
98+
callers.reserve(4);
9899
for (int c = 0; c < 4; ++c) {
99100
callers.emplace_back([&] {
100101
for (int r = 0; r < 50; ++r) {

‎tests/unit/models/legacy_qwen35.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ struct LegacyQwen35::Impl {
324324
mixer(ConstRows(std::span<const float>(xn), R, E), Rows(std::span(y), R, E));
325325
cpu::add(x, ConstRows(std::span<const float>(y), R, E), x, pool);
326326
rms_norm(x, l.post_norm, Rows(std::span(xn), R, E), cost);
327+
HALO_CHECK(l.ffn.has_value(), ErrorCode::Model, "qwen35: decoder layer has no FFN weights");
327328
ffn(*l.ffn, ConstRows(std::span<const float>(xn), R, E), Rows(std::span(y), R, E), cost);
328329
cpu::add(x, ConstRows(std::span<const float>(y), R, E), x, pool);
329330
cost.activation_bytes += 2 * cpu::traffic_binary(R * E).total();

‎tests/unit/perf/test_decode_budget.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ class BatchedThroughput : public ::testing::Test {
772772
double concurrent_ms() {
773773
std::vector<GenerateResult> results(kSlots);
774774
std::vector<std::thread> threads;
775+
threads.reserve(kSlots);
775776
const auto t0 = std::chrono::steady_clock::now();
776777
for (std::size_t i = 0; i < kSlots; ++i) {
777778
threads.emplace_back([&, i] { results[i] = run_one(static_cast<std::int32_t>('a' + i)); });

‎tests/unit/template/test_template_limits.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ TEST(TemplateLimitsUnit, ReplaceAndSplitKeepUpstreamSemantics) {
380380
// ---- parse-side hardening beyond the table -----------------------------------------------
381381

382382
TEST_F(TemplateRows, ParseDepthCoversEveryRecursivePath) {
383-
const auto deep = [](std::string src) {
383+
const auto deep = [](const std::string& src) {
384384
return [src] { const ChatTemplate t(src, {}, {}, rows()); };
385385
};
386386
const std::size_t n = 2000;

‎tests/unit/vulkan/test_vk_host.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ TEST(VkShaders, AllExpectedShadersEmbeddedWithValidHashes) {
6565
EXPECT_EQ(s->spirv[0], 0x07230203u) << s->name << ": not SPIR-V (magic)";
6666
EXPECT_EQ(s->sha256.size(), 64u) << s->name;
6767
EXPECT_TRUE(hv::verify_shader(*s)) << s->name << ": embedded hash does not match the bytes";
68-
EXPECT_FALSE(s->source_path.starts_with("/")) << "absolute path embedded: " << s->source_path;
68+
EXPECT_FALSE(s->source_path.starts_with('/')) << "absolute path embedded: " << s->source_path;
6969
std::cout << "[vk-shader] " << s->name << " (" << s->source_path << ") " << s->spirv.size_bytes()
7070
<< " B sha256=" << s->sha256 << "\n";
7171
}

0 commit comments

Comments
 (0)