summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@intel.com>2016-01-13 11:07:01 -0800
committerChad Versace <chad.versace@intel.com>2016-01-13 11:07:15 -0800
commit0c7e8e2503d4630ad8f1f952c8b552881b31e1bd (patch)
tree7ffddf022d13e2392ddb23b7abcff7efbf8ccd67
parent3a4dbd15016af4136842e4054ddebabb17829d3f (diff)
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.
-rw-r--r--src/cmd/run.c20
1 files changed, 19 insertions, 1 deletions
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