Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8239928: ec/ECDSAJavaVerify.java failed due to timeout
Reviewed-by: valeriep
  • Loading branch information
wangweij committed Mar 11, 2020
1 parent 08c3b1f commit 80ca356e7eb7a6515112c9f11586858600673a1b
Showing with 24 additions and 17 deletions.
  1. +24 −17 test/jdk/sun/security/ec/ECDSAJavaVerify.java
@@ -48,11 +48,14 @@

/*
* @test
* @bug 8237218
* @summary Support NIST Curves verification in java implementation
* @bug 8237218 8239928
* @modules jdk.crypto.ec
* jdk.jdi
* @requires os.family != "windows"
* @run main ECDSAJavaVerify debug
* @summary Support NIST Curves verification in java implementation.
* This test does not run stable on Windows. VMDisconnectedException
* might not be thrown at all.
*/

// ATTENTION: This test depends on method names inside the non-exported
@@ -120,9 +123,15 @@ static void debug() throws Exception {
}
}

// Test result, init as ' ', '-' if run, 'x' for unexpected.
// Test result
// '.': not run yet
// '-': enter engineVerify
// 'v': expected impl called
// 'x': unexpected impl called
// Note: some error cases fail before any impl called. Ex: if there
// is a DER encoding error.
char[] result = new char[numberOfTests];
Arrays.fill(result, ' ');
Arrays.fill(result, '.');

String stdout, stderr;

@@ -135,18 +144,13 @@ static void debug() throws Exception {
MethodEntryEvent e = (MethodEntryEvent)event;
switch (e.method().name()) {
case "engineVerify":
pos++;
result[pos] = '-';
result[++pos] = '-';
break;
case "verifySignedDigestImpl": // the java impl
if (expected[pos] != 'J') {
result[pos] = 'x';
}
result[pos] = expected[pos] != 'J' ? 'x' : 'v';
break;
case "verifySignedDigest":
if (expected[pos] != 'N') { // the native impl
result[pos] = 'x';
}
case "verifySignedDigest": // the native impl
result[pos] = expected[pos] != 'N' ? 'x' : 'v';
break;
}
}
@@ -160,19 +164,22 @@ static void debug() throws Exception {
stdout = new String(vm.process().getInputStream().readAllBytes());
}

int exitCode = vm.process().waitFor();
System.out.println(" exit: " + exitCode);
System.out.println("stderr:\n" + stderr);
System.out.println("stdout:\n" + stdout);

String sResult = new String(result);

System.out.println("Expected: " + new String(expected));
System.out.println(" Actual: " + sResult);
System.out.println(" Cases: " + new String(expected));
System.out.println("Result: " + sResult);

if (pos != numberOfTests - 1 || sResult.contains("x")) {
if (pos != numberOfTests - 1 || sResult.contains("x")
|| sResult.contains(".")) {
throw new Exception("Unexpected result");
}

if (stdout.contains("fail") || !stderr.isEmpty()) {
if (stdout.contains("fail") || exitCode != 0) {
throw new Exception("Test failed");
}
}

0 comments on commit 80ca356

Please sign in to comment.