JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.9k stars 5.49k forks source link

Document how to run tests on Base after `Revise.track(Base)` #35596

Open goretkin opened 4 years ago

goretkin commented 4 years ago

I'm not sure, but it seems like the Base tests (via Base.runtests) are not running against changes that are picked up by Revise.

https://github.com/JuliaLang/julia/blob/86ee57cdd77d402ea63108c16df7117d0ce83dc7/CONTRIBUTING.md#modifying-base-more-efficiently-with-revisejl

timholy commented 4 years ago

Demo? It should work. You probably also noticed the make test-revise option.

goretkin commented 4 years ago

I noticed that part of the manual, but it didn't immediately make sense to me because I didn't jump from "target" to "make target". So thanks for bringing it up. I'll see if I can't clarify that for other readers.

I still don't really understand the subsequent wording, however.

load any modifications to Base into the current process before running the corresponding test

There would be no current process in the context of running make, right? Should it say "current system image"?

timholy commented 4 years ago

Not sure I understand your question. This should work in either of two modes:

goretkin commented 4 years ago

If I make a change to a base file, and then do make test-revise-sometest, there is "no current process" to load changes into. I don't have Julia running. My guess is that it meant to say a current system image.

My original issue was that I expected Base.runtests("sometest") to pull in changes via Revise. And it does not. Here's a screencast: https://asciinema.org/a/ZShKxYebRvCPM3SkDXti53Y0j

timholy commented 4 years ago

Thanks for the screencast. For the Revised version to be used, you have to run the test in the current process, i.e., via include("test/hashing.jl") rather than Base.runtests("hashing"). The difference is the former runs in the current process, the latter starts a fresh Julia process that doesn't by default bring in the changes.

We could add a keyword argument to Base.runtests that would trigger revision using the code already in test/choosetests.jl and test/runtests.jl.

goretkin commented 4 years ago

Thanks for explaining that Base.runtests runs in a new process. I guess that's like Pkg.test.

Regarding the second point, I should have quoted in full:

For convenience, there are also test-revise- targets for every test- target that use Revise to load any modifications to Base into the current process before running the corresponding test

This also starts a fresh Julia process that does bring in the changes. I don't understand what "current process" could possibly mean here.

timholy commented 4 years ago

I don't understand what "current process" could possibly mean here.

This was probably tweaked from earlier versions, so it may not be the best choice of phrasing. Really it means "into the process that will actually run the tests."