Skip to content

Commit

Permalink
TKSS-590: Print BabaSSL version
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang committed Dec 12, 2023
1 parent 161bcc8 commit c4bc60e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions buildSrc/src/main/kotlin/CommonTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/

import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.Action
import org.gradle.api.JavaVersion
import org.gradle.api.Task
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.TestDescriptor
import org.gradle.api.tasks.testing.TestListener
Expand Down Expand Up @@ -92,14 +89,19 @@ abstract class CommonTest : Test() {
}

// Determine if BabaSSL is available
fun isBabaSSLAvailable(babasslPath: String): Boolean {
fun isBabaSSLAvailable(babasslPath : String): Boolean {
var exitCode : Int = -1
try {
val process = ProcessBuilder()
.command(babasslPath, "version")
.start()
process.waitFor(3, TimeUnit.SECONDS)
exitCode = process.exitValue()

val versionInfo = process.getInputStream().bufferedReader().use {
it.readText()
}
System.out.print(versionInfo)
} catch (e: Exception) {
println("BabaSSL is unavailable: " + e.cause)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void testDecryption() {
public void testEncryptMillionTimes() {
SM4Engine engine = new SM4Engine(KEY, true);
byte[] ciphertext = new byte[16];
engine.processBlock( PLAINTEXT, 0, ciphertext, 0);
engine.processBlock(PLAINTEXT, 0, ciphertext, 0);
for (int i = 1; i < 1_000_000; i++) {
engine.processBlock(ciphertext, 0, ciphertext, 0);
}
Expand Down

0 comments on commit c4bc60e

Please sign in to comment.