tools/coredump: allow running tests on darwin#621
tools/coredump: allow running tests on darwin#621christos68k merged 15 commits intoopen-telemetry:mainfrom
Conversation
|
I think, there are more changes needed to reach this point: |
Maybe change the title and say non-linux open source systems!? I guess supporting Windows builds just adds more complexity without gaining any value. |
|
It is not just Windows. |
yes, they are in different packages. I want the change to be small and self contained and revertable just in case |
|
@korniltsev Please be more specific in the PR title. |
Thanks, updated |
It would gain the same value as darwin. |
There was a problem hiding this comment.
maybe rename the file to debug_linux.go
|
Just had an idea similar tohttps://github.com//pull/625. Maybe instead of introducing build tags, we can split the package - move the ptrace specific code into a separate ptrace package |
|
Before approving this, I would like to have the complete picture in terms of how the code structure is changing and also the build system. In principle, I'm not against enabling limited compilation on non-Linux systems, but not if it comes with a lot of extra complexity and potential support headaches. The profiler only works on Linux [1] and that's where the focus should be. @korniltsev If you have multiple PRs in mind, then I'd delay approving/merging until you open all of them so we can look at them as a whole. [1] Technically it also works inside Docker-on-macOS as that spins up a Linux kernel that supports eBPF that's shared across containers running on the same macOS host. Maybe it also works on WSL2. |
|
I dont have any more new PRs in mind regarding this. There are 2 things I want to do.
Together they allow compiling and running coredump tests. The tests fail with an unexpected SIGURG signal - that would require another fix. Thats it. This will enable running a big and useful subset of unit tests without spawning virtual machines. |
|
To add a bit more on my previous comment: I see 2 possible solutions to what I am trying to achieve.
Do you have any other ideas how this could be done? |
|
lets maybe try a different approach - I've closed all my other PRs and consolidated everything here. Now the tests can be run with I'd appreciate another round of reviews and discussions. 🙏 |
|
|
||
| import "debug/elf" | ||
|
|
||
| const currentMachine = elf.EM_X86_64 |
There was a problem hiding this comment.
I would probably move these currentMachine things to pfelf as CurrentMachine. They are occasionally needed in other parts too.
There was a problem hiding this comment.
Applied. Though I could not find where to use them in other parts after a quick search.
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | ||
| with: | ||
| path: tools/coredump/modulecache | ||
| key: coredumps-macos-${{ hashFiles('tools/coredump/testdata/*/*.json') }} |
There was a problem hiding this comment.
Does the key need to be separate from others? I think this could be shared, because only the actual downloaded files are in the cache. There's nothing linux/mac specific.
There was a problem hiding this comment.
Thanks. Replaced the key with arm64 to be shared.
There was a problem hiding this comment.
I don't fully understand the restore-keys options though. It feels like they are never used
| updatePoolQueueCap = 8 | ||
| ) | ||
|
|
||
| // EbpfHandler provides the functionality to interact with eBPF maps. |
There was a problem hiding this comment.
If I understand correctly, this and rest of this PR is about separating EbpfHandler interface out from the processmanager/ebpf so that the interface can be included elsewhere without pulling in the actual ebpf code which does not compile?
Could we do this the otherway around? Just move this interface to some other package like processmanager/ebpfapi? Need to also check how this kind of split is done elsewhere.
There was a problem hiding this comment.
If I understand correctly, this and rest of this PR is about separating EbpfHandler interface out from the processmanager/ebpf so that the interface can be included elsewhere without pulling in the actual ebpf code which does not compile?
Yes, this is correct in regards the changes in the pmebpf package.
There are some other changes in the process package, but they are slightly different - solving the compilation issues with build tags. I do think it makes sense to split process into processapi in a similar way you suggested ebpfapi - let me know if you think we should do this within the same change or as a separate or at all.
There was a problem hiding this comment.
Could we do this the otherway around? Just move this interface to some other package like processmanager/ebpfapi? Need to also check how this kind of split is done elsewhere.
Yes, this should work. Applied
Similar to #612This will eventually help allowing running some unit tests (for example coredump tests) without spawning a full linux OS on non linux systems (at least darwin,maybe windows)This PR makes running coredump tests on darwin possible
GODEBUG=asyncpreemptoff=1 go test -v ./tools/coredump/.