[Test] Add ability to mute IC tests via fail.txt file

If fail.txt is present in root directory of test then exception from
  test will be muted. If there were no exceptions and fail.txt exists
  then test fail with suggestion to remove fail.txt

Content of fail.txt does not matter, so it can be used to store
  information about why this test doesn't pass
This commit is contained in:
Dmitriy Novozhilov
2021-12-02 12:39:36 +03:00
committed by TeamCityServer
parent 11b9a6eed2
commit 8fcb525d75
@@ -42,7 +42,22 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
fun doTest(path: String) {
val testDir = File(path)
val failFile = testDir.resolve(FAIL_FILE_NAME)
var testPassed = false
try {
doTestImpl(testDir)
testPassed = true
} catch (e: Throwable) {
if (!failFile.exists()) {
throw e
}
}
if (testPassed && failFile.exists()) {
fail("Test is successful and $FAIL_FILE_NAME can be removed")
}
}
private fun doTestImpl(testDir: File) {
fun Iterable<File>.relativePaths() =
map { it.relativeTo(workingDir).path.replace('\\', '/') }
@@ -181,6 +196,7 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
protected fun abiSnapshotFile(cacheDir: File): File = File(cacheDir, IncrementalCompilerRunner.ABI_SNAPSHOT_FILE_NAME)
private const val ARGUMENTS_FILE_NAME = "args.txt"
private const val FAIL_FILE_NAME = "fail.txt"
private fun parseAdditionalArgs(testDir: File): List<String> {
return File(testDir, ARGUMENTS_FILE_NAME)