-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failing to discover Benchmarks when package root path is not named Benchmarks
.
#263
Comments
I assume you have a separate Package.swift for the Benchmarks subfolder? In that case it would be expected,
Is this what's happening, or do you have some repo I can look at? |
https://github.com/vanvoorden/2024-08-28 @hassila Here is an example of a directory structure to repro what I was seeing:
Here I have a "root" folder (
I see no benchmarks listed. When I then move my Swift file into an arbitrary subdirectory like this (and specify the
Now I see the Benchmark when I run I am unblocked with this workaround for now. I don't think this needs to be a high-priority fix… but I ran in to this problem a few times when trying to set up benchmarks before I found out the pattern that was causing these benchmarks to go missing. |
I think there might be an opportunity here to maybe clarify the documentation. While it is true that all benchmarks must reside in a Benchmarks directory, the package also (currently) makes some assumptions about the directory structure inside that Benchmarks directory and engineers might not be prepared for that. For example, this version fails to detect any valid benchmarks:
After setting the This version does detect valid benchmarks:
After setting the This version does not detect valid benchmarks:
After setting the This seems to be an artifact of the algorithm in I am unblocked on this because it is trivial for me to shuffle around the files and directories in my package… but there might be an opportunity here to expand the documentation with more details about this behavior so that new engineers trying to get started with Benchmarks do not get blocked on this situation where benchmarks are "disappearing" and not being detected. |
https://github.com/ordo-one/package-benchmark/blob/main/Plugins/BenchmarkCommandPlugin/BenchmarkCommandPlugin.swift#L310-L321
I seem to be running into situations where a
Benchmarks
package that should build with valid benchmarks fails to find any. I seem to be running into this code which filters Benchmarks by removing the last file path component.The trouble seems to be when my
Benchmarks.swift
is already defined in[Root]/Benchmarks
(where [Root] is the root directory of my swift package). At that point, the code inBenchmarkCommandPlugin.swift
seems to be removing the leafBenchmarks
and only continuing if the root of the swift package is equal to "Benchmarks".I am unblocked with a workaround: I can define a subdirectory in
Benchmarks
. At that point, I have something like[root]/Benchmarks/Benchmarks
. TheBenchmarkCommandPlugin.swift
removes the leaf directory and continues running my benchmarks.The text was updated successfully, but these errors were encountered: