Skip to content

tests: internal: Windows support fix, build: SIMD detection fix#11604

Merged
edsiper merged 2 commits intofluent:masterfrom
mabrarov:feature/test_task_map_windows
Mar 23, 2026
Merged

tests: internal: Windows support fix, build: SIMD detection fix#11604
edsiper merged 2 commits intofluent:masterfrom
mabrarov:feature/test_task_map_windows

Conversation

@mabrarov
Copy link
Contributor

@mabrarov mabrarov commented Mar 22, 2026

Changes


Testing

Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change.
  • [N/A] Debug log output from testing the change.
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found.
  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature.

Backporting

  • [N/A] Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Tests
    • Improved Windows test infrastructure to ensure proper network/socket initialization before event loop startup.
  • Chores
    • Adjusted SIMD detection logic in build configuration to more accurately enable SIMD only on appropriate 64-bit targets.

Signed-off-by: Marat Abrarov <abrarov@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

📝 Walkthrough

Walkthrough

Added Windows-specific Winsock initialization to test setup (WSAStartup in test_ctx_create) and tightened x86_64 SIMD detection in CMake to require pointer size > 4. No public APIs changed.

Changes

Cohort / File(s) Summary
Windows Socket Initialization
tests/internal/task_map.c
Declare WSADATA and call WSAStartup(0x0201, &wsa_data) in test_ctx_create() on Windows before creating the event loop.
Build detection
CMakeLists.txt
Tightened x86_64/AMD64 SIMD auto-detection by requiring CMAKE_SIZEOF_VOID_P GREATER 4 in addition to CMAKE_SYSTEM_PROCESSOR checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • edsiper
  • cosmo0920
  • niedbalski
  • patrick-stephens
  • celalettin1286

Poem

🐰 I hopped into tests at dawn,
Woke Winsock gently on the lawn,
A tiny startup, quick and neat,
Now event loops and sockets meet,
Hooray — the build’s now bright and drawn ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title covers two distinct changes: Windows support for tests/internal/task_map.c and SIMD detection fix in CMakeLists.txt, matching the raw summary.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/internal/task_map.c (1)

42-44: Consider checking the return value of WSAStartup.

WSAStartup can fail and returns a non-zero error code on failure. While the subsequent mk_event_loop_create will likely fail and be caught by TEST_CHECK, explicitly checking the return improves debuggability on Windows.

Additionally, for completeness, a matching WSACleanup() call could be added to test_ctx_destroy. For short-lived test processes this is less critical, so it's optional.

♻️ Suggested improvement
 `#ifdef` _WIN32
-    WSAStartup(0x0201, &wsa_data);
+    if (WSAStartup(0x0201, &wsa_data) != 0) {
+        TEST_MSG("WSAStartup failed");
+        flb_config_exit(ret_ctx->config);
+        flb_free(ret_ctx);
+        return NULL;
+    }
 `#endif`

And optionally in test_ctx_destroy:

int test_ctx_destroy(struct test_ctx* ctx)
{
    if (!TEST_CHECK(ctx != NULL)) {
        return -1;
    }

    if (ctx->config) {
        flb_config_exit(ctx->config);
    }

    flb_free(ctx);
`#ifdef` _WIN32
    WSACleanup();
`#endif`
    return 0;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/internal/task_map.c` around lines 42 - 44, The WSAStartup call in
tests/internal/task_map.c is not checked and may fail silently; update the
initialization (WSAStartup(...)) to capture and assert its return value
(non-zero indicates failure) so tests fail with a clear message, and optionally
add a matching WSACleanup() in test_ctx_destroy (or corresponding teardown
function) to release Winsock resources; reference the WSAStartup call in the
test initialization and the test_ctx_destroy teardown function when making these
changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/internal/task_map.c`:
- Around line 42-44: The WSAStartup call in tests/internal/task_map.c is not
checked and may fail silently; update the initialization (WSAStartup(...)) to
capture and assert its return value (non-zero indicates failure) so tests fail
with a clear message, and optionally add a matching WSACleanup() in
test_ctx_destroy (or corresponding teardown function) to release Winsock
resources; reference the WSAStartup call in the test initialization and the
test_ctx_destroy teardown function when making these changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18c74644-ce5b-4394-9555-16565cb89ad9

📥 Commits

Reviewing files that changed from the base of the PR and between 0b0118b and e76e3ec.

📒 Files selected for processing (1)
  • tests/internal/task_map.c

Signed-off-by: Marat Abrarov <abrarov@gmail.com>
@mabrarov mabrarov changed the title tests: internal: task_map Windows support tests: internal: task_map, build: Windows support fix Mar 22, 2026
@mabrarov mabrarov changed the title tests: internal: task_map, build: Windows support fix tests: internal: task_map, build: SIMD detection fix Mar 22, 2026
@mabrarov mabrarov changed the title tests: internal: task_map, build: SIMD detection fix tests: internal: task_map Windows support fix, build: SIMD detection fix Mar 22, 2026
@mabrarov mabrarov changed the title tests: internal: task_map Windows support fix, build: SIMD detection fix tests: internal: Windows support fix, build: SIMD detection fix Mar 22, 2026
@cosmo0920 cosmo0920 added this to the Fluent Bit v5.0 milestone Mar 23, 2026
@edsiper edsiper merged commit f1bea81 into fluent:master Mar 23, 2026
80 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants