munit icon indicating copy to clipboard operation
munit copied to clipboard

munit on an embedded system without files or filesystem

Open 9a3eedi opened this issue 5 years ago • 1 comments

Hi.

I've been looking for a unit test framework that I could use on my embedded ARM Cortex-M3 board, which runs FreeRTOS without a filesystem. munit looked like a good choice so I went ahead and wrote a bunch of tests. Unfortunately I wasn't able to run anything, because it wants to create a temporary file to redirect stderr with, but my platform is unable to work with files at all.

This is mainly my mistake, perhaps I should've evaluated munit better before choosing it for my testing needs, but before I rewrite my tests to use another test framework, is there any straightfoward way I can get munit to work on an embedded target that does not run a memory-protected OS like Linux and does not have a filesystem?

9a3eedi avatar Jan 26 '21 09:01 9a3eedi

Upon closer inspection, I figured that I can simply redirect stderr_buf to my actual stderr (which is the behaviour I wanted). This fixed the issue I'm having. However, it's a quick hack, and I'm not really sure if this is considered acceptable to do. Ideally I would put some kind of define somewhere that allows me to not buffer stderr

9a3eedi avatar Jan 26 '21 09:01 9a3eedi