From 70e2bc876abe35b3d447f8004245bdbf2fead59f Mon Sep 17 00:00:00 2001 From: Volodymyr Paprotski Date: Wed, 3 Dec 2025 21:32:29 +0000 Subject: [PATCH] 8372816: New test sun/security/provider/acvp/ML_DSA_Intrinsic_Test.java succeeds in case of error Reviewed-by: azeller, mdoerr --- .../provider/acvp/ML_DSA_Intrinsic_Test.java | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/test/jdk/sun/security/provider/acvp/ML_DSA_Intrinsic_Test.java b/test/jdk/sun/security/provider/acvp/ML_DSA_Intrinsic_Test.java index ea04b3c7eec..7f057603323 100644 --- a/test/jdk/sun/security/provider/acvp/ML_DSA_Intrinsic_Test.java +++ b/test/jdk/sun/security/provider/acvp/ML_DSA_Intrinsic_Test.java @@ -28,13 +28,6 @@ import java.lang.invoke.MethodHandles; import java.lang.reflect.Method; import java.util.HexFormat; -/* - * @test - * @library /test/lib - * @key randomness - * @modules java.base/sun.security.provider:+open - * @run main/othervm ML_DSA_Intrinsic_Test -XX:+UnlockDiagnosticVMOptions -XX:-UseDilithiumIntrinsics - */ /* * @test * @requires os.simpleArch == "x64" @@ -55,7 +48,7 @@ import java.util.HexFormat; // -XX:+UnlockDiagnosticVMOptions -XX:+UseDilithiumIntrinsics test/jdk/sun/security/provider/acvp/ML_DSA_Intrinsic_Test.java public class ML_DSA_Intrinsic_Test { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Exception, Throwable { MethodHandles.Lookup lookup = MethodHandles.lookup(); Class kClazz = sun.security.provider.ML_DSA.class; @@ -114,27 +107,23 @@ public class ML_DSA_Intrinsic_Test { long seed = rnd.nextLong(); rnd.setSeed(seed); //Note: it might be useful to increase this number during development of new intrinsics - final int repeat = 10000000; + final int repeat = 10000; int[] coeffs1 = new int[ML_DSA_N]; int[] coeffs2 = new int[ML_DSA_N]; int[] prod1 = new int[ML_DSA_N]; int[] prod2 = new int[ML_DSA_N]; int[] prod3 = new int[ML_DSA_N]; int[] prod4 = new int[ML_DSA_N]; - try { - for (int i = 0; i < repeat; i++) { - // Hint: if test fails, you can hardcode the seed to make the test more reproducible: - // rnd.setSeed(seed); - testMult(prod1, prod2, coeffs1, coeffs2, mult, multJava, rnd, seed, i); - testMultConst(prod1, prod2, multConst, multConstJava, rnd, seed, i); - testDecompose(prod1, prod2, prod3, prod4, coeffs1, coeffs2, decompose, decomposeJava, rnd, seed, i); - testAlmostNtt(coeffs1, coeffs2, almostNtt, almostNttJava, rnd, seed, i); - testInverseNtt(coeffs1, coeffs2, inverseNtt, inverseNttJava, rnd, seed, i); - } - System.out.println("Fuzz Success"); - } catch (Throwable e) { - System.out.println("Fuzz Failed: " + e); + for (int i = 0; i < repeat; i++) { + // Hint: if test fails, you can hardcode the seed to make the test more reproducible: + // rnd.setSeed(seed); + testMult(prod1, prod2, coeffs1, coeffs2, mult, multJava, rnd, seed, i); + testMultConst(prod1, prod2, multConst, multConstJava, rnd, seed, i); + testDecompose(prod1, prod2, prod3, prod4, coeffs1, coeffs2, decompose, decomposeJava, rnd, seed, i); + testAlmostNtt(coeffs1, coeffs2, almostNtt, almostNttJava, rnd, seed, i); + testInverseNtt(coeffs1, coeffs2, inverseNtt, inverseNttJava, rnd, seed, i); } + System.out.println("Fuzz Success"); } private static final int ML_DSA_N = 256;