Skip to content

Commit

Permalink
Add logging when AA times out or fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Lipen committed Jan 30, 2025
1 parent 4f250d8 commit 126aa33
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.jacodb.ets.utils

import mu.KotlinLogging
import org.jacodb.ets.dto.EtsFileDto
import org.jacodb.ets.dto.toEtsFile
import org.jacodb.ets.model.EtsFile
Expand All @@ -36,6 +37,8 @@ import kotlin.io.path.walk
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds

private val logger = KotlinLogging.logger {}

private const val ENV_VAR_ARK_ANALYZER_DIR = "ARKANALYZER_DIR"
private const val DEFAULT_ARK_ANALYZER_DIR = "arkanalyzer"

Expand Down Expand Up @@ -86,8 +89,18 @@ fun generateEtsIR(
useArkAnalyzerTypeInference?.let { "-t $it" },
projectPath.pathString,
output.pathString,
"-v",
)
ProcessUtil.run(cmd, timeout = timeout)
val res = ProcessUtil.run(cmd, timeout = timeout)
if (res.exitCode != 0) {
logger.error { "ARKANALYZER failed with exit code ${res.exitCode}" }
logger.error { "STDOUT:\n${res.stdout}" }
logger.error { "STDERR:\n${res.stderr}" }

Check warning on line 98 in jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt#L96-L98

Added lines #L96 - L98 were not covered by tests
} else if (res.isTimeout) {
logger.error { "ARKANALYZER timed out after $timeout" }
logger.error { "STDOUT:\n${res.stdout}" }
logger.error { "STDERR:\n${res.stderr}" }

Check warning on line 102 in jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt

View check run for this annotation

Codecov / codecov/patch

jacodb-ets/src/main/kotlin/org/jacodb/ets/utils/LoadEtsFile.kt#L100-L102

Added lines #L100 - L102 were not covered by tests
}
return output
}

Expand Down

0 comments on commit 126aa33

Please sign in to comment.