Skip to content

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Feb 4, 2025

internal: add IsWindows constant

Add an IsWindows constant and move the existing OnLinux constant to a new
internal package. This avoids a circular dependency between testutils.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>

internal/fdtrace: rename to testmain and add windows trace logging

The eBPF for Windows runtime logs traces and error messages to the Windows
event subsystem. Being able to correlate test failures with this trace is
very useful to diagnose problems.

On Windows, start an event tracing session before starting the tests, and
dump a summary to stderr after tests have finished.

The summary looks roughly like this:

      base       _get_map_descriptor_properties returned success
     entry-exit _ebpf_core_protocol_map_delete_element
   ! base       _ebpf_core_protocol_map_delete_element returned error  
Error=19

The exclamation mark in the first column indicates an error.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>

internal/testutils: make feature test helpers platform agnostic

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>

@lmb lmb force-pushed the windows-testutils branch 2 times, most recently from 69ef4f1 to 115bad7 Compare February 5, 2025 08:39
@lmb lmb marked this pull request as ready for review February 5, 2025 08:46
@lmb lmb requested review from florianl, mmat11, rgo3 and a team as code owners February 5, 2025 08:46
Copy link
Contributor

@rgo3 rgo3 left a comment

Choose a reason for hiding this comment

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

Just a couple of nits and questions, otherwise LGTM.

Can you refresh my memory on if we already have a guide to test windows changes as a Linux user? I would be intrigued to follow it once I find some cycles in the next couple of weeks.

return nil
}

wpr := exec.Command("wpr.exe", "-stop", file, "-instancename", ts.session)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the wpr.exe executable available by default on windows systems? There is at least one other shell-out in this PR, the same question applies there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question, I think wpr.exe does ship with Windows:

PS C:\Users\lorenz> (get-command wpr.exe).Path
C:\Windows\system32\wpr.exe

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wpr.exe does come out of the box: https://learn.microsoft.com/en-us/windows-hardware/test/wpt/introduction-to-wpr#wpr-command-line-and-user-interface

WPR.exe ships with Windows OS (Windows 8.1 or later) and you do not need additional installation.

Netsh seems to be the ip equivalent: https://learn.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh

PS C:\Users\lorenz> (get-command netsh.exe).Path
C:\Windows\system32\netsh.exe

lmb added 3 commits February 12, 2025 11:26
Add an IsWindows constant and move the existing OnLinux constant to
a new internal package. This avoids a circular dependency between
testutils.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
The eBPF for Windows runtime logs traces and error messages to the
Windows event subsystem. Being able to correlate test failures with
this trace is very useful to diagnose problems.

On Windows, start an event tracing session before starting the tests,
and dump a summary to stderr after tests have finished.

The summary looks roughly like this:

      base       _get_map_descriptor_properties returned success
      entry-exit _ebpf_core_protocol_map_delete_element
    ! base       _ebpf_core_protocol_map_delete_element returned error   Error=19

The exclamation mark in the first column indicates an error.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@lmb lmb force-pushed the windows-testutils branch from 115bad7 to f00d38b Compare February 12, 2025 11:27
@lmb
Copy link
Collaborator Author

lmb commented Feb 12, 2025

Can you refresh my memory on if we already have a guide to test windows changes as a Linux user?

I have one written up on a local branch, but I don't want to merge it before I'm ready to pronounce basic Windows support to be there.

@lmb lmb merged commit 63f3f14 into cilium:main Feb 12, 2025
18 checks passed
@lmb lmb deleted the windows-testutils branch February 12, 2025 11:48
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