native icon indicating copy to clipboard operation
native copied to clipboard

JNI coverage doesn't include JNIgen tests

Open HosseinYousefi opened this issue 1 year ago • 3 comments
trafficstars

The coverage seems to be low since it's not adding the tests in package:jnigen that also cover key functionalities of package:jni.

Originally posted by @HosseinYousefi in https://github.com/dart-lang/native/issues/998#issuecomment-1997446372

HosseinYousefi avatar Mar 14 '24 13:03 HosseinYousefi

dart pub global run coverage:test_with_coverage is run for both package:jni and package:jnigen separately. I don't know if package:coverage has any support for running for mono_repos.

packages package:native_* have the same issue. (There I end up writing tests in the packages themselves to increase coverage.) So they would benefit from the same improvement.

dcharkes avatar Mar 15 '24 09:03 dcharkes

The test_with_coverage script only handles very simple use cases. Internally it runs the test, then calls collect_coverage and format_coverage. You might need to manually run those steps like we do in ffigen.

All of package:objective_c's functionality is covered by ffigen tests, so I just had to update ffigen's coverage script to allow objective_c through the filter: https://github.com/dart-lang/native/pull/1061/files#diff-11be0910e38d60287f7b12288096c1421f3e8f3912daccf0de351c46abb6f48a

You'll probably need something similar for jni.

liamappelbe avatar Apr 09 '24 03:04 liamappelbe

Thanks for diving into this @liamappelbe!

dcharkes avatar Apr 09 '24 07:04 dcharkes