summaryrefslogtreecommitdiff
path: root/t/README
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-10-18 00:23:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-18 20:18:36 (GMT)
commitf21ac368f15b0a4df301c65a9a603c4e57277f57 (patch)
treea5d17cd5a35192536fe89c55235bbf2b2faae393 /t/README
parentd4a392452e292ff924e79ec8458611c0f679d6d4 (diff)
downloadgit-f21ac368f15b0a4df301c65a9a603c4e57277f57.zip
git-f21ac368f15b0a4df301c65a9a603c4e57277f57.tar.gz
git-f21ac368f15b0a4df301c65a9a603c4e57277f57.tar.bz2
test-lib: allow selecting tests by substring/glob with --run
Many of our test scripts have several "setup" tests. It's a lot easier to say ./t0050-filesystem.sh --run=setup,9 in order to run all the setup tests as well as test #9, than it is to track down what all the setup tests are and enter all their numbers in the list. Also, I often find myself wanting to run just one or a couple tests from the test file, but I don't know the numbering of any of the tests -- to get it I either have to first run the whole test file (or start counting by hand or figure out some other clever but non-obvious tricks). It's really convenient to be able to just look at the test description(s) and then run ./t6416-recursive-corner-cases.sh --run=symlink or ./t6402-merge-rename.sh --run='setup,unnecessary update' Add such an ability to test selection which relies on merely matching against the test description. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/README')
-rw-r--r--t/README48
1 files changed, 31 insertions, 17 deletions
diff --git a/t/README b/t/README
index 2adaf7c..c730a70 100644
--- a/t/README
+++ b/t/README
@@ -258,16 +258,21 @@ For an individual test suite --run could be used to specify that
only some tests should be run or that some tests should be
excluded from a run.
-The argument for --run is a list of individual test numbers or
-ranges with an optional negation prefix that define what tests in
-a test suite to include in the run. A range is two numbers
-separated with a dash and matches a range of tests with both ends
-been included. You may omit the first or the second number to
-mean "from the first test" or "up to the very last test"
-respectively.
-
-Optional prefix of '!' means that the test or a range of tests
-should be excluded from the run.
+The argument for --run, <test-selector>, is a list of description
+substrings or globs or individual test numbers or ranges with an
+optional negation prefix (of '!') that define what tests in a test
+suite to include (or exclude, if negated) in the run. A range is two
+numbers separated with a dash and matches a range of tests with both
+ends been included. You may omit the first or the second number to
+mean "from the first test" or "up to the very last test" respectively.
+
+The argument to --run is split on commas into separate strings,
+numbers, and ranges, and picks all tests that match any of the
+individual selection criteria. If the substring of the description
+text that you want to match includes a comma, use the glob character
+'?' instead. For example --run='rebase,merge?cherry-pick' would match
+on all tests that match either the glob *rebase* or the glob
+*merge?cherry-pick*.
If --run starts with an unprefixed number or range the initial
set of tests to run is empty. If the first item starts with '!'
@@ -275,9 +280,6 @@ all the tests are added to the initial set. After initial set is
determined every test number or range is added or excluded from
the set one by one, from left to right.
-Individual numbers or ranges could be separated either by a space
-or a comma.
-
For example, to run only tests up to a specific test (21), one
could do this:
@@ -290,7 +292,7 @@ or this:
Common case is to run several setup tests (1, 2, 3) and then a
specific test (21) that relies on that setup:
- $ sh ./t9200-git-cvsexport-commit.sh --run='1 2 3 21'
+ $ sh ./t9200-git-cvsexport-commit.sh --run='1,2,3,21'
or:
@@ -298,17 +300,17 @@ or:
or:
- $ sh ./t9200-git-cvsexport-commit.sh --run='-3 21'
+ $ sh ./t9200-git-cvsexport-commit.sh --run='-3,21'
As noted above, the test set is built by going through the items
from left to right, so this:
- $ sh ./t9200-git-cvsexport-commit.sh --run='1-4 !3'
+ $ sh ./t9200-git-cvsexport-commit.sh --run='1-4,!3'
will run tests 1, 2, and 4. Items that come later have higher
precedence. It means that this:
- $ sh ./t9200-git-cvsexport-commit.sh --run='!3 1-4'
+ $ sh ./t9200-git-cvsexport-commit.sh --run='!3,1-4'
would just run tests from 1 to 4, including 3.
@@ -317,6 +319,18 @@ test in the test suite except from 7 up to 11:
$ sh ./t9200-git-cvsexport-commit.sh --run='!7-11'
+Sometimes there may be multiple tests with e.g. "setup" in their name
+that are needed and rather than figuring out the number for all of them
+we can just use "setup" as a substring/glob to match against the test
+description:
+
+ $ sh ./t0050-filesystem.sh --run=setup,9-11
+
+or one could select both the setup tests and the rename ones (assuming all
+relevant tests had those words in their descriptions):
+
+ $ sh ./t0050-filesystem.sh --run=setup,rename
+
Some tests in a test suite rely on the previous tests performing
certain actions, specifically some tests are designated as
"setup" test, so you cannot _arbitrarily_ disable one test and