On the new readme for ninja tools this are the test instructions:
To run all tests at once, from the top-level folder:
tools\ninja check on Windows).
You can also run specific checks. For example, if you see during the checks
check:svelte:editor is failing, you can use
Looking at the code, I figured out the target for rust tests would be
ninja check:rust_test, but after the first build, running it takes 60 seconds:
# ninja check:rust_test
Finished dev [unoptimized + debuginfo] target(s) in 1.17s
[2/2; 1 active; 61.140s] check:rust_test
The output looks like it was built in 1 second and took 60 seconds running tests. How can I tell ninja only to run a single test file? For example, if I am creating a new test inside the file
anki/rslib/src/card_rendering/parser.rs, how could I only run the tests for that file instead of all rust code tests?
- What's a good way to fake time to simulate reviews in tests?
- Test has different results when run singly vs run with all tests
- Can't run cargo test
Building the Rust tests will depend on the speed of your machine - I see about 8s here for a no-change build:
dae@dtop:code/desktop/anki% ./ninja check:rust_test
Finished dev [unoptimized + debuginfo] target(s) in 0.10s
[2/2; 1 active; 8.080s] check:rust_test
You can save a bit of time by invoking cargo directly, which avoids rebuilding the Python library.
dae@dtop:code/desktop/anki% time cargo test -p anki > /dev/null
Compiling anki v0.0.0 (/home/dae/Work/code/desktop/anki/rslib)
Finished test [unoptimized + debuginfo] target(s) in 3.53s
Running unittests src/lib.rs (/home/dae/Local/rust/debug/deps/anki-0afea6626d330407)
cargo test -p anki > /dev/null 8.14s user 13.04s system 405% cpu 5.222 total
You can also do that by running a unit test inside VS Code with the play button.
Thanks. I will try that next time I need to run rust tests and report here if I find how to improve performance.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.