aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTino Reichardt <[email protected]>2023-02-27 16:14:37 +0100
committerBrian Behlendorf <[email protected]>2023-03-02 13:52:27 -0800
commitf9f9bef22f96eb3092d7466112f62f7ad4567d71 (patch)
tree0df1e36ff9ee5e3f14be1ba605b129f06a442f03 /tests
parent4c5fec01a48acc184614ab8735e6954961990235 (diff)
Update BLAKE3 for using the new impl handling
This commit changes the BLAKE3 implementation handling and also the calls to it from the ztest command. Tested-by: Rich Ercolani <[email protected]> Tested-by: Sebastian Gottschall <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tino Reichardt <[email protected]> Closes #13741
Diffstat (limited to 'tests')
-rw-r--r--tests/zfs-tests/cmd/checksum/blake3_test.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/zfs-tests/cmd/checksum/blake3_test.c b/tests/zfs-tests/cmd/checksum/blake3_test.c
index 648e1faaa..aebe0363c 100644
--- a/tests/zfs-tests/cmd/checksum/blake3_test.c
+++ b/tests/zfs-tests/cmd/checksum/blake3_test.c
@@ -31,6 +31,8 @@
#include <sys/time.h>
#include <sys/blake3.h>
+#include <sys/zfs_impl.h>
+
/*
* set it to a define for debugging
*/
@@ -485,10 +487,14 @@ main(int argc, char *argv[])
uint8_t buffer[102400];
uint64_t cpu_mhz = 0;
int id, i, j;
+ const zfs_impl_t *blake3 = zfs_impl_get_ops("blake3");
if (argc == 2)
cpu_mhz = atoi(argv[1]);
+ if (!blake3)
+ return (1);
+
/* fill test message */
for (i = 0, j = 0; i < sizeof (buffer); i++, j++) {
if (j == 251)
@@ -497,9 +503,9 @@ main(int argc, char *argv[])
}
(void) printf("Running algorithm correctness tests:\n");
- for (id = 0; id < blake3_impl_getcnt(); id++) {
- blake3_impl_setid(id);
- const char *name = blake3_impl_getname();
+ for (id = 0; id < blake3->getcnt(); id++) {
+ blake3->setid(id);
+ const char *name = blake3->getname();
dprintf("Result for BLAKE3-%s:\n", name);
for (i = 0; TestArray[i].hash; i++) {
blake3_test_t *cur = &TestArray[i];
@@ -565,9 +571,9 @@ main(int argc, char *argv[])
} while (0)
printf("Running performance tests (hashing 1024 MiB of data):\n");
- for (id = 0; id < blake3_impl_getcnt(); id++) {
- blake3_impl_setid(id);
- const char *name = blake3_impl_getname();
+ for (id = 0; id < blake3->getcnt(); id++) {
+ blake3->setid(id);
+ const char *name = blake3->getname();
BLAKE3_PERF_TEST(name, 256);
}