-
-
Notifications
You must be signed in to change notification settings - Fork 285
[RFC] Allow Pkg.test to pass command-line arguments to test/runtests.jl #1226
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
Conversation
|
I like it. We'll have to discuss a bit on the exact API for the command line args but this feels pretty ok. |
|
bors try |
tryAlready running a review |
tryBuild succeeded |
|
We probably also want to be able to give julia startup command line options. For example |
We're going with |
|
We're going with |
|
Is it not better with or something, i.e. using |
|
We're going with |
Could we support both? Maybe something like: But yeah I definitely agree that we should implement this in a separate pull request. |
|
That looks quite a bit worse to me. At that point, shouldn't you just be calling the test script manually? |
|
I agree, we have not even had a feature request for customizing julia flags |
Fair enough. So if we add REPL support, it will only be for test args. |
|
I've made the requested changes! Also, in the interest of "eating our own dog food", I've updated the |
If you want to run a test script manually with julia I think you have to Pkg.add() all of the deps and extras for the package before it will work, so it could be a moderate pain to do. Kind of off-topic: Could solve that in another PR by exposing (if they are not already exposed) some functions for getting the right LOAD_PATH from a Project.toml (like activate, but including extras, and possibly not actually changing LOAD_PATH for you, just returning what you should use). An extra use case for this is running ancillary test scripts (e.g. |
This is exposed(ish) in Julia 1.2; you can there run tests as |
|
As mentioned on slack, I think that would require copying the Project.toml to the test directory and making some manual changes first. |
|
I think what @fredrikekre is referring to is that in Julia 1.2 and higher, you specify the test dependencies in |
|
Looks pretty good now, but
can we undo that? I don't think that is necessary and just results in a huge diff. |
Alright I think I've reverted all of those changes! |
|
bors try |
Co-authored-by: Dilum Aluthge <dilum@aluthge.com> Co-authored-by: Fredrik Ekre <ekrefredrik@gmail.com>
|
I simplified the tests, and fixed running the old code-path. bors try |
tryAlready running a review |
tryBuild failed |
|
bors r+ |
|
This is really neat, thanks! Also, my +1 to Pkg REPL support for |
813: improve formatting of simtime and endtime in logging r=simonbyrne a=simonbyrne # Description Switches to using a fixed format for printing simtime and endtime, and print denominator in callback. Old: ``` ┌ Info: Update │ simtime = 2.6159163716067161e+02 │ runtime = 00:01:59 └ norm(Q) = 3.0116687421160989e+09 ``` New: ``` ┌ Info: Update │ simtime = 15.34 / 1000.00 │ runtime = 00:28:31 └ norm(Q) = 3.0115880375677762e+09 ``` <!--- Please leave the following section ---> # For review by CLIMA developers - [x] There are no open pull requests for this already - [x] CLIMA developers with relevant expertise have been assigned to review this submission - [ ] The code conforms to the [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and has consistent naming conventions - [ ] This code does what it is technically intended to do (all numerics make sense physically and/or computationally) 815: Make tests flexibly callable r=charleskawczynski a=charleskawczynski <!-- Thanks for submitting code to CLIMA, the Climate Machine. Before continuing, please be sure you have: 1. Written and run all necessary tests with CLIMA by including `tests/runtests.jl` 2. Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) 3. Identified key contributors to review this submission --> # Description This adds flexibility to call specific tests, using [command line args](JuliaLang/Pkg.jl#1226). Now, we can call a specific test as follows ``` julia --project test/runtests.jl Common Starting tests for Common Starting tests for MoistThermodynamics [ Info: CUDAdrv.jl failed to initialize, GPU functionality unavailable (set JULIA_CUDA_SILENT or JULIA_CUDA_VERBOSE to silence or expand this message) Completed tests for MoistThermodynamics, 30 seconds elapsed Starting tests for PlanetParameters Completed tests for PlanetParameters, 0 seconds elapsed Completed tests for Common, 31 seconds elapsed Test Summary: | Pass Total CLIMA | 457 457 ``` # For review by CLIMA developers - [x] There are no open pull requests for this already - [x] CLIMA developers with relevant expertise have been assigned to review this submission - [ ] The code conforms to the [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and has consistent naming conventions - [ ] This code does what it is technically intended to do (all numerics make sense physically and/or computationally) Co-authored-by: Simon Byrne <simonbyrne@gmail.com> Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
802: Add `ParameterSets` r=charleskawczynski a=charleskawczynski <!-- Thanks for submitting code to CLIMA, the Climate Machine. Before continuing, please be sure you have: 1. Written and run all necessary tests with CLIMA by including `tests/runtests.jl` 2. Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) 3. Identified key contributors to review this submission --> # Description Adds `ParameterSets`, for flexibly handling - Planet constants - Free parameters This should allow us to compute planet constants, or free parameters, in a flexible way. Specifically, we aim to be able to overload methods such as - `grav(::AbstractParameterSet)` (a planet constant) or - `C_smag(::AbstractParameterSet)` (a free parameter) in the driver. <!--- Please leave the following section ---> # For review by CLIMA developers - [x] There are no open pull requests for this already - [x] CLIMA developers with relevant expertise have been assigned to review this submission - [ ] The code conforms to the [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and has consistent naming conventions - [ ] This code does what it is technically intended to do (all numerics make sense physically and/or computationally) 811: Replaces `forcecpu` with `init_on_cpu` for clarity r=akshaysridhar a=akshaysridhar <!-- Thanks for submitting code to CLIMA, the Climate Machine. Before continuing, please be sure you have: 1. Written and run all necessary tests with CLIMA by including `tests/runtests.jl` 2. Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) 3. Identified key contributors to review this submission --> # Description Replaces instances of `forcecpu` keyword with `init_on_cpu` to clarify its functionality. It only enables initialisation on CPU, and does not force the run to be on CPU. (use cases: Currently CPU initialisation needs to be enabled when using random number generators for the initial condition) <!--- Please leave the following section ---> # For review by CLIMA developers - [x] There are no open pull requests for this already - [x] CLIMA developers with relevant expertise have been assigned to review this submission - [ ] The code conforms to the [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and has consistent naming conventions - [x] This code does what it is technically intended to do (all numerics make sense physically and/or computationally) 815: Make tests flexibly callable r=charleskawczynski a=charleskawczynski <!-- Thanks for submitting code to CLIMA, the Climate Machine. Before continuing, please be sure you have: 1. Written and run all necessary tests with CLIMA by including `tests/runtests.jl` 2. Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) 3. Identified key contributors to review this submission --> # Description This adds flexibility to call specific tests, using [command line args](JuliaLang/Pkg.jl#1226). Now, we can call a specific test as follows ``` julia --project test/runtests.jl Common Starting tests for Common Starting tests for MoistThermodynamics [ Info: CUDAdrv.jl failed to initialize, GPU functionality unavailable (set JULIA_CUDA_SILENT or JULIA_CUDA_VERBOSE to silence or expand this message) Completed tests for MoistThermodynamics, 30 seconds elapsed Starting tests for PlanetParameters Completed tests for PlanetParameters, 0 seconds elapsed Completed tests for Common, 31 seconds elapsed Test Summary: | Pass Total CLIMA | 457 457 ``` # For review by CLIMA developers - [x] There are no open pull requests for this already - [x] CLIMA developers with relevant expertise have been assigned to review this submission - [ ] The code conforms to the [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and has consistent naming conventions - [ ] This code does what it is technically intended to do (all numerics make sense physically and/or computationally) Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com> Co-authored-by: asraero <asridhar@caltech.edu>
815: Make tests flexibly callable r=charleskawczynski a=charleskawczynski <!-- Thanks for submitting code to CLIMA, the Climate Machine. Before continuing, please be sure you have: 1. Written and run all necessary tests with CLIMA by including `tests/runtests.jl` 2. Followed all necessary [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) 3. Identified key contributors to review this submission --> # Description This adds flexibility to call specific tests, using [command line args](JuliaLang/Pkg.jl#1226). Now, we can call a specific test as follows ``` julia --project test/runtests.jl Common Starting tests for Common Starting tests for MoistThermodynamics [ Info: CUDAdrv.jl failed to initialize, GPU functionality unavailable (set JULIA_CUDA_SILENT or JULIA_CUDA_VERBOSE to silence or expand this message) Completed tests for MoistThermodynamics, 30 seconds elapsed Starting tests for PlanetParameters Completed tests for PlanetParameters, 0 seconds elapsed Completed tests for Common, 31 seconds elapsed Test Summary: | Pass Total CLIMA | 457 457 ``` # For review by CLIMA developers - [x] There are no open pull requests for this already - [x] CLIMA developers with relevant expertise have been assigned to review this submission - [ ] The code conforms to the [style guidelines](https://climate-machine.github.io/CLIMA/latest/CodingConventions.html) and has consistent naming conventions - [ ] This code does what it is technically intended to do (all numerics make sense physically and/or computationally) Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
Fixes #518
Fixes #981
Fixes #1241
In a source build of Julia, you can run specific test sets as such:
In a binary install, you can accomplish the same thing with:
Base.runtests(tests)accomplishes this (see here) by passing the contents of the first positional argumenttestas the command line arguments totest/runtests.jl.However, as far as I can tell, there is currently no functionality built into
Pkgthat allows you to pass any arguments to a package'stest/runtests.jlfile when running the package tests.This pull request adds two features:
juliaprocess that runs a package's tests. The flags are specified in thejulia_flagskeyword argument toPkg.test.test/runtests.jl. The arguments are specified in thetest_argskeyword argument toPkg.testand are available insidetest/runtests.jlasARGS[1],ARGS[2], etc.Example usage:
This pull request only adds the functionality for passing the command line arguments to
test/runtests.jl. It is up to the author of a package to add the logic for processing the command line arguments inside theirtest/runtests.jlfile. However, this should be relatively straightforward. For example, if this is the currenttest/runtests.jlfile:Then you could modify it to look like this:
And now if you run
Pkg.test("HelloWorld"; test_args = ["foo", "baz"]), then only thefooandbaztestsets will be run.