Subject: Re: Git Test Coverage Report (Tuesday, Sept 25)

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Thu, 27 Sep 2018 17:38:26 +0200

On Thu, Sep 27 2018, Derrick Stolee wrote:

> On 9/27/2018 11:21 AM, Ben Peart wrote:
>>
>>
>> On 9/26/2018 2:54 PM, Derrick Stolee wrote:
>>>
>>> GIT_TEST_INDEX_THREADS=1
>>>
>>
>> Because the test repos are so small (ie smaller than 10K files), the
>> test suite already executes as if GIT_TEST_INDEX_THREADS=1 is set
>> (ie single threaded). I added the test variable so that the
>> multi-threading code could be forced to execute in spite of the
>> default minimum number of files logic.
>>
>> I'd recommend you set GIT_TEST_INDEX_THREADS=3 instead. (3 because 1
>> thread is used for loading the index extensions and we need 2 or
>> more threads available to exercise multi-threaded loading of the
>> index entries).
>
> According to t/README, GIT_TEST_INDEX_THREADS is a boolean and setting
> it to 1 causes us to use 3 threads:
>
>  GIT_TEST_INDEX_THREADS=<boolean> forces multi-threaded loading of
>  the index cache entries and extensions for the whole test suite.
>
> Here is the only consumption of the variable in the product code (in
> read-cache.c):
>
>  /* enable testing with fewer than default minimum of entries */
>  if (istate->cache_nr > 1 && nr_threads < 3 &&
> git_env_bool("GIT_TEST_INDEX_THREADS", 0))
>  nr_threads = 3;
>
> This was non-obvious to me, and I had originally set it to a larger
> number. I happened to notice the boolean nature while I was looking up
> the rest of the GIT_TEST_* variables.

I didn't know it worked like that. Would be neat if we had some "strict
bool" function in config.c that would accept on/true/1 off/false/0 but
barf on e.g. 12345 instead of treating it as just another synonym for 1,
I'd say we could even enable it by default, but maybe not, but
definitely for all this GIT_TEST_* stuff.