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

RE: [RFC/PATCH 3/4] test-lib: provide lazy TIME_COMMAND prereq

From
Joachim Schmitz <jojo@schmitz-digital.de>
Date
Oct 16, 2012, 14:13 UTC
Message-ID
<007001cdaba8$5afc6c00$10f54400$@schmitz-digital.de>
In-Reply-To
<0140f3f2f2f4bded6868f4082bef0c36e9a8560e.1350387132.git.git@drmicha.warpmail.net>
Show 16 quoted lines
> From: Michael J Gruber [mailto:git@drmicha.warpmail.net]
> Sent: Tuesday, October 16, 2012 1:40 PM
> To: git@vger.kernel.org
> Cc: Joachim Schmitz; Junio C Hamano
> Subject: [RFC/PATCH 3/4] test-lib: provide lazy TIME_COMMAND prereq
> 
> Some test want to use the time command (not the shell builtin) and test
> for its availability at /usr/bin/time.
> 
> Provide a lazy prereq TIME_COMMAND which tests for /usr/bin/time and
> /bin/time. If any is found, set TEST_COMMAND_PATH to the first match.
> 
> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
> ---
> Rather than iterating over 2 or more hardcoded paths, one could use
> "test -P time" or allow a make variable TIME_COMMAND_PATH whose

test -P time won't work for me: test -P: unary operator expected

I do have another one in /usr/local/bin, maybe that could get added too?
Show 25 quoted lines
> executability is checked by the prereq. I really don't know what's best.
> 
>  t/test-lib.sh | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 489bc80..7977c15 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -738,6 +738,13 @@ test_lazy_prereq UTF8_NFD_TO_NFC '
>  	esac
>  '
> 
> +test_lazy_prereq TIME_COMMAND '
> +	for command in /usr/bin/time /bin/time
> +	do
> +		test -x "$command" && break
> +	done && TIME_COMMAND_PATH="$command"
> +'
> +
>  # When the tests are run as root, permission tests will report that
>  # things are writable when they shouldn't be.
>  test -w / || test_set_prereq SANITY
> --
> 1.8.0.rc2.304.g9f3ac5c
Previous: Michael J GruberNext: Michael J Gruber
Message 8 of 17 in “t3302-notes-index-expensive.sh and t3419-rebase-patch-id.sh need time in /usr/bin”
  1. Joachim SchmitzOct 15, 2012
  2. 0/4 Allow different time commandsMichael J Gruber, Oct 16, 2012
  3. 1/4 t3419-rebase-patch-id: heed USR_BIN_TIME prereqMichael J Gruber, Oct 16, 2012
  4. Junio C HamanoOct 16, 2012
  5. 2/4 test-lib: allow variable export from lazy prereq testsMichael J Gruber, Oct 16, 2012
  6. Junio C HamanoOct 16, 2012
  7. 3/4 test-lib: provide lazy TIME_COMMAND prereqMichael J Gruber, Oct 16, 2012
  8. Joachim SchmitzOct 16, 2012
  9. Michael J GruberOct 16, 2012
  10. Joachim SchmitzOct 16, 2012
  11. test-lib: provide lazy TIME_COMMAND prereqMichael J Gruber, Oct 16, 2012
  12. Andreas SchwabOct 16, 2012
  13. Stefano LattariniOct 16, 2012
  14. Johannes SixtOct 16, 2012
  15. Junio C HamanoOct 16, 2012
  16. Junio C HamanoOct 16, 2012
  17. 4/4 t3302,t3419: use the TIME_COMMAND prereqMichael J Gruber, Oct 16, 2012

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.