rust-lang / libtest

Rust's built-in testing and benchmarking framework
Apache License 2.0
60 stars 21 forks source link

Fork process for each test case #22

Open nmattia opened 3 years ago

nmattia commented 3 years ago

My test cases sometimes leave zombie threads hanging around, which sometimes causes issues in unrelated test cases. I'd like to be able to run one test case per process for better isolation, until I can make sure all threads are reaped properly. For the moment I am using the following:

  while IFS= read -r exe; do
    echo "found test exe $exe"
    while IFS= read -r test; do
      echo "found test name $test"
      "$exe" --exact "$test"
    done < <("$exe" --list | grep '.*: test$' | sed 's/: test$//g')
  done < <(cat cargo-output.json | jq -cMr 'select(.reason == "compiler-artifact" and .target.kind == [ "test" ]) | .executable')

where cargo-output.json is cargo's message-format output. This is far from ideal, and I'd love support for this in libtest.

Do you reckon there are technical reasons why it can't be made?