[JS, Tests] Migrate IR tests onto outputDir and outputName

This commit is contained in:
Ilya Goncharov
2022-07-28 13:51:39 +02:00
committed by teamcity
parent eeb0520b48
commit f320efedd3
6 changed files with 16 additions and 10 deletions
@@ -109,11 +109,10 @@ class IncrementalJsCompilerRunner(
} }
override fun destinationDir(args: K2JSCompilerArguments): File { override fun destinationDir(args: K2JSCompilerArguments): File {
val outputFile = File(args.outputFile!!)
return if (args.isIrBackendEnabled()) return if (args.isIrBackendEnabled())
outputFile File(args.outputDir!!)
else else
outputFile.parentFile File(args.outputFile!!).parentFile
} }
override fun calculateSourcesToCompile( override fun calculateSourcesToCompile(
@@ -9,7 +9,9 @@ abstract class AbstractIncrementalJsKlibCompilerRunnerTest : AbstractIncremental
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
K2JSCompilerArguments().apply { K2JSCompilerArguments().apply {
libraries = "build/js-ir-runtime/full-runtime.klib" libraries = "build/js-ir-runtime/full-runtime.klib"
outputFile = File(destinationDir, "${testDir.name}.$KLIB_FILE_EXTENSION").path outputDir = destinationDir.path
outputName = testDir.name
outputFile = null
sourceMap = false sourceMap = false
irProduceKlibDir = false irProduceKlibDir = false
irProduceKlibFile = true irProduceKlibFile = true
@@ -19,7 +19,8 @@ abstract class AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest :
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
K2JSCompilerArguments().apply { K2JSCompilerArguments().apply {
libraries = STDLIB_DEPENDENCY libraries = STDLIB_DEPENDENCY
outputFile = File(destinationDir, "${testDir.name}.$KLIB_FILE_EXTENSION").path outputDir = destinationDir.path
outputName = testDir.name
sourceMap = false sourceMap = false
irProduceKlibDir = false irProduceKlibDir = false
irProduceKlibFile = true irProduceKlibFile = true
@@ -81,7 +82,8 @@ abstract class AbstractIncrementalMultiModuleJsKlibCompilerRunnerTest :
} }
libraries = sb.toString() libraries = sb.toString()
outputFile = outFile.path outputDir = outFile.parentFile.path
outputName = outFile.nameWithoutExtension
} }
companion object { companion object {
@@ -106,7 +106,8 @@ abstract class AbstractJsKlibLookupTrackerTest : AbstractJsLookupTrackerTest() {
override fun configureAdditionalArgs(args: K2JSCompilerArguments) { override fun configureAdditionalArgs(args: K2JSCompilerArguments) {
args.irProduceKlibDir = true args.irProduceKlibDir = true
args.irOnly = true args.irOnly = true
args.outputFile = outDir.resolve("out.klib").absolutePath args.outputDir = outDir.normalize().absolutePath
args.outputName = "out"
} }
} }
@@ -299,7 +299,7 @@ class GenerateIrRuntime {
val args = K2JSCompilerArguments().apply { val args = K2JSCompilerArguments().apply {
libraries = "" libraries = ""
outputFile = klibDirectory.path outputDir = klibDirectory.path
sourceMap = false sourceMap = false
irProduceKlibDir = true irProduceKlibDir = true
irOnly = true irOnly = true
@@ -53,7 +53,8 @@ abstract class AbstractJsKlibBinaryCompatibilityTest : AbstractKlibBinaryCompati
val args = K2JSCompilerArguments().apply { val args = K2JSCompilerArguments().apply {
freeArgs = createFiles(module.versionFiles(version)) freeArgs = createFiles(module.versionFiles(version))
libraries = module.dependenciesToLibrariesArg(version = version) libraries = module.dependenciesToLibrariesArg(version = version)
outputFile = File(workingDir, "${module.name(version)}.$KLIB_FILE_EXTENSION").absolutePath outputDir = workingDir.normalize().absolutePath
outputName = module.name(version)
irProduceKlibFile = true irProduceKlibFile = true
irOnly = true irOnly = true
irModuleName = module.name irModuleName = module.name
@@ -67,7 +68,8 @@ abstract class AbstractJsKlibBinaryCompatibilityTest : AbstractKlibBinaryCompati
val args = K2JSCompilerArguments().apply { val args = K2JSCompilerArguments().apply {
freeArgs = createFiles(module.files) + runnerFunctionFile() freeArgs = createFiles(module.files) + runnerFunctionFile()
libraries = module.dependenciesToLibrariesArg(version = 2) libraries = module.dependenciesToLibrariesArg(version = 2)
outputFile = File(workingDir, module.name.js).absolutePath outputDir = workingDir.normalize().absolutePath
outputName = module.name
irProduceJs = true irProduceJs = true
irOnly = true irOnly = true
irModuleName = module.name irModuleName = module.name