Backport PR #6556: Use some more informative asserts in inprocess kernel tests

Prompted by gh-6552 (but doesn't fix it)