In CMSIS we are using a Test Framework that offers the flexibility to:
We have used this framework on various projects, across 4 different compilers, on many different targets (simulation, FPGA without UART, etc.).
The framework is for example here
https://github.com/ARM-software/CMSIS-Driver_Validation/tree/master/Source. But we used it also for various other projects.
If there is interest, we could do some work to explain it better and make it scalable to TF-M.