Pass arguments to bcv tests with system properties rather than env
This commit is contained in:
@@ -27,9 +27,11 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def testCasesDeclarationsDump = "${buildDir}/cases-declarations.json".toString()
|
||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs = ['-Xdump-declarations-to', "${buildDir}/cases-declarations.json"]
|
freeCompilerArgs = ["-Xdump-declarations-to=$testCasesDeclarationsDump"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,11 +41,9 @@ test {
|
|||||||
|
|
||||||
systemProperty 'overwrite.output', System.getProperty("overwrite.output", "false")
|
systemProperty 'overwrite.output', System.getProperty("overwrite.output", "false")
|
||||||
systemProperty 'kotlinVersion', project.version
|
systemProperty 'kotlinVersion', project.version
|
||||||
|
systemProperty 'testCasesClassesDirs', sourceSets.test.output.classesDirs.asPath
|
||||||
|
systemProperty 'testCasesDeclarations', testCasesDeclarationsDump
|
||||||
jvmArgs '-ea'
|
jvmArgs '-ea'
|
||||||
|
|
||||||
ignoreFailures = System.getenv("kotlin_build_ignore_test_failures") == 'yes'
|
ignoreFailures = System.getenv("kotlin_build_ignore_test_failures") == 'yes'
|
||||||
environment("PROJECT_CLASSES_DIRS", sourceSets.test.output.classesDirs.asPath)
|
|
||||||
environment("PROJECT_BUILD_DIR", buildDir)
|
|
||||||
|
|
||||||
workingDir = projectDir
|
|
||||||
}
|
}
|
||||||
+8
-7
@@ -8,13 +8,12 @@ import java.io.File
|
|||||||
class CasesPublicAPITest {
|
class CasesPublicAPITest {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val visibilities by lazy { readKotlinVisibilities(File(System.getenv("PROJECT_BUILD_DIR") ?: "build", "cases-declarations.json")) }
|
val visibilities by lazy { readKotlinVisibilities(File(System.getProperty("testCasesDeclarations")!!)) }
|
||||||
val baseClassPaths: List<File> =
|
val baseClassPaths: List<File> =
|
||||||
(System.getenv("PROJECT_CLASSES_DIRS")?.let { it.split(File.pathSeparator) }
|
System.getProperty("testCasesClassesDirs")
|
||||||
?: listOf("build/classes/kotlin/test/cases", "build/classes/java/test/cases"))
|
.let { requireNotNull(it) { "Specify testCasesClassesDirs with a system property"} }
|
||||||
.mapNotNull { File(it, "cases").canonicalFile.takeIf { it.isDirectory } }
|
.split(File.pathSeparator)
|
||||||
.takeIf { it.isNotEmpty() }
|
.map { File(it, "cases").canonicalFile }
|
||||||
?: throw IllegalStateException("Unable to get classes output dirs, set PROJECT_CLASSES_DIRS environment variable")
|
|
||||||
val baseOutputPath = File("src/test/kotlin/cases")
|
val baseOutputPath = File("src/test/kotlin/cases")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +47,9 @@ class CasesPublicAPITest {
|
|||||||
|
|
||||||
private fun snapshotAPIAndCompare(testClassRelativePath: String) {
|
private fun snapshotAPIAndCompare(testClassRelativePath: String) {
|
||||||
val testClassPaths = baseClassPaths.map { it.resolve(testClassRelativePath) }
|
val testClassPaths = baseClassPaths.map { it.resolve(testClassRelativePath) }
|
||||||
val testClasses = testClassPaths.flatMap { it.listFiles()?.asIterable() ?: emptyList() }
|
val testClasses = testClassPaths.flatMap { it.listFiles().orEmpty().asIterable() }
|
||||||
|
check(testClasses.isNotEmpty()) { "No class files are found in paths: $testClassPaths" }
|
||||||
|
|
||||||
val testClassStreams = testClasses.asSequence().filter { it.name.endsWith(".class") }.map { it.inputStream() }
|
val testClassStreams = testClasses.asSequence().filter { it.name.endsWith(".class") }.map { it.inputStream() }
|
||||||
|
|
||||||
val api = getBinaryAPI(testClassStreams, visibilities).filterOutNonPublic()
|
val api = getBinaryAPI(testClassStreams, visibilities).filterOutNonPublic()
|
||||||
|
|||||||
Reference in New Issue
Block a user