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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joachim Schmitz venit, vidit, dixit 16.10.2012 16:13:
>> From: Michael J Gruber [mailto:git@xxxxxxxxxxxxxxxxxxxx]
>> Sent: Tuesday, October 16, 2012 1:40 PM
>> To: git@xxxxxxxxxxxxxxx
>> 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@xxxxxxxxxxxxxxxxxxxx>
>> ---
>> 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?

Yikes.

If we introduce a make variable TIME_COMMAND_PATH we can even get rid of
2/4 (but have to change Makefile or t/Makefile).

>> 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
> 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]