diff options
-rw-r--r-- | doc/crucible-run.1.txt | 14 | ||||
-rw-r--r-- | misc/crucible-completion.bash | 14 | ||||
-rw-r--r-- | src/crucible/cru_cmd_run.c | 6 | ||||
-rw-r--r-- | src/crucible/cru_runner.c | 4 | ||||
-rw-r--r-- | src/crucible/cru_runner.h | 1 |
5 files changed, 37 insertions, 2 deletions
diff --git a/doc/crucible-run.1.txt b/doc/crucible-run.1.txt index 6b639e8..045eca0 100644 --- a/doc/crucible-run.1.txt +++ b/doc/crucible-run.1.txt @@ -10,7 +10,7 @@ SYNOPSIS -------- [verse] *crucible run* [--fork|--no-fork] [--no-cleanup] [--dump|--no-dump] - [<pattern>...] + [--[no-]separate-cleanup-threads] [<pattern>...] DESCRIPTION ----------- @@ -39,6 +39,18 @@ OPTIONS --use-spir-v:: Use SPIR-V shaders when available. +--[no-]separate-cleanup-threads [default: enabled]:: + If enabled, then the test's "result" thread [1] will create a new thread + in which to run the test's cleanup handlers. If disabled, then the cleanup + handlers will run directly in the "result" thread. + + + This option is useful for detecting and investigating driver bugs that + occur when objects are created in one thread and destroyed in another. + + + [fn1] The test's "result" thread is the one that chooses the test result, + thus ending the test, usually by calling functions t_pass(), t_fail(), or + t_assert(). + EXAMPLES -------- * Run all tests (except example tests). diff --git a/misc/crucible-completion.bash b/misc/crucible-completion.bash index 018840d..f9db1d1 100644 --- a/misc/crucible-completion.bash +++ b/misc/crucible-completion.bash @@ -17,7 +17,19 @@ __crucible_ls_tests() __crucible_run() { - COMPREPLY=($(compgen -W "--help --fork --no-fork --dump --no-dump --no-cleanup --use-spir-v $($1 ls-tests)" -- ${COMP_WORDS[COMP_CWORD]})) + local flags=" + --help + --fork + --no-fork + --separate-cleanup-threads + --no-separate-cleanup-threads + --dump + --no-dump + --no-cleanup + --use-spir-v + " + + COMPREPLY=($(compgen -W "$flags $($1 ls-tests)" -- ${COMP_WORDS[COMP_CWORD]})) } __crucible() diff --git a/src/crucible/cru_cmd_run.c b/src/crucible/cru_cmd_run.c index c491e58..4030648 100644 --- a/src/crucible/cru_cmd_run.c +++ b/src/crucible/cru_cmd_run.c @@ -28,6 +28,7 @@ static int opt_fork = 1; static int opt_no_cleanup = 0; static int opt_dump = 0; static int opt_use_spir_v = 0; +static int opt_separate_cleanup_thread = 1; // From man:getopt(3) : // @@ -51,6 +52,10 @@ static const struct option longopts[] = { {"dump", no_argument, &opt_dump, true}, {"no-dump", no_argument, &opt_dump, false}, {"use-spir-v", no_argument, &opt_use_spir_v, true}, + + {"separate-cleanup-threads", no_argument, &opt_separate_cleanup_thread, true}, + {"no-separate-cleanup-threads", no_argument, &opt_separate_cleanup_thread, false}, + {0}, }; @@ -109,6 +114,7 @@ cmd_start(const cru_command_t *cmd, int argc, char **argv) cru_runner_do_forking = opt_fork; cru_runner_do_cleanup_phase = !opt_no_cleanup; + cru_runner_use_separate_cleanup_threads = opt_separate_cleanup_thread; cru_runner_do_image_dumps = opt_dump; cru_runner_use_spir_v = opt_use_spir_v; diff --git a/src/crucible/cru_runner.c b/src/crucible/cru_runner.c index 2891b9d..ca930ba 100644 --- a/src/crucible/cru_runner.c +++ b/src/crucible/cru_runner.c @@ -130,6 +130,7 @@ bool cru_runner_do_forking = true; bool cru_runner_do_cleanup_phase = true; bool cru_runner_do_image_dumps = false; bool cru_runner_use_spir_v = false; +bool cru_runner_use_separate_cleanup_threads = true; static void set_sigint_handler(sighandler_t handler) @@ -351,6 +352,9 @@ run_test_def(const cru_test_def_t *def) if (cru_runner_use_spir_v) cru_test_enable_spir_v(test); + if (!cru_runner_use_separate_cleanup_threads) + cru_test_disable_separate_cleanup_thread(test); + cru_test_start(test); cru_test_wait(test); result = cru_test_get_result(test); diff --git a/src/crucible/cru_runner.h b/src/crucible/cru_runner.h index dab272f..76e929f 100644 --- a/src/crucible/cru_runner.h +++ b/src/crucible/cru_runner.h @@ -29,6 +29,7 @@ extern bool cru_runner_do_forking; extern bool cru_runner_do_cleanup_phase; extern bool cru_runner_do_image_dumps; extern bool cru_runner_use_spir_v; +extern bool cru_runner_use_separate_cleanup_threads; void cru_runner_enable_cleanup(bool b); void cru_runner_enable_image_dumps(bool b); |