override fun exec()

in src/main/kotlin/org/jetbrains/intellij/platform/gradle/tasks/TestIdePerformanceTask.kt [79:121]


    override fun exec() {
        val dir = artifactsDirectory.asPath
        val testData = testDataDirectory.asPath
        val testExecutionResults = mutableListOf<PerformanceTestResult>()

        Files.walk(testData, 1)
            .filter { it.extension == "ijperf" }
            .forEach { scriptPath ->
                val testName = scriptPath.nameWithoutExtension
                val testScript = SimpleIJPerformanceParser(scriptPath).parse()
                val testArtifactsDirPath = dir.resolve(testName).createDirectories()

                // Passing to the IDE project to open
                args = listOf("${testDataDirectory.get()}/${testScript.projectName}")

                jvmArgumentProviders.add(
                    PerformanceTestArgumentProvider(
                        scriptPath,
                        testArtifactsDirPath,
                        profilerName,
                    )
                )
                super.exec()

                IdeaLogParser(testArtifactsDirPath.resolve("idea.log").toAbsolutePath().toString())
                    .getTestStatistic()
                    .let { testResults ->
                        log.info("Total time ${testResults.totalTime}ms, expected time ms ${testScript.assertionTimeout}ms")

                        if (testScript.assertionTimeout != null && testResults.totalTime!! > testScript.assertionTimeout) {
                            testExecutionResults.add(PerformanceTestResult(testName, testResults, testScript))
                        }
                    }
            }

        if (testExecutionResults.isNotEmpty()) {
            testExecutionResults.forEach {
                log.error("TEST `${it.testName}` FAILED")
                log.error("Expected time of execution `${it.script.assertionTimeout}ms`, but was ${it.statistic.totalTime}ms")
            }
            throw TestExecutionFailException("${testExecutionResults.size} test(s) failed")
        }
    }