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 {
|
||||
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 'kotlinVersion', project.version
|
||||
systemProperty 'testCasesClassesDirs', sourceSets.test.output.classesDirs.asPath
|
||||
systemProperty 'testCasesDeclarations', testCasesDeclarationsDump
|
||||
jvmArgs '-ea'
|
||||
|
||||
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 {
|
||||
|
||||
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> =
|
||||
(System.getenv("PROJECT_CLASSES_DIRS")?.let { it.split(File.pathSeparator) }
|
||||
?: listOf("build/classes/kotlin/test/cases", "build/classes/java/test/cases"))
|
||||
.mapNotNull { File(it, "cases").canonicalFile.takeIf { it.isDirectory } }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: throw IllegalStateException("Unable to get classes output dirs, set PROJECT_CLASSES_DIRS environment variable")
|
||||
System.getProperty("testCasesClassesDirs")
|
||||
.let { requireNotNull(it) { "Specify testCasesClassesDirs with a system property"} }
|
||||
.split(File.pathSeparator)
|
||||
.map { File(it, "cases").canonicalFile }
|
||||
val baseOutputPath = File("src/test/kotlin/cases")
|
||||
}
|
||||
|
||||
@@ -48,7 +47,9 @@ class CasesPublicAPITest {
|
||||
|
||||
private fun snapshotAPIAndCompare(testClassRelativePath: String) {
|
||||
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 api = getBinaryAPI(testClassStreams, visibilities).filterOutNonPublic()
|
||||
|
||||
Reference in New Issue
Block a user