Try harder to ensure non-empty profiles in tests

Also test non-emptiness only for C=true profiles. See:
https://github.com/JuliaLang/julia/commit/7c4330b900dbeae698fee2621f4ce82911457199#commitcomment-8094422