stage1's rustdoc is using stage0's libtest which does not have
a fix from 069cf9dfc9, making the test run fail. Ensure that
this test is executed with everything recompiled in stage2.
Fix the panic in write_message() which expects messages to contain
no embedded newlines. We still want a trailing newline at the end
of the file though, so write it in different manner.
Doctest runner no longer panics, but the output is kinda broken
when `compile_fail` doctests are present. This is because they
are not mergeable.
Copied validate_junit.py from libtest-junit.
JUnit format works well in edition 2021, but is currently broken
in edition 2024 by the mergeable doctest report.