[Mesa-dev] [PATCH 4/7] glsl/tests: changes to test_disk_cache_create test

Emil Velikov emil.l.velikov at gmail.com
Wed Jan 31 15:02:20 UTC 2018


On 31 January 2018 at 13:55, Tapani Pälli <tapani.palli at intel.com> wrote:
>
>
> On 31.01.2018 15:51, Tapani Pälli wrote:
>>
>>
>>
>> On 31.01.2018 15:41, Emil Velikov wrote:
>>>
>>> On 31 January 2018 at 07:17, Tapani Pälli <tapani.palli at intel.com> wrote:
>>>
>>>> -   /* Before doing anything else, ensure that with
>>>> -    * MESA_GLSL_CACHE_DISABLE set to true, that disk_cache_create
>>>> returns NULL.
>>>> -    */
>>>> -   setenv("MESA_GLSL_CACHE_DISABLE", "true", 1);
>>>> -   cache = disk_cache_create("test", "make_check", 0);
>>>> -   expect_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DISABLE
>>>> set");
>>>>
>>> We want to ensure that cache can be disabled. If needed, can we tweak
>>> i965/other places instead?
>>
>>
>> Oops yep I think this test can be left as is, cache will be NULL when
>> MESA_GLSL_CACHE_DISABLE is set.
>>
>>>
>>>> -   /* Test with XDG_CACHE_HOME set */
>>>> -   setenv("XDG_CACHE_HOME", CACHE_TEST_TMP "/xdg-cache-home", 1);
>>>> -   cache = disk_cache_create("test", "make_check", 0);
>>>> -   expect_null(cache, "disk_cache_create with XDG_CACHE_HOME set with"
>>>> -               "a non-existing parent directory");
>>>> -
>>>
>>>
>>>> -   /* Test with MESA_GLSL_CACHE_DIR set */
>>>> -   err = rmrf_local(CACHE_TEST_TMP);
>>>> -   expect_equal(err, 0, "Removing " CACHE_TEST_TMP);
>>>> -
>>>
>>>
>>>
>>>> -   mkdir(CACHE_TEST_TMP, 0755);
>>>> -   cache = disk_cache_create("test", "make_check", 0);
>>>> -   expect_non_null(cache, "disk_cache_create with MESA_GLSL_CACHE_DIR
>>>> set");
>>>> -
>>>
>>>
>>> Why did these tests disappear? Might be having a dull moment, but I
>>> cannot see why they won't work. Even with the lazy indexing.
>>>
>>
>> Because the cache struct will be there when you call disk_cache_create
>> whatever the environment variables are, it's just that set/get won't then do
>> anything. Well .. if you really want these, these could be modified to use
>> set/get and then check that NULL is received?
>>
>
> Just to explain a bit more .. what I did is that I added positive tests
> (that those env vars can be used to control cache) but removed negative
> tests that cache would not get generated when path is something impossible.
>
Right. Since indexing is delayed [create -> get/set/has, with create
returning non-null] we can tweak the negative tests in similar way.

It might look strange, since we're detecting disk cache creation by
trying to fetch/insert data.
Yet, we will still be testing that that Mesa isn't doing stupid things
wrt folder management :-)

-Emil


More information about the mesa-dev mailing list