[JS IR] Copy JS artifacts to the build directory if the compiler crashes
Previously in 3fb1096c18 we've implemented
dumping the IR after each phase when running JS IR box tests.
However, because those dumps are saved to a temporary directory,
they can be lost in case we never make it to
`jsArtifactsHandlersStep` where files from that temporary
directory were copied to the `build/out` directory.
This could happen if, for example, the compiler crashed.
In that case, having IR dumps is even more useful, as they can help
investigate the crash.
Here we make `JsArtifactsDumpHandler` an `AfterAnalysisChecker` so that
it runs no matter what.
This commit is contained in:
@@ -84,6 +84,7 @@ abstract class AbstractJsBlackBoxCodegenTestBase<R : ResultingArtifact.FrontendO
|
||||
useAfterAnalysisCheckers(
|
||||
::JsFailingTestSuppressor,
|
||||
::BlackBoxCodegenSuppressor,
|
||||
::JsArtifactsDumpHandler
|
||||
)
|
||||
|
||||
facadeStep(frontendFacade)
|
||||
@@ -101,7 +102,6 @@ abstract class AbstractJsBlackBoxCodegenTestBase<R : ResultingArtifact.FrontendO
|
||||
jsArtifactsHandlersStep {
|
||||
useHandlers(
|
||||
::NodeJsGeneratorHandler,
|
||||
::JsArtifactsDumpHandler,
|
||||
::JsBoxRunner,
|
||||
::JsMinifierRunner,
|
||||
::JsAstHandler
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
package org.jetbrains.kotlin.js.test.handlers
|
||||
|
||||
import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.TranslationMode
|
||||
import org.jetbrains.kotlin.test.backend.handlers.JsBinaryArtifactHandler
|
||||
import org.jetbrains.kotlin.test.WrappedException
|
||||
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.model.BinaryArtifacts
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions
|
||||
import org.jetbrains.kotlin.test.model.AfterAnalysisChecker
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
|
||||
import org.jetbrains.kotlin.test.services.moduleStructure
|
||||
import java.io.File
|
||||
|
||||
class JsArtifactsDumpHandler(testServices: TestServices) : JsBinaryArtifactHandler(testServices) {
|
||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Js) {}
|
||||
/**
|
||||
* Copy JS artifacts from the temporary directory to the `js/js.tests/build/out` directory.
|
||||
*/
|
||||
class JsArtifactsDumpHandler(testServices: TestServices) : AfterAnalysisChecker(testServices) {
|
||||
|
||||
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
|
||||
override fun check(failedAssertions: List<WrappedException>) {
|
||||
val originalFile = testServices.moduleStructure.originalTestDataFiles.first()
|
||||
val allDirectives = testServices.moduleStructure.allDirectives
|
||||
|
||||
@@ -57,4 +57,4 @@ class JsArtifactsDumpHandler(testServices: TestServices) : JsBinaryArtifactHandl
|
||||
if (from.listFiles()?.size == 0) return
|
||||
from.copyRecursively(into, overwrite = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user