From d0e5e1e4b102e82441fb105a7cbea99935f9122a Mon Sep 17 00:00:00 2001 From: Ian Botsford <83236726+ianbotsf@users.noreply.github.com> Date: Wed, 13 Aug 2025 20:44:58 +0000 Subject: [PATCH 1/2] chore: re-enable ignored Kotlin/Native tests --- .../SigV4aSignatureCalculatorTest.kt | 2 - .../http/auth/AwsHttpSignerTestBase.kt | 4 -- runtime/build.gradle.kts | 18 ++++++-- .../http/engine/crt/AsyncStressTest.kt | 45 ++++++++++--------- 4 files changed, 38 insertions(+), 31 deletions(-) diff --git a/runtime/auth/aws-signing-default/common/test/aws/smithy/kotlin/runtime/auth/awssigning/SigV4aSignatureCalculatorTest.kt b/runtime/auth/aws-signing-default/common/test/aws/smithy/kotlin/runtime/auth/awssigning/SigV4aSignatureCalculatorTest.kt index 81421fcce7..c4c4abe953 100644 --- a/runtime/auth/aws-signing-default/common/test/aws/smithy/kotlin/runtime/auth/awssigning/SigV4aSignatureCalculatorTest.kt +++ b/runtime/auth/aws-signing-default/common/test/aws/smithy/kotlin/runtime/auth/awssigning/SigV4aSignatureCalculatorTest.kt @@ -4,7 +4,6 @@ */ package aws.smithy.kotlin.runtime.auth.awssigning -import aws.smithy.kotlin.runtime.IgnoreNative import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.time.Instant import aws.smithy.kotlin.runtime.util.PlatformProvider @@ -69,7 +68,6 @@ private val TESTS = listOf( * Tests for [SigV4aSignatureCalculator]. Currently only tests forming the string-to-sign. */ class SigV4aSignatureCalculatorTest { - @IgnoreNative // FIXME test resources are not loadable on iOS: https://youtrack.jetbrains.com/issue/KT-49981/ @Test fun testStringToSign() = TESTS.forEach { testId -> runTest { diff --git a/runtime/auth/http-auth-aws/common/test/aws/smithy/kotlin/runtime/http/auth/AwsHttpSignerTestBase.kt b/runtime/auth/http-auth-aws/common/test/aws/smithy/kotlin/runtime/http/auth/AwsHttpSignerTestBase.kt index 0daa2b31fe..75be7cbbf2 100644 --- a/runtime/auth/http-auth-aws/common/test/aws/smithy/kotlin/runtime/http/auth/AwsHttpSignerTestBase.kt +++ b/runtime/auth/http-auth-aws/common/test/aws/smithy/kotlin/runtime/http/auth/AwsHttpSignerTestBase.kt @@ -4,7 +4,6 @@ */ package aws.smithy.kotlin.runtime.http.auth -import aws.smithy.kotlin.runtime.IgnoreNative import aws.smithy.kotlin.runtime.auth.awscredentials.Credentials import aws.smithy.kotlin.runtime.auth.awscredentials.CredentialsProvider import aws.smithy.kotlin.runtime.auth.awssigning.AwsSigner @@ -127,7 +126,6 @@ public abstract class AwsHttpSignerTestBase( assertEquals(expectedSig, signed.headers["Authorization"]) } - @IgnoreNative // FIXME Our JVM implementation does not sign `transfer-encoding`, but CRT does, causing a signature mismatch. Upgrade to latest version of aws-c-auth to get the fix. @Test public fun testSignAwsChunkedStreamNonReplayable(): TestResult = runTest { val op = buildOperation(streaming = true, replayable = false, requestBody = "a".repeat(AWS_CHUNKED_THRESHOLD + 1)) @@ -141,7 +139,6 @@ public abstract class AwsHttpSignerTestBase( assertEquals(expectedSig, signed.headers["Authorization"]) } - @IgnoreNative // FIXME Our JVM implementation does not sign `transfer-encoding`, but CRT does, causing a signature mismatch. Upgrade to latest version of aws-c-auth to get the fix. @Test public fun testSignAwsChunkedStreamReplayable(): TestResult = runTest { val op = buildOperation(streaming = true, replayable = true, requestBody = "a".repeat(AWS_CHUNKED_THRESHOLD + 1)) @@ -155,7 +152,6 @@ public abstract class AwsHttpSignerTestBase( assertEquals(expectedSig, signed.headers["Authorization"]) } - @IgnoreNative // FIXME Our JVM implementation does not sign `transfer-encoding`, but CRT does, causing a signature mismatch. Upgrade to latest version of aws-c-auth to get the fix. @Test public fun testSignOneShotStream(): TestResult = runTest { val op = buildOperation(streaming = true, replayable = false) diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 949c95973e..4d393639c2 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ import aws.sdk.kotlin.gradle.dsl.configurePublishing -import aws.sdk.kotlin.gradle.kmp.* -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.withType +import aws.sdk.kotlin.gradle.kmp.configureKmpTargets +import aws.sdk.kotlin.gradle.kmp.kotlin +import aws.sdk.kotlin.gradle.kmp.needsKmpConfigured import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest @@ -118,6 +118,18 @@ subprojects { tasks.withType { enabled = false } + + tasks.withType { + if (this is Test) useJUnitPlatform() + + testLogging { + events("passed", "skipped", "failed") + showStandardStreams = true + showStackTraces = true + showExceptions = true + exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL + } + } } // configureIosSimulatorTasks() diff --git a/runtime/protocol/http-client-engines/http-client-engine-crt/jvmAndNative/test/aws/smithy/kotlin/runtime/http/engine/crt/AsyncStressTest.kt b/runtime/protocol/http-client-engines/http-client-engine-crt/jvmAndNative/test/aws/smithy/kotlin/runtime/http/engine/crt/AsyncStressTest.kt index e509808ec1..a4b9bc51be 100644 --- a/runtime/protocol/http-client-engines/http-client-engine-crt/jvmAndNative/test/aws/smithy/kotlin/runtime/http/engine/crt/AsyncStressTest.kt +++ b/runtime/protocol/http-client-engines/http-client-engine-crt/jvmAndNative/test/aws/smithy/kotlin/runtime/http/engine/crt/AsyncStressTest.kt @@ -5,13 +5,13 @@ package aws.smithy.kotlin.runtime.http.engine.crt -import aws.smithy.kotlin.runtime.IgnoreNative import aws.smithy.kotlin.runtime.http.HttpMethod import aws.smithy.kotlin.runtime.http.SdkHttpClient import aws.smithy.kotlin.runtime.http.complete import aws.smithy.kotlin.runtime.http.request.HttpRequestBuilder import aws.smithy.kotlin.runtime.http.request.url import aws.smithy.kotlin.runtime.httptest.TestWithLocalServer +import aws.smithy.kotlin.runtime.io.use import aws.smithy.kotlin.runtime.net.Host import aws.smithy.kotlin.runtime.net.Scheme import io.ktor.server.cio.* @@ -37,37 +37,38 @@ class AsyncStressTest : TestWithLocalServer() { } }.start() - @IgnoreNative // FIXME TlsContext needs to initialize CRT. Segmentation fault. @Test fun testStreamNotConsumed() = runBlocking { // test that filling the stream window and not consuming the body stream still cleans up resources // appropriately and allows requests to proceed (a stream that isn't consumed will be in a stuck state // if the window is full and never incremented again, this can lead to all connections being consumed // and the engine to no longer make further requests) - val client = SdkHttpClient(CrtHttpEngine()) - val request = HttpRequestBuilder().apply { - url { - scheme = Scheme.HTTP - method = HttpMethod.GET - host = Host.Domain(testHost) - port = serverPort - path.decoded = "/largeResponse" + CrtHttpEngine().use { engine -> + val client = SdkHttpClient(engine) + val request = HttpRequestBuilder().apply { + url { + scheme = Scheme.HTTP + method = HttpMethod.GET + host = Host.Domain(testHost) + port = serverPort + path.decoded = "/largeResponse" + } } - } - withTimeout(10.seconds) { - repeat(1_000) { - async { - try { - val call = client.call(request) - yield() - call.complete() - } catch (ex: Exception) { - println("exception on $it: $ex") - throw ex + withTimeout(10.seconds) { + repeat(1_000) { + async { + try { + val call = client.call(request) + yield() + call.complete() + } catch (ex: Exception) { + println("exception on $it: $ex") + throw ex + } } + yield() } - yield() } } } From 3ece5ab78f3b00eef654f396f5dea5d6051fa7e2 Mon Sep 17 00:00:00 2001 From: Ian Botsford <83236726+ianbotsf@users.noreply.github.com> Date: Wed, 13 Aug 2025 20:59:35 +0000 Subject: [PATCH 2/2] remove now-unused @IgnoreNative annotation --- runtime/runtime-core/api/runtime-core.api | 3 --- .../common/src/aws/smithy/kotlin/runtime/Annotations.kt | 6 ------ .../jvm/src/aws/smithy/kotlin/runtime/AnnotationsJvm.kt | 9 --------- .../src/aws/smithy/kotlin/runtime/AnnotationsNative.kt | 8 -------- 4 files changed, 26 deletions(-) delete mode 100644 runtime/runtime-core/jvm/src/aws/smithy/kotlin/runtime/AnnotationsJvm.kt delete mode 100644 runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/AnnotationsNative.kt diff --git a/runtime/runtime-core/api/runtime-core.api b/runtime/runtime-core/api/runtime-core.api index 1ba5b08c40..04d1cf710c 100644 --- a/runtime/runtime-core/api/runtime-core.api +++ b/runtime/runtime-core/api/runtime-core.api @@ -33,9 +33,6 @@ public final class aws/smithy/kotlin/runtime/ErrorMetadata$Companion { public abstract interface annotation class aws/smithy/kotlin/runtime/ExperimentalApi : java/lang/annotation/Annotation { } -public abstract interface annotation class aws/smithy/kotlin/runtime/IgnoreNative : java/lang/annotation/Annotation { -} - public abstract interface annotation class aws/smithy/kotlin/runtime/InternalApi : java/lang/annotation/Annotation { } diff --git a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/Annotations.kt b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/Annotations.kt index 30eed9afe4..ee3ab01e28 100644 --- a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/Annotations.kt +++ b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/Annotations.kt @@ -58,9 +58,3 @@ public annotation class ExperimentalApi */ @DslMarker public annotation class SdkDsl - -/** - * Marks a test that should be ignored on Native platforms - */ -@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) -public expect annotation class IgnoreNative() diff --git a/runtime/runtime-core/jvm/src/aws/smithy/kotlin/runtime/AnnotationsJvm.kt b/runtime/runtime-core/jvm/src/aws/smithy/kotlin/runtime/AnnotationsJvm.kt deleted file mode 100644 index b18b1bec0b..0000000000 --- a/runtime/runtime-core/jvm/src/aws/smithy/kotlin/runtime/AnnotationsJvm.kt +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -package aws.smithy.kotlin.runtime - -@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) -public actual annotation class IgnoreNative diff --git a/runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/AnnotationsNative.kt b/runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/AnnotationsNative.kt deleted file mode 100644 index 76c0ce0cef..0000000000 --- a/runtime/runtime-core/native/src/aws/smithy/kotlin/runtime/AnnotationsNative.kt +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -package aws.smithy.kotlin.runtime - -public actual typealias IgnoreNative = kotlin.test.Ignore