0

There are several tests under proxy/v1_specific. I have to run them in sequential, since these tests have some influence with each other.

cargo test --package tests --test proxy v1_specific::test1
cargo test --package tests --test proxy v1_specific::test2
cargo test --package tests --test proxy v1_specific::test3

I wonder if there are some magic arguments --magic=level that

cargo test --package tests --test proxy v1_specific --magic=1
# Equivalence
cargo test --package tests --test proxy v1_specific::test1
cargo test --package tests --test proxy v1_specific::test2
cargo test --package tests --test proxy v1_specific::test3

and

cargo test --package tests --test proxy v1_specific --magic=2
# Equivalence
cargo test --package tests --test proxy v1_specific::test1::subtest1
cargo test --package tests --test proxy v1_specific::test1::subtest2
cargo test --package tests --test proxy v1_specific::test2::subtest1
cargo test --package tests --test proxy v1_specific::test3::subtest1

I know by --job=1, I can run them sequentially. However, I may want all subtests in v1_specific::test1 to be run in parallel.

cafce25
  • 15,907
  • 4
  • 25
  • 31
calvin
  • 2,125
  • 2
  • 21
  • 38
  • @JonasFassbender No, I still want subtests inside `v1_specific::test1` to be run in parallel. – calvin Mar 28 '23 at 14:44

1 Answers1

2

Use --test-threads=1 or use Mutex to manually run the function sequentially.

Nishanth P
  • 21
  • 1
  • 2
  • I'm not sure a mutex would work, as different test files are usually compiled into separate binaries and thus do not share the same statics. However, a file lock should work. – Filipe Rodrigues May 29 '23 at 10:53