native
native copied to clipboard
JNI coverage doesn't include JNIgen tests
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
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.
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.
Thanks for diving into this @liamappelbe!