commit:     f1262eb805ad6edd39cdff9fa0a84c9874c342e5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  7 02:10:06 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul  7 02:10:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1262eb8

media-libs/libjpeg-turbo: keyword 3.0.0 (w/ fixed tests)

No revbump for test fix as it's purely for tests (no runtime fixes).

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/libjpeg-turbo-3.0.0-tests.patch          | 97 ++++++++++++++++++++++
 .../libjpeg-turbo/libjpeg-turbo-3.0.0.ebuild       | 10 ++-
 2 files changed, 104 insertions(+), 3 deletions(-)

diff --git a/media-libs/libjpeg-turbo/files/libjpeg-turbo-3.0.0-tests.patch 
b/media-libs/libjpeg-turbo/files/libjpeg-turbo-3.0.0-tests.patch
new file mode 100644
index 000000000000..303223fdd6b3
--- /dev/null
+++ b/media-libs/libjpeg-turbo/files/libjpeg-turbo-3.0.0-tests.patch
@@ -0,0 +1,97 @@
+https://github.com/libjpeg-turbo/libjpeg-turbo/issues/705
+https://github.com/libjpeg-turbo/libjpeg-turbo/commit/035ea386d1b6a99a8a1e2ab57cc1fc903569136c
+
+From 035ea386d1b6a99a8a1e2ab57cc1fc903569136c Mon Sep 17 00:00:00 2001
+From: DRC <[email protected]>
+Date: Thu, 6 Jul 2023 12:04:22 -0400
+Subject: [PATCH] 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
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1004,7 +1004,7 @@ foreach(libtype ${TEST_LIBTYPES})
+ 
+       if(sample_bits EQUAL 12)
+         set(tjbench tjbench12)
+-        set(testout testout12)
++        set(testout testout12${suffix})
+ 
+         set(MD5_PPM_GRAY_TILE 2f799249148b1a9d0e61fa4408f6c397)
+         set(MD5_PPM_420_8x8_TILE b25684e1af37be504ee3fd137757353f)
+@@ -1024,7 +1024,7 @@ foreach(libtype ${TEST_LIBTYPES})
+         set(MD5_PPM_444_TILE 2f571a032e4dbc8ef40f75219d336b0b)
+       else()
+         set(tjbench tjbench)
+-        set(testout testout)
++        set(testout testout${suffix})
+ 
+         set(MD5_PPM_GRAY_TILE 2c3b567086e6ca0c5e6d34ad8d6f6fe8)
+         set(MD5_PPM_420_8x8_TILE efca1bdf0226df01777137778cf986ec)
+@@ -1160,7 +1160,7 @@ foreach(libtype ${TEST_LIBTYPES})
+       set(cjpeg cjpeg12)
+       set(djpeg djpeg12)
+       set(jpegtran jpegtran12)
+-      set(testout testout12)
++      set(testout testout12${suffix})
+ 
+       set(TESTORIG testorig12.jpg)
+       set(MD5_JPEG_RGB_ISLOW 9d7369207c520d37f2c1cbfcb82b2964)
+@@ -1222,7 +1222,7 @@ foreach(libtype ${TEST_LIBTYPES})
+       set(cjpeg cjpeg)
+       set(djpeg djpeg)
+       set(jpegtran jpegtran)
+-      set(testout testout)
++      set(testout testout${suffix})
+ 
+       set(TESTORIG testorig.jpg)
+       set(MD5_JPEG_RGB_ISLOW 1d44a406f61da743b5fd31c0a9abdca3)
+@@ -1632,6 +1632,8 @@ foreach(libtype ${TEST_LIBTYPES})
+     add_test(example-${sample_bits}bit-${libtype}-decompress
+       ${CMAKE_CROSSCOMPILING_EMULATOR} example${suffix} decompress
+         ${EXAMPLE_12BIT_ARG} ${testout}-example.jpg ${testout}-example.ppm)
++    set_tests_properties(example-${sample_bits}bit-${libtype}-decompress
++      PROPERTIES DEPENDS example-${sample_bits}bit-${libtype}-compress)
+     add_test(example-${sample_bits}bit-${libtype}-decompress-cmp
+       ${CMAKE_CROSSCOMPILING_EMULATOR} ${MD5CMP} ${MD5_PPM_EXAMPLE_DECOMPRESS}
+         ${testout}-example.ppm)
+--- a/tjunittest.c
++++ b/tjunittest.c
+@@ -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);
+ 
+

diff --git a/media-libs/libjpeg-turbo/libjpeg-turbo-3.0.0.ebuild 
b/media-libs/libjpeg-turbo/libjpeg-turbo-3.0.0.ebuild
index 73e3b4200ffa..c8b5b6c08fce 100644
--- a/media-libs/libjpeg-turbo/libjpeg-turbo-3.0.0.ebuild
+++ b/media-libs/libjpeg-turbo/libjpeg-turbo-3.0.0.ebuild
@@ -15,9 +15,9 @@ SRC_URI="
 LICENSE="BSD IJG ZLIB"
 SLOT="0/0.2"
 # Unkeyworded for test failures: 
https://github.com/libjpeg-turbo/libjpeg-turbo/issues/705
-#if [[ $(ver_cut 3) -lt 90 ]] ; then
-#      KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos 
~x64-solaris"
-#fi
+if [[ $(ver_cut 3) -lt 90 ]] ; then
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos 
~x64-solaris"
+fi
 IUSE="cpu_flags_arm_neon java static-libs"
 
 ASM_DEPEND="|| ( dev-lang/nasm dev-lang/yasm )"
@@ -43,6 +43,10 @@ BDEPEND="
 
 MULTILIB_WRAPPED_HEADERS=( /usr/include/jconfig.h )
 
+PATCHES=(
+       "${FILESDIR}"/${P}-tests.patch
+)
+
 src_prepare() {
        local FILE
        ln -snf ../debian/extra/*.c . || die

Reply via email to