Commit a8c4fc5e authored by Keith Packard's avatar Keith Packard Committed by Akira TAGOH

Add delays to test-bz106632, check UptoDate separately

On a file system with one-second time stamps, extra delays are needed
between cache modification operations to ensure that fontconfig isn't
fooled.

And, when the timestamps are checked correctly, we need to make sure
that FcConfigUptoDate returns false whenever we change a font
directory, so separate that out from the call to reinitialize the core
config.
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent 2a81aa51
......@@ -191,7 +191,7 @@ main (void)
mkdir_p ((const char *) cachedir);
fprintf (stderr, "D: Copying %s to %s\n", FONTFILE, fontdir);
snprintf (cmd, 512, "cp -a %s %s", FONTFILE, fontdir);
snprintf (cmd, 512, "sleep 1; cp -a %s %s; sleep 1", FONTFILE, fontdir);
(void) system (cmd);
fprintf (stderr, "D: Loading a config\n");
......@@ -220,15 +220,21 @@ main (void)
goto bail;
}
fprintf (stderr, "D: Removing %s\n", fontdir);
snprintf (cmd, 512, "rm -f %s%s*; sleep 1", fontdir, FC_DIR_SEPARATOR_S);
snprintf (cmd, 512, "sleep 1; rm -f %s%s*; sleep 1", fontdir, FC_DIR_SEPARATOR_S);
(void) system (cmd);
fprintf (stderr, "D: Reinitializing\n");
if (!FcConfigUptoDate (config) || !FcInitReinitialize ())
if (FcConfigUptoDate(config))
{
fprintf (stderr, "E: Unable to reinitialize\n");
fprintf (stderr, "E: Config reports up-to-date\n");
ret = 2;
goto bail;
}
if (!FcInitReinitialize ())
{
fprintf (stderr, "E: Unable to reinitialize\n");
ret = 3;
goto bail;
}
if (FcConfigGetCurrent () == config)
{
fprintf (stderr, "E: config wasn't reloaded\n");
......@@ -259,10 +265,16 @@ main (void)
goto bail;
}
fprintf (stderr, "D: Copying %s to %s\n", FONTFILE, fontdir);
snprintf (cmd, 512, "cp -a %s %s; sleep 1", FONTFILE, fontdir);
snprintf (cmd, 512, "sleep 1; cp -a %s %s; sleep 1", FONTFILE, fontdir);
(void) system (cmd);
fprintf (stderr, "D: Reinitializing\n");
if (!FcConfigUptoDate (config) || !FcInitReinitialize ())
if (FcConfigUptoDate(config))
{
fprintf (stderr, "E: Config up-to-date after addition\n");
ret = 3;
goto bail;
}
if (!FcInitReinitialize ())
{
fprintf (stderr, "E: Unable to reinitialize\n");
ret = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment