git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] test-lib: GIT_TEST_ONLY to run only specific tests

From
Philip Oakley <philipoakley@iee.org>
Date
Mar 3, 2014, 15:23 UTC
Message-ID
<A85165F7C59F4572AB131A02D0E09698@PhilipOakley>
In-Reply-To
<1393842298-5944-2-git-send-email-ilya.bobyr@gmail.com>
Minor nits.
From: "Ilya Bobyr" <ilya.bobyr@gmail.com>
Show 27 quoted lines
> This is a counterpart to GIT_SKIP_TESTS.  Mostly useful when 
> debugging.
> ---
> t/README      |   15 +++++++++++++++
> t/test-lib.sh |    8 ++++++++
> 2 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/t/README b/t/README
> index caeeb9d..f939987 100644
> --- a/t/README
> +++ b/t/README
> @@ -187,6 +187,21 @@ and either can match the "t[0-9]{4}" part to skip 
> the whole
> test, or t[0-9]{4} followed by ".$number" to say which
> particular test to skip.
>
> +Sometimes the opposite is desired - ability to execute only one or
> +several tests.  Mostly while debugging tests.  For that you can say
> +
> +    $ GIT_TEST_ONLY=t9200.8 sh ./t9200-git-cvsexport-commit.sh
> +
> +or, similrary to GIT_SKIP_TESTS
> +
> +    $ GIT_TEST_ONLY='t[0-4]??? t91?? t9200.8' make
> +
> +In additiona to matching against "<test suite number>.<test number>"
> +GIT_TEST_ONLY is matched against just the test .  This comes
s/numbes/numbers/
> +handy when you are running only one test:
s/handy/in handy/
Show 26 quoted lines
> +
> +    $ GIT_TEST_ONLY='[0-8]' sh ./t9200-git-cvsexport-commit.sh
> +
> Note that some tests in the existing test suite rely on previous
> test item, so you cannot arbitrarily disable one and expect the
> remainder of test to check what the test originally was intended
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 89a405b..12bf436 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -464,6 +464,14 @@ test_skip () {
>  fi
>  skipped_reason="missing $missing_prereq${of_prereq}"
>  fi
> + if test -z "$to_skip" && test -n "$GIT_TEST_ONLY" &&
> + ! match_pattern_list $this_test.$test_count $GIT_TEST_ONLY &&
> + ! match_pattern_list $test_count $GIT_TEST_ONLY
> + then
> + to_skip=t
> + skipped_reason="not in GIT_TEST_ONLY"
> + fi
> +
>  case "$to_skip" in
>  t)
>  say_color skip >&3 "skipping test: $@"
> -- 
Philip 
Previous: Ilya BobyrNext: Eric Sunshine
Message 3 of 17 in “test-lib: tests skipped by GIT_SKIP_TESTS say so”
  1. 1/2 test-lib: tests skipped by GIT_SKIP_TESTS say soIlya Bobyr, Mar 3, 2014
  2. 2/2 test-lib: GIT_TEST_ONLY to run only specific testsIlya Bobyr, Mar 3, 2014
  3. Philip OakleyMar 3, 2014
  4. Eric SunshineMar 3, 2014
  5. Ilya BobyrMar 3, 2014
  6. Junio C HamanoMar 3, 2014
  7. Ilya BobyrMar 3, 2014
  8. Junio C HamanoMar 4, 2014
  9. Ilya BobyrMar 4, 2014
  10. Junio C HamanoMar 4, 2014
  11. Ilya BobyrMar 4, 2014
  12. Junio C HamanoMar 4, 2014
  13. Philip OakleyMar 3, 2014
  14. Ilya BobyrMar 3, 2014
  15. Eric SunshineMar 3, 2014
  16. Ilya BobyrMar 3, 2014
  17. Junio C HamanoMar 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.