Skip to content

Run most of test_future on Linux - #4359

Merged
Kenny Kerr (kennykerr) merged 2 commits into
masterfrom
copilot/investigate-test-future-exclusion
May 1, 2026
Merged

Run most of test_future on Linux#4359
Kenny Kerr (kennykerr) merged 2 commits into
masterfrom
copilot/investigate-test-future-exclusion

Conversation

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor

All of test_future was excluded on non-Windows via a blanket #![cfg(windows)] even though most tests only exercise the stock windows-future async implementations, which are pure Rust apart from one internal Waiter and a thread-pool dispatch that already had non-Windows paths.

windows-future

  • New cfg(all(not(windows), feature = "std")) Waiter/WaiterSignaler backed by Arc<(Mutex<bool>, Condvar)> so IAsyncAction::join() works off-Windows.
  • Gated bindings_impl (raw link! decls for CreateEventW/SetEvent/WaitForSingleObject/CloseHandle and HANDLE/BOOL/...) behind #[cfg(windows)].
  • Crate's std feature now also enables windows-threading/std so the std::thread::spawn fallback for submit is actually pulled in.

test_future

  • Replaced use windows::core::* / use windows::Win32::Foundation::* with use windows_core::* plus inline const HRESULT definitions for E_FAIL, E_ILLEGAL_DELEGATE_ASSIGNMENT, E_ILLEGAL_METHOD_CALL, E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED (matches the existing pattern in test_collections). The E_FAIL constant in when.rs is gated #[cfg(windows)] to match its only consumer (the err test).
  • Dropped #![cfg(windows)] from agile, async_info, completed_finished, completed_get, completed_once, completed_started, dropped, progress, started, when, and the empty src/lib.rs.
  • Kept Windows-only:
    • futures.rs — uses Win32 ThreadPool and WinRT Storage::Streams.
    • error.rs and when::err — assert on Error::message(), which only round-trips message text on Windows (via IErrorInfo/OriginateError).
  • Added windows-core to dev-dependencies.

Result on Linux

10 of 12 test binaries now run; 29 cross-platform tests pass. Windows behavior is unchanged — every new branch is gated by #[cfg(windows)] / #[cfg(all(not(windows), feature = "std"))].

Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/3c6b164a-3d99-4fe9-98ea-f76b1c11c19b

Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>
@kennykerr

Copy link
Copy Markdown
Collaborator

Copilot check build

Agent-Logs-Url: https://github.com/microsoft/windows-rs/sessions/f568b4fd-76de-4461-8efb-c44e54445567

Co-authored-by: kennykerr <9845234+kennykerr@users.noreply.github.com>

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Copilot check build

Two CI failures, both fixed in 93e7b72:

  • fmt: crates/tests/libs/future/src/lib.rs was empty (needed a trailing newline).
  • test (stable linux): E_FAIL const in when.rs was unused on Linux because the only consumer (err) is #[cfg(windows)]. Gated the const the same way.

@kennykerr
Kenny Kerr (kennykerr) marked this pull request as ready for review May 1, 2026 12:38
@kennykerr
Kenny Kerr (kennykerr) merged commit fd169cf into master May 1, 2026
29 checks passed
@kennykerr
Kenny Kerr (kennykerr) deleted the copilot/investigate-test-future-exclusion branch May 1, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants