nimdigger: build nim at any revision since v0.12.0~157, 1 liner git bisect to help find regressions#18119
nimdigger: build nim at any revision since v0.12.0~157, 1 liner git bisect to help find regressions#18119timotheecour wants to merge 23 commits intonim-lang:develfrom
nimdigger: build nim at any revision since v0.12.0~157, 1 liner git bisect to help find regressions#18119Conversation
git bisect to help find regressionsnimdigger: build nim at any revision since v0.12.0~157, 1 liner git bisect to help find regressions
Varriount
left a comment
There was a problem hiding this comment.
This looks like a really useful tool! The source code could use some polishing though.
In particular, I think some identifiers could be changed to make the code more readable, and certain functions could be split up to increase code organization.
| result = outp | ||
| stripLineEnd(result) | ||
|
|
||
| macro ctor(obj: untyped, a: varargs[untyped]): untyped = |
There was a problem hiding this comment.
I feel that this is unnecessary - the amount of typing it saves is minimal compared to the decreased readability and increased mental parsing required. Also, it's only used once in the entire file.
There was a problem hiding this comment.
I'm also using this in nim-lang/fusion#32 and intend to add it to std/sugar in subsequent PR which will refactor its different uses.
There was a problem hiding this comment.
The name should be sugar.construct IMO.
There was a problem hiding this comment.
I still feel that the tradeoff between writeability and readability limits its usefulness though. In the cases where it would be useful (types with only a few fields) the fact that it's a macro significantly limits its usefulness - the reader must mentally adjust their expectations when they see the macro being used. In cases where there are types with many fields, it's almost always a better idea to explicitly show which values are being used for each field, as the reader is less likely to know the order of the fields.
There was a problem hiding this comment.
I don't understand this remark but we can discuss this in an RFC about how we should have sugar.construct.
There was a problem hiding this comment.
renamed to construct, RFC left TODO
| let make = "gmake" | ||
| else: | ||
| let make = "make" |
There was a problem hiding this comment.
Does this handle Windows systems?
There was a problem hiding this comment.
i don't have windows; can you please try?
There was a problem hiding this comment.
note that azure-pipelines.yml runs on windows and calls nimBuildCsourcesIfNeeded which calls this, so with the right setup, this should work on windows; a windows user will have to confirm though (and future work by a windows user can improve windows support)
There was a problem hiding this comment.
This will work if the user is using WSL (which they may not be, if they are using Nim to build Windows executables).
There was a problem hiding this comment.
so please try on windows and report back with how to improve windows support :)
| if opt.bisectBugfix: | ||
| msg2 = fmt"! ({msg2})" # negate exit code | ||
| let bisectCmd2 = fmt"{exe} --compileNim && ( {msg2} )" | ||
| runCmd(fmt"git -C {state.nimDir.quoteShell} bisect run bash -c {bisectCmd2.quoteShell}") |
There was a problem hiding this comment.
This is not cross-platform. Git should be able to run the command without using a shell.
There was a problem hiding this comment.
can't windows subsystem for linux work here? (as done with azure-pipelines.yml on windows) Otherwise, I think this can be addressed in followup PR by people more familiar with windows (unless you have a concrete suggestion that makes it work for windows)
|
Some other thoughts on this:
|
It's necessary; an important design goal for nimdigger is isolation; it allows checking out revisions/bisecting without impacting your own git repo; it's much cleaner and safer to have nimdigger manage its own Nim/csources/csources_v1 repo (that can be wiped if needed) rather than reuse a users Nim checkout (which typically won't care about csources anymore since newer nim versions rely on csources_v1, not csources). Less risk of user data corruption etc.
as I mentioned in #18119 (comment), this should be handled instead as an API added to
since #17829, |
dom96
left a comment
There was a problem hiding this comment.
Is there a reason this needs to be in the Nim repo? I would push back against including it here and instead having it as its own standalone Nimble package.
22e210c to
3d00bfb
Compare
|
I will test it on Windows. Not sure whether it should be a Nimble package or not, but it probably should. Nim core developers can be expected to type |
|
Fusion ?. 🤔 |
|
After some thought, I do agree with Araq that this should be a separate, installable utility. |
|
@juancarlospaco why? It's trivial to install via Nimble and if for some reason it's not then we should fix Nimble. I think we should close this, this utility doesn't need to be in the same repo as the compiler. |
|
I'm ok with a separate nimble package and linking to it in internal docs, I'll first address remaining comments and then update this PR accordingly |
|
+1 for this being a standalone nimble package. |
3d00bfb to
7c3f0e6
Compare
|
@Araq done with all comments, now working on moving this to a separate repo; how about fusion/tools/nimdigger? the goal being to avoid multiplying repos (fewer repos has benefits eg code reuse, less boilerplate wrt testing, doc publishing, more potential contributors etc); note that fusion/tools/nimdigger is intended to also be usable as a library this would then be runnable via: or if this assumes ppl are ok with allowing fusion to have some modules with these dependencies:
if not, then i'll just make a separate nimble package for simplicity noteI expect other similar tools to be added in future, eg nimdustmite (#8276) |
Separate Nimble package please but feel free to name the nimble package in preparation for much more code/utilities of yours. We both agree on the value mono-repos. |
0776b78 to
bffca2e
Compare
nimdiggeris a tool to:care of details such as figuring out automatically the correct csources/csources_v1 revision to use.
design goals
git bisectworkflows, or to build nim at past revisions$HOME/.nimdigger/cache/Nimexamples
build at any revision >= v0.12.0~157
find a which commit introduced a regression
find a which commit introduced a bugfix
actual examples
for regression #16376:
copy this snippet to /tmp/t16376.nim:
for regression #16496:
for regression #18113:
speed
the more you use the tool, the faster it gets because binaries get cached, eg re-running this takes 10 seconds:
links
./koch bisecttimotheecour/Nim#702future work
--dump:output.json(refsnimdigger: build nim at any revision since v0.12.0~157, 1 linergit bisectto help find regressions #18119 (comment))