From 3112df6080a56872c72ac3df1f41dad48bb9385b Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 14 Mar 2024 08:13:19 +0100 Subject: [PATCH] refactor(test-utils): Use ORT's `Environment` to patch existing results Ensure to get values in exactly the same way as main ORT itself does. Signed-off-by: Sebastian Schuberth --- utils/test/src/main/kotlin/Utils.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/utils/test/src/main/kotlin/Utils.kt b/utils/test/src/main/kotlin/Utils.kt index d80c3b29d595e..bd5d027d81a16 100644 --- a/utils/test/src/main/kotlin/Utils.kt +++ b/utils/test/src/main/kotlin/Utils.kt @@ -89,11 +89,13 @@ fun patchExpectedResult( definitionFile: File? = null, custom: Map = emptyMap() ): String { + val env = Environment() + val replacements = buildMap { - put("", System.getProperty("java.version")) - put("", System.getProperty("os.name")) - put("\"\"", Runtime.getRuntime().availableProcessors().toString()) - put("\"\"", Runtime.getRuntime().maxMemory().toString()) + put("", env.javaVersion) + put("", env.os) + put("\"\"", env.processors.toString()) + put("\"\"", env.maxMemory.toString()) if (definitionFile != null) { val projectDir = definitionFile.parentFile