Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 24, 2025

Problem

Windows functions (WinsatTest and WindowsDDTest) had inconsistent fallback behavior compared to Linux/macOS when no admin permissions were detected. While Linux/macOS functions would first attempt the STREAM method before falling back to mbw, Windows functions would directly use mbw, missing the opportunity to use the higher-performance STREAM test.

This inconsistency meant Windows users without admin privileges couldn't benefit from STREAM testing even when the binaries were available.

Solution

Cross-Platform StreamTest Implementation

  • Moved StreamTest and parseStreamOutput functions from macos_linux_mem.go to a new cross-platform stream.go file
  • Added Windows-specific binary names including .exe extensions:
    streamBinaries := []string{
        "./stream-windows-amd64.exe",
        "./stream.exe", 
        "stream-windows-amd64.exe",
        "stream.exe",
        // ... fallback to non-.exe variants
    }

Updated Windows Functions

Modified both WinsatTest and WindowsDDTest to follow the same fallback pattern as Linux/macOS:

// Try STREAM first when no admin permission, fallback to mbw if not available
streamResult := StreamTest(language)
if streamResult != "" && strings.TrimSpace(streamResult) != "" {
    return streamResult
}
return simpleMemoryTest(language)

Testing

  • All existing tests continue to pass
  • Added comprehensive cross-platform tests to verify consistent behavior
  • Manual verification confirms Windows functions now attempt STREAM before mbw fallback

Impact

Windows users without admin privileges now have the same testing priority as Linux/macOS users:

  1. STREAM (highest performance, no admin required)
  2. mbw fallback (if STREAM unavailable)

This ensures consistent, optimal memory testing across all supported platforms.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hits.spiritlhl.net
    • Triggering command: /home/REDACTED/.cache/go-build/39/3903d80438db21a5bd2ae033e5b068e9e20cfca4e9cb50f1788ed73dff28f37f-d/main -m auto -l en (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@spiritLHLS spiritLHLS marked this pull request as ready for review September 24, 2025 13:57
Copilot AI changed the title [WIP] 当前检测到系统无admin权限时也应当优先尝试stream方法先,而不是直接使用mbw Fix Windows admin permission fallback to prioritize STREAM before mbw Sep 24, 2025
Copilot AI requested a review from spiritLHLS September 24, 2025 14:06
@spiritLHLS spiritLHLS merged commit e12dce9 into main Sep 24, 2025
@spiritLHLS spiritLHLS deleted the copilot/fix-5796f145-4631-4c39-bc4f-36b196ba0e49 branch September 24, 2025 14:11
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