Kazunobu Kuriyama wrote:

> "make test" changes $HOME during the test to avoid polluting user files
> (setup.vim:12 and test_gui.vim:15).
> 
> Although the change itself causes no functional problem in executing the
> test at all, there's a case where it can be unexpectedly troublesome.  Let
> me explain this first.
> 
> Both GTK2 and 3 GUIs rely on fontconfig to choose and load fonts, and the
> latter uses cache to make its font search fast enough.
> 
> When fontconfig cannot find cache, it tries creating caches, visiting all
> prescribed directories and examining every font file found there.
> 
> The resulting caches are usually placed at /var/cache/fontconfig/ for the
> system and $HOME/.cache/fontconfig for the user.
> 
> Now suppose that a user has installed his favorite font in $HOME/.fonts/,
> and has named it as default, and that he or the system has updated the
> caches as usual.  Now do "make test_gui".  Then, since the system-wide
> cache doesn't know about the named font at all, and since there's no cache
> found in $HOME/.cache due/ to the $HOME change done by the test, fontconfig
> gets confused and decides to create new caches.
> 
> That makes test_gui anything but smiley :)
> 
> As long as my PC is concerned, it takes ~2 minutes with ~1.5GB RAM
> consumption and ~100% single core CPU usage for fontconfig to finish
> creating new caches.  At first glance, it looked to me as if the PC was
> going to crash because of its sudden restless but faint noises out of the
> hard disk and an unusual rapid increase of memory consumption.  Probably,
> you can easily imagine how much I was upset by that at that time :)
> 
> A workaround to that is actually simple and easy: Specify the user cache
> path on the command-line explicitly and run the test like this: "make
> XDG_CACHE_HOME=$HOME/.cache test", thereby taking advantage of the XDG
> specs which can be paraphrased into this: Let $XDG_CACHE_HOME take
> precedence over $HOME/.cache if the former is defined and a non-empty
> string.
> 
> Note that, when the $XDG_CACHE_HOME is defined, $HOME points to the genuine
> home directory (= the home directory for the one who invokes "make test"),
> and
> that the $XDG_CACHE_HOME is not subject to any subsequent $HOME changes.
> Therefore, even if $HOME is changed wildly by the test, the $XDG_CACHE_HOME
> is kept pointing to the same ~/.cache/ where the existing caches reside.
> 
> The attached patch is for making the workaround handy, that is, when
> $XDG_CACHE_HOME is undefined or set to an empty string, "make test"
> automatically sets it to .cache in the genuine $HOME.

Thanks for looking into this.

I hope we can get some more tests for the GUI, coverage is still quite
low.

-- 
Why isn't there mouse-flavored cat food?

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui