summaryrefslogtreecommitdiff
path: root/dev-libs/blake3/files/blake3-1.5.3-backport-pr405.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-libs/blake3/files/blake3-1.5.3-backport-pr405.patch')
-rw-r--r--dev-libs/blake3/files/blake3-1.5.3-backport-pr405.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/dev-libs/blake3/files/blake3-1.5.3-backport-pr405.patch b/dev-libs/blake3/files/blake3-1.5.3-backport-pr405.patch
new file mode 100644
index 000000000000..53db4816a859
--- /dev/null
+++ b/dev-libs/blake3/files/blake3-1.5.3-backport-pr405.patch
@@ -0,0 +1,57 @@
+https://bugs.gentoo.org/935370
+https://github.com/BLAKE3-team/BLAKE3/pull/405
+
+From aad68f7f009b7e0607b3eee3b8b8e3021fa38bd7 Mon Sep 17 00:00:00 2001
+From: matoro <matoro@users.noreply.github.com>
+Date: Tue, 2 Jul 2024 19:36:45 -0400
+Subject: [PATCH] build(CMake): support running tests with ctest
+
+---
+ CMakeLists.txt | 11 +++++++++++
+ test.py | 4 ++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3a3b232d..e778e3d7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -168,6 +168,17 @@ else()
+ BLAKE3_DISABLE_SIMD()
+ endif()
+
++# cmake test support
++if (BLAKE3_BUILD_TESTING)
++ find_package(Python3 REQUIRED)
++ get_target_property(BLAKE3_SOURCES blake3 SOURCES)
++ add_executable(blake3-testing ${BLAKE3_SOURCES} main.c)
++ set_property(TARGET blake3-testing PROPERTY OUTPUT_NAME blake3)
++ target_compile_definitions(blake3-testing PRIVATE BLAKE3_TESTING=1)
++ enable_testing()
++ add_test(test_vectors "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/test.py" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
++endif()
++
+ # cmake install support
+ install(FILES blake3.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+ install(TARGETS blake3 EXPORT blake3-targets)
+diff --git a/test.py b/test.py
+index 98b1c3df..2eb1f07e 100755
+--- a/test.py
++++ b/test.py
+@@ -2,7 +2,7 @@
+
+ from binascii import hexlify
+ import json
+-from os import path
++from os import getcwd, path
+ import subprocess
+
+ HERE = path.dirname(__file__)
+@@ -11,7 +11,7 @@
+
+
+ def run_blake3(args, input):
+- output = subprocess.run([path.join(HERE, "blake3")] + args,
++ output = subprocess.run([path.join(getcwd(), "blake3")] + args,
+ input=input,
+ stdout=subprocess.PIPE,
+ check=True)