From 3785fe8e427285d9e87ba0d8ea1f38c92338daf4 Mon Sep 17 00:00:00 2001 From: Vfrolov Date: Mon, 11 Jul 2022 13:15:25 +0300 Subject: [PATCH] Migrate diktat smoke tests to SAVE-cli mechanism ### What's done: * migrated diktat smoke tests to SAVE-cli mechanism Closes #1383 --- .../src/test/kotlin/org/cqfn/diktat/util/FixTestBase.kt | 7 ++++--- diktat-rules/src/test/resources/test/smoke/save.toml | 2 +- .../test/resources/test/smoke/src/main/kotlin/save.toml | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/FixTestBase.kt b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/FixTestBase.kt index 51f1a930b3..66977a578b 100644 --- a/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/FixTestBase.kt +++ b/diktat-rules/src/test/kotlin/org/cqfn/diktat/util/FixTestBase.kt @@ -76,11 +76,12 @@ open class FixTestBase( } private fun getProcessBuilder(expectedPath: String, testPath: String): ProcessBuilder { - val saveDir = "src/test/resources/test/smoke" + val saveDir = "src/test/resources/test/smoke/${getSaveForCurrentOs()}" + val filesDir = "src/test/resources/test/smoke/${getSaveForCurrentOs()}" val systemName = System.getProperty("os.name") return when { systemName.startsWith("Linux", ignoreCase = true) || systemName.startsWith("Mac", ignoreCase = true) -> - ProcessBuilder("chmod", "-R", "777", saveDir, "&", saveDir, "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath) + ProcessBuilder("chmod", "-R", "777", filesDir, "&", saveDir, "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath) else -> ProcessBuilder(saveDir, "src/test/resources/test/smoke/src/main/kotlin", expectedPath, testPath) } } @@ -119,7 +120,7 @@ open class FixTestBase( ?.single { it.name.contains("diktat") } ?.pathString ?: "" - val file = File("tmpSave.txt") + val file = File("src/test/resources/test/smoke/tmpSave.txt") val diktat = File("src/test/resources/test/smoke/diktat.jar") val configFile = File("src/test/resources/test/smoke/diktat-analysis.yml") val diktatFrom = File(diktatDir) diff --git a/diktat-rules/src/test/resources/test/smoke/save.toml b/diktat-rules/src/test/resources/test/smoke/save.toml index d63828ecd1..18bedb7070 100644 --- a/diktat-rules/src/test/resources/test/smoke/save.toml +++ b/diktat-rules/src/test/resources/test/smoke/save.toml @@ -1,5 +1,5 @@ [general] -execCmd="chmod 777 ktlint & chmod 777 diktat.jar & java -jar ktlint -R diktat.jar" +execCmd="java -jar ktlint -R diktat.jar" tags = ["smokeTest"] description = "SmokeTest" suiteName = "SmokeTest" diff --git a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/save.toml b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/save.toml index 0d4862aa87..8c86f032f7 100644 --- a/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/save.toml +++ b/diktat-rules/src/test/resources/test/smoke/src/main/kotlin/save.toml @@ -1,5 +1,5 @@ [general] -execCmd="chmod 777 ktlint & chmod 777 diktat.jar & java -jar ktlint -R diktat.jar" +execCmd="java -jar ktlint -R diktat.jar" tags = ["smokeTest"] description = "SmokeTest" suiteName = "SmokeTest"