mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Enable parallel tests and rearrange TESTS order to take advantage of
the massive speed improvements use a make capable of parallel builds on a multi-CPU machine and pass the right arguments to make (-j10000 for GNU make) to get the build to run in parallel.
This commit is contained in:
@@ -62,6 +62,12 @@
|
||||
# define aligncastconst(type, value) ((const void*)(value))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* During parallel runs of pngstest each temporary file needs a unique name,
|
||||
* this is used to permit uniqueness using a command line argument which can be
|
||||
* up to 22 characters long.
|
||||
*/
|
||||
static char tmpf[23] = "TMP";
|
||||
|
||||
/* Generate random bytes. This uses a boring repeatable algorithm and it
|
||||
* is implemented here so that it gives the same set of numbers on every
|
||||
* architecture. It's a linear congruential generator (Knuth or Sedgewick
|
||||
@@ -3198,7 +3204,7 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
|
||||
static int counter = 0;
|
||||
char name[32];
|
||||
|
||||
sprintf(name, "TMP%d.png", ++counter);
|
||||
sprintf(name, "%s%d.png", tmpf, ++counter);
|
||||
|
||||
if (png_image_write_to_file(&image->image, name, convert_to_8bit,
|
||||
image->buffer+16, (png_int_32)image->stride, image->colormap))
|
||||
@@ -3482,6 +3488,30 @@ main(int argc, char **argv)
|
||||
opts &= ~KEEP_GOING;
|
||||
else if (strcmp(arg, "--strict") == 0)
|
||||
opts |= STRICT;
|
||||
else if (strcmp(arg, "--tmpfile") == 0)
|
||||
{
|
||||
if (c+1 < argc)
|
||||
{
|
||||
if (strlen(argv[++c]) >= sizeof tmpf)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: %s is too long for a temp file prefix\n",
|
||||
argv[0], argv[c]);
|
||||
exit(99);
|
||||
}
|
||||
|
||||
/* Safe: checked above */
|
||||
strcpy(tmpf, argv[c]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: %s requires a temporary file prefix\n",
|
||||
argv[0], arg);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
else if (strcmp(arg, "--touch") == 0)
|
||||
{
|
||||
if (c+1 < argc)
|
||||
@@ -3492,7 +3522,7 @@ main(int argc, char **argv)
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: %s requires a file name argument\n",
|
||||
argv[0], arg);
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
else if (arg[0] == '+')
|
||||
@@ -3500,7 +3530,7 @@ main(int argc, char **argv)
|
||||
png_uint_32 format = formatof(arg+1);
|
||||
|
||||
if (format > FORMAT_COUNT)
|
||||
exit(1);
|
||||
exit(99);
|
||||
|
||||
format_set(&formats, format);
|
||||
}
|
||||
@@ -3508,7 +3538,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: unknown option: %s\n", argv[0], arg);
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3557,7 +3587,7 @@ main(int argc, char **argv)
|
||||
buffer[4095] = 0;
|
||||
fprintf(stderr, "%s...%s: file name too long\n", buffer,
|
||||
buffer+(4096-32));
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3676,7 +3706,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: write failed\n", touch);
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3684,7 +3714,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: open failed\n", touch);
|
||||
exit(1);
|
||||
exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3695,6 +3725,7 @@ main(int argc, char **argv)
|
||||
int main(void)
|
||||
{
|
||||
fprintf(stderr, "pngstest: no read support in libpng, test skipped\n");
|
||||
return 0;
|
||||
/* So the test is skipped: */
|
||||
return 77;
|
||||
}
|
||||
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
|
||||
|
||||
Reference in New Issue
Block a user