altavir
08/19/2020, 10:56 AMArkadii Ivanov
08/19/2020, 11:18 AMElena Lepilkina
08/19/2020, 11:19 AM-opt
for tests binaries.
Also there can be some problems both in compiler and library itself. We had some questions similar to this from ktor
team some time ago. We've managed to resolve them (there were patches in library and K/N compiler).
You mentioned here kotlinx-io
, we didn't get any questions connected with this one library from library team.
To answer we need to have a look at exact example. Better if it's formed as an issue.altavir
08/19/2020, 11:23 AMElena Lepilkina
08/19/2020, 11:25 AMjvmTests
). What is problem to use it?altavir
08/19/2020, 11:27 AMbuild
relies on allTests
, which means that I will have to change some logic in it. It is doable on our side, but there is still a small problem here.Arkadii Ivanov
08/19/2020, 11:28 AMval original = Float.MAX_VALUE
val bits = original.toRawBits()
val result = Float.fromBits(bits)
assertEquals(original, result)
This test fails in JS only.altavir
08/19/2020, 11:30 AMArkadii Ivanov
08/19/2020, 11:31 AMArkadii Ivanov
08/19/2020, 11:32 AMElena Lepilkina
08/19/2020, 11:34 AMWhat I have in mind for our own libraries is to be able to run common tests only on JVM since we rarely have platform-specific logic.
The problem is that I want to run platform-specific tests if they are defined.Sorry, I can't get what you want to configure? Run native tests only when changes are in native source sets? In general, it isn't expected such a big difference in tests performance (as I got right ~60 times)
altavir
08/19/2020, 11:34 AMaltavir
08/19/2020, 11:35 AMnativeMain
tests on native. Do not run common tests on native unless it is a special releas build.Elena Lepilkina
08/19/2020, 11:36 AMAlsoWhy do you needrelies onbuild
, which means that I will have to change some logic in it.allTests
build
task always during development?altavir
08/19/2020, 11:37 AMElena Lepilkina
08/19/2020, 11:40 AMDo not run common tests on native unless it is a special releas buildCommon tests mean that they should be checked everywhere. Even one code in common can have problems in different targets. At least there are three separate compilers and they can have different problems and of course targets specific. You can't be aware of all details of all platforms. And when you think that all code in common part should work fine, it can be false.
altavir
08/19/2020, 11:42 AMElena Lepilkina
08/19/2020, 11:43 AMMaybe it would be better to use custom build task.If you want to check tests you can call
jvmTests
task, it'll rebuild everything you need to run tests.
publishing to maven local rely on build.I amn't sure about default behaviour, but at least our libraries don't run all tests during publishing.
Elena Lepilkina
08/19/2020, 11:45 AMI do not see win-win solution for that.Could you then provide exact scenarios when you run
build
task and can't escape it?altavir
08/19/2020, 11:46 AMElena Lepilkina
08/19/2020, 11:51 AMTo answer we need to have a look at exact example. Better if it's formed as an issue. (This is still appriciated, if you can share your code where is such a great difference. It can help and fix some performance problems.
Publish to maven local or teporary repositryIt's strange, it should depends on
assemble
task not build one by default. Tests aren't run during publishing.
cc @ilya.matveevaltavir
08/19/2020, 1:50 PMaltavir
08/19/2020, 1:52 PMElena Lepilkina
08/19/2020, 2:27 PMktor
seems to contain same module, may be it's already fixed. If you can't remember tests, I'll have a look lateraltavir
08/19/2020, 2:29 PMilya.matveev
08/20/2020, 8:00 AMIt's strange, it should depends on assemble task not build one by default. Tests aren't run during publishing.Yes, this is the case. Publishing doesn't trigger running tests by default and AFAIK kotlinx-io doesn't change this default in its buildscripts.
So from command line I could only tell the number of test being doneGradle stores an HTML test report in
build/reports/tests
. Could you please share it?
What I have in mind for our own libraries is to be able to run common tests only on JVM since we rarely have platform-specific logic. And run full set of native tests only during releases.You can achieve this by using test filters. You can move native-specific tests into a separate package and then configure a separate test run to execute tests from this package only:
kotlin.macosX64("macos") {
val short by testRuns.creating {
filter {
includeTestsMatching("org.sample.native.*")
}
}
}
This snippet adds a separate task macosShortTest
which runs only tests from the org.sample.native
package. The default macosTest
task is still available and runs all tests.
You also can configure filters of the default test task by accessing the task itself
val macosTest by tasks.getting(KotlinNativeTest::class)
or by configuring the corresponding test run:
kotlin.macosX64("macos") {
val test by testRuns.getting
with(test) { ... }
}
altavir
08/20/2020, 8:26 AM