Hi Amper team, the native target’s testRelease lin...
# amper
s
Hi Amper team, the native target’s testRelease linking fails for the shared module and prints the error below, but the build still ends up marked as successful.
Copy code
02:59.707 ERROR :shared:linkMacosArm64TestRelease info: <shared_test> @ /Users/sgopal1/code/kmp-amper/shared/test/CommonTest.kt:30:34: Lambda in function 'httpClientTest' uses unlinked class symbol 'kotlinx.coroutines.test/TestScope|null[0]'
02:59.708 ERROR :shared:linkMacosArm64TestRelease info: <shared_test> @ /Users/sgopal1/code/kmp-amper/shared/test/CommonTest.kt:30:34: Expression can not be evaluated: Expression uses unlinked class symbol 'kotlinx.coroutines.test/TestScope|null[0]'
02:59.708 ERROR :shared:linkMacosArm64TestRelease info: <shared_test> @ /Users/sgopal1/code/kmp-amper/shared/test/CommonTest.kt:30:26: Function 'runTest' can not be called: No function found for symbol 'kotlinx.coroutines.test/runTest|runTest(kotlin.coroutines.CoroutineContext;kotlin.time.Duration;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.test.TestScope,kotlin.Unit>){}[0]'
02:59.708 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No class found for symbol 'kotlinx.coroutines.test/TestScope|null[0]'
02:59.708 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No class found for symbol 'io.ktor.client.engine.mock/MockEngine|null[0]'
02:59.709 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No class found for symbol 'io.ktor.client.engine.mock/MockEngine.Companion|null[0]'
02:59.709 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No class found for symbol 'io.ktor.client.engine.mock/MockRequestHandleScope|null[0]'
02:59.709 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No function found for symbol 'kotlinx.coroutines.test/runTest|runTest(kotlin.coroutines.CoroutineContext;kotlin.time.Duration;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.test.TestScope,kotlin.Unit>){}[0]'
02:59.710 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No function found for symbol 'io.ktor.client.engine.mock/MockEngine.Companion.invoke|invoke(kotlin.coroutines.SuspendFunction2<io.ktor.client.engine.mock.MockRequestHandleScope,io.ktor.client.request.HttpRequestData,io.ktor.client.request.HttpResponseData>){}[0]'
02:59.710 ERROR :shared:linkMacosArm64TestRelease info: <missing declarations>: No function found for symbol 'io.ktor.client.engine.mock/respondError|respondError@io.ktor.client.engine.mock.MockRequestHandleScope(io.ktor.http.HttpStatusCode;kotlin.String;io.ktor.http.Headers){}[0]'

Build successful
test command fails for native target, but works fine on jvm
Copy code
[ RUN      ] CommonTest.platformTest
kotlin.native.internal.IrLinkageError: Expression can not be evaluated: Expression uses unlinked class symbol 'kotlinx.coroutines.test/TestScope|null[0]'
[       OK ] CommonTest.platformTest (0 ms)
[ RUN      ] CommonTest.httpClientTest
    at 0   shared_test.kexe                    0x102282077        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 99 (/opt/buildAgent/work/2d153abd4d2c0600/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Throwable.kt:30:51)
    at 1   shared_test.kexe                    0x10227c7e7        kfun:kotlin.Error#<init>(kotlin.String?){} + 95 (/opt/buildAgent/work/2d153abd4d2c0600/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/Exceptions.kt:12:51)
[  FAILED  ] CommonTest.httpClientTest (0 ms)
    at 2   shared_test.kexe                    0x1022ae6eb        kfun:kotlin.native.internal.IrLinkageError#<init>(kotlin.String?){} + 95 (/opt/buildAgent/work/2d153abd4d2c0600/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/RuntimeUtils.kt:138:51)
[----------] 2 tests from CommonTest (1454 ms total)
So, • Any idea why the tests are failing on Amper? • The build is marked as successful even though the tests have failed.
f
Hi! Sorry for the delayed answer. This may be a bug at some level. Could you provide more details about the project? What configuration/dependencies are used? Maybe you could share the project/a minimal reproducible project?
s
Thanks for looking into it… I am using the latest versions of kotlin (
2.2.20-Beta2
) and coroutines . Would that be an issue? You can reproduce this by running
Copy code
$ git clone <https://github.com/sureshg/kmp-amper.git>
$ cd kmp-amper
$ ./amper build -v release
# Tests are failing though, but the binary is working fine
$ ./amper test
👀 1
f
Thanks for the project! Yes, I've found a bug, the fix is on the way. I'll ping this thread when the fixed dev version is available.
thank you color 1
So the
0.8.0-dev-3098
and later contain the fix for native test linkage dependencies. Why linkage errors don't fail the task is going to be investigated separately.
thank you color 1
s
cool..working fine now.
Copy code
00:20.260 INFO  :macos:linkMacosArm64TestRelease No test code was found compiled for fragments [appleTest, commonTest, macosArm64Test, macosTest, nativeTest] of module 'macos', skipping linking
00:20.291 INFO  :shared:compileMacosX64TestRelease Compiling module 'shared' for platform 'macosX64'...
00:20.296 INFO  :macos:linkMacosArm64Release Linking native 'macosArm64' executable for module 'macos'...
00:20.376 INFO  :shared:compileMacosArm64TestRelease Compiling module 'shared' for platform 'macosArm64'...
Build successful
By the way., any idea when we can expect the 0.8 release (with plugin support) ? 😀
f
Plugin support is currently full speed in design/development. We hope to include it in 0.8 release, but let's see how it goes. So I can't really say much besides that we aim to release extensibility prototype before the end of the year
👍 1