From 0c7e8e2503d4630ad8f1f952c8b552881b31e1bd Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Wed, 13 Jan 2016 11:07:01 -0800 Subject: cmd/run: Fix fork mode when given exclude patterns If a user requests exactly one test on the command line, then Crucible automatically disables forking to ease debugging. The Bug: Crucible incorrectly disabled forking when the user gave crucible-run exactly one test pattern, and the pattern was an exclude pattern. --- src/cmd/run.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cmd/run.c b/src/cmd/run.c index 0d4dda6..510c555 100644 --- a/src/cmd/run.c +++ b/src/cmd/run.c @@ -174,10 +174,28 @@ done_getopt: } } +// Do the command line args specify exactly one test? static bool one_test(void) { - return test_patterns.len == 1 && !strstr(test_patterns.data[0], "*"); + if (test_patterns.len > 1) + return false; + + const char *first_pattern = test_patterns.data[0]; + + if (first_pattern[0] == '!') { + // From the crucible-run(1) man page: + // + // If the first given pattern is an exclude pattern, then Crucible + // inserts an implied "*" as the first pattern. + return false; + } + + // A glob may match multiple tests. + if (strstr(test_patterns.data[0], "*")) + return false; + + return true; } static uint32_t -- cgit v1.2.3