[K/N][gradle] Added a test for KT-49248

This commit is contained in:
Igor Chevdar
2021-11-09 17:40:47 +05:00
parent ae128348ac
commit d3d21f072a
8 changed files with 54 additions and 15 deletions
@@ -718,7 +718,7 @@ class GeneralNativeIT : BaseGradleIT() {
.single { it.getAttribute("name").value == "fail" || it.getAttribute("name").value == "fail[$targetName]" }
.getChild("failure")
.text
assertTrue(stacktrace.contains("""at org\.foo\.test#fail\(.*test\.kt:24\)""".toRegex()))
assertTrue(stacktrace.contains("""at org\.foo\.test#fail\(.*test\.kt:29\)""".toRegex()))
}
fun assertTestResultsAnyOf(
@@ -737,25 +737,30 @@ class GeneralNativeIT : BaseGradleIT() {
// If, in the test project, preset name was updated,
// update accordingly test result output for Gradle6.6+
val testGradleVersion = project.chooseWrapperVersionOrFinishTest()
val expectedTestResults = if (GradleVersion.version(testGradleVersion) < GradleVersion.version("6.6")) {
listOf(
val expectedHostTestResult: String
val expectedIOSTestResults: List<String>
if (GradleVersion.version(testGradleVersion) < GradleVersion.version("6.6")) {
expectedHostTestResult = "testProject/native-tests/TEST-TestKt_pre6.6.xml"
expectedIOSTestResults = listOf(
"testProject/native-tests/TEST-TestKt_pre6.6.xml",
"testProject/native-tests/TEST-TestKt-iOSsim_pre6.6.xml",
)
} else {
listOf(
"testProject/native-tests/TEST-TestKt.xml",
expectedHostTestResult = "testProject/native-tests/TEST-TestKt.xml"
expectedIOSTestResults = listOf(
"testProject/native-tests/TEST-TestKt-iOSsim.xml",
"testProject/native-tests/TEST-TestKt-iOSsim_wWarn.xml",
)
}
assertTestResults(expectedTestResults.first(), hostTestTask)
assertTestResults(expectedHostTestResult, hostTestTask)
// K/N doesn't report line numbers correctly on Linux (see KT-35408).
// TODO: Uncomment when this is fixed.
//assertStacktrace(hostTestTask, "host")
if (HostManager.hostIsMac) {
assertTestResultsAnyOf(
expectedTestResults[0],
expectedTestResults[1],
expectedIOSTestResults[0],
expectedIOSTestResults[1],
"iosTest"
)
assertStacktrace("iosTest", "ios")
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testsuite name="org.foo.test.TestKt" tests="3" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<testsuite name="org.foo.test.TestKt" tests="4" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<properties/>
<testcase name="fooTest[ios]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barTest[ios]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barfooTest[ios]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="fail[ios]" classname="org.foo.test.TestKt" time="...">
<failure message="..." type="kotlin.IllegalStateException">...</failure>
</testcase>
<system-out><![CDATA[Foo call
Bar call
Invalid connection: com.apple.coresymbolicationd
42
]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testsuite name="org.foo.test.TestKt" tests="3" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<testsuite name="org.foo.test.TestKt" tests="4" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<properties/>
<testcase name="fooTest" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barTest" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barfooTest" classname="org.foo.test.TestKt" time="..."/>
<testcase name="fail" classname="org.foo.test.TestKt" time="...">
<failure message="..." type="kotlin.IllegalStateException">...</failure>
</testcase>
<system-out><![CDATA[Foo call
Bar call
42
Invalid connection: com.apple.coresymbolicationd
]]></system-out>
<system-err><![CDATA[]]></system-err>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testsuite name="org.foo.test.TestKt" tests="4" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<properties/>
<testcase name="fooTest[ios]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barTest[ios]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barfooTest[ios]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="fail[ios]" classname="org.foo.test.TestKt" time="...">
<failure message="..." type="kotlin.IllegalStateException">...</failure>
</testcase>
<system-out><![CDATA[Foo call
Bar call
42
Invalid connection: com.apple.coresymbolicationd
]]></system-out>
<system-err><![CDATA[]]></system-err>
</testsuite>
</results>
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<results>
<testsuite name="org.foo.test.TestKt" tests="3" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<testsuite name="org.foo.test.TestKt" tests="4" skipped="0" failures="1" errors="0" timestamp="..." hostname="..." time="...">
<properties/>
<testcase name="fooTest[host]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barTest[host]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barfooTest[host]" classname="org.foo.test.TestKt" time="..."/>
<testcase name="fail[host]" classname="org.foo.test.TestKt" time="...">
<failure message="..." type="kotlin.IllegalStateException">...</failure>
</testcase>
<system-out><![CDATA[Foo call
Bar call]]></system-out>
Bar call
42]]></system-out>
<system-err/>
</testsuite>
</results>
@@ -4,11 +4,13 @@
<properties/>
<testcase name="fooTest" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barTest" classname="org.foo.test.TestKt" time="..."/>
<testcase name="barfooTest" classname="org.foo.test.TestKt" time="..."/>
<testcase name="fail" classname="org.foo.test.TestKt" time="...">
<failure message="..." type="kotlin.IllegalStateException">...</failure>
</testcase>
<system-out><![CDATA[Foo call
Bar call]]></system-out>
Bar call
42]]></system-out>
<system-err/>
</testsuite>
</results>
@@ -7,4 +7,8 @@ package org.foo
fun foo() = "Foo call"
internal fun bar() = "Bar call"
internal fun bar() = "Bar call"
open class Foo {
internal fun foo() = 42
}
@@ -18,4 +18,9 @@ fun barTest() {
println(bar())
}
class Bar : Foo()
@Test
fun barfooTest() {
println(Bar().foo())
}