Skip to content

Commit

Permalink
refactor(test-utils): Use ORT's Environment to patch existing results
Browse files Browse the repository at this point in the history
Ensure to get values in exactly the same way as main ORT itself does.

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth committed Mar 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f29a5d2 commit 3112df6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utils/test/src/main/kotlin/Utils.kt
Original file line number Diff line number Diff line change
@@ -89,11 +89,13 @@ fun patchExpectedResult(
definitionFile: File? = null,
custom: Map<String, String> = emptyMap()
): String {
val env = Environment()

val replacements = buildMap {
put("<REPLACE_JAVA>", System.getProperty("java.version"))
put("<REPLACE_OS>", System.getProperty("os.name"))
put("\"<REPLACE_PROCESSORS>\"", Runtime.getRuntime().availableProcessors().toString())
put("\"<REPLACE_MAX_MEMORY>\"", Runtime.getRuntime().maxMemory().toString())
put("<REPLACE_JAVA>", env.javaVersion)
put("<REPLACE_OS>", env.os)
put("\"<REPLACE_PROCESSORS>\"", env.processors.toString())
put("\"<REPLACE_MAX_MEMORY>\"", env.maxMemory.toString())

if (definitionFile != null) {
val projectDir = definitionFile.parentFile

0 comments on commit 3112df6

Please sign in to comment.