Build: Fix regression test concurrency issues

- The example-*bit-*-decompress test must run after the
  example-*bit-*-compress test, since the latter generates
  testout*-example.jpg.

- Add -static to the filenames of all output files generated by the
  "static" regression tests, to avoid conflicts with the "shared"
  regression tests.

- Add the PID to the filenames of all files generated by the tjunittest
  packed-pixel image I/O tests.

- Check the return value of MD5File() in tjunittest to avoid a segfault
  if the file doesn't exist.  (Prior to the fix described above, that
  could occur if two instances of tjunittest ran concurrently from the
  same directory with the same -bmp and -precision arguments.)

Fixes #705
This commit is contained in:
DRC
2023-07-06 12:04:22 -04:00
parent d011622f4b
commit 035ea386d1
2 changed files with 12 additions and 6 deletions

View File

@@ -977,8 +977,8 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf,
THROW("Could not allocate memory");
initBitmap(buf, width, pitch, height, pf, bottomUp);
SNPRINTF(filename, 80, "test_bmp%d_%s_%d_%s.%s", precision, pixFormatStr[pf],
align, bottomUp ? "bu" : "td", ext);
SNPRINTF(filename, 80, "test_bmp%d_%s_%d_%s_%d.%s", precision, pixFormatStr[pf],
align, bottomUp ? "bu" : "td", getpid(), ext);
if (precision == 8) {
TRY_TJ(handle, tj3SaveImage8(handle, filename, (unsigned char *)buf, width,
pitch, height, pf));
@@ -990,6 +990,10 @@ static int doBmpTest(const char *ext, int width, int align, int height, int pf,
width, pitch, height, pf));
}
md5sum = MD5File(filename, md5buf);
if (!md5sum) {
printf("\n Could not determine MD5 sum of %s\n", filename);
retval = -1; goto bailout;
}
if (strcasecmp(md5sum, md5ref))
THROW_MD5(filename, md5sum, md5ref);