Skip to content

Commit

Permalink
skip if no tests are run
Browse files Browse the repository at this point in the history
  • Loading branch information
wangweij committed Nov 8, 2024
1 parent 34f9f8a commit 39601d8
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions test/jdk/sun/security/provider/acvp/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* questions.
*/
import jdk.test.lib.json.JSONValue;
import jtreg.SkippedException;

import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -69,6 +70,8 @@ public class Launcher {

private static final Provider PROVIDER;

private static int count = 0;

static {
var provProp = System.getProperty("test.acvp.provider");
if (provProp != null) {
Expand Down Expand Up @@ -104,6 +107,12 @@ public static void main(String[] args) throws Exception {
.endsWith("internalProjection.json"))
.forEach(Launcher::run);
}

if (count > 0) {
System.out.println("Test completed: " + count);
} else {
throw new SkippedException("No supported test found");
}
}

static void run(Path test) {
Expand All @@ -121,11 +130,21 @@ static void run(Path test) {
}
System.out.println(">>> Testing " + test + "...");
switch (alg) {
case "ML-DSA" -> ML_DSA_Test.run(kat, PROVIDER);
case "ML-KEM" -> ML_KEM_Test.run(kat, PROVIDER);
case "SHA2-256", "SHA2-224", "SHA3-256", "SHA3-224"
-> SHA_Test.run(kat, PROVIDER);
default -> System.out.println("Skipped unsupported algorithm: " + alg);
case "ML-DSA" -> {
ML_DSA_Test.run(kat, PROVIDER);
count++;
}
case "ML-KEM" -> {
ML_KEM_Test.run(kat, PROVIDER);
count++;
}
case "SHA2-256", "SHA2-224", "SHA3-256", "SHA3-224" -> {
SHA_Test.run(kat, PROVIDER);
count++;
}
default -> {
System.out.println("Skipped unsupported algorithm: " + alg);
}
}
} catch (RuntimeException re) {
throw re;
Expand Down

0 comments on commit 39601d8

Please sign in to comment.