libtest icon indicating copy to clipboard operation
libtest copied to clipboard

Fork process for each test case

Open nmattia opened this issue 5 years ago • 0 comments

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?

nmattia avatar Nov 02 '20 10:11 nmattia