Suggestions for testing Simba OS applications?

How tests can be made for Simba OS applications? There are following potential ways:

  1. Using Simba OS testing framework

    This is most desirable way, because tested code can use Simba functionality, including threads, queues, etc. However, I can’t figure out how to build native code with framework = simba under Platformio. There’s no framework and board for native platform.

    Tested application can be built with Simba build system, but it requires supporting two build systems and I had problems with setting up Simba build system, it does not work out of the box and requires lots of #define/#include debugging.

  2. Using Platformio tests

    Less desirable way, because it requires to make your code not dependent on Simba. Even if device-specific things can be relatively easily abstracted away, you can’t use threads, sync primitives and you have to target both Simba and libc for things like exact number of bytes-types and string manipulation. It’s too hard.

  3. Running tests on MCU

    Test code can be run on MCU, probably with Platformio testing system, but that has lots of issues. I would prefer native tests, however on-device tests might be the preferred way for some projects.

Any ideas?

Figured out how to build test code against Simba OS type definitions (not actual Simba OS code, but at least you can use things like time_t and basic type definitions without switching between stdint.h and other POSIX things and Simba headers).

You have to add several include paths, like in this pseudo-makefile:

SIMBA_PATH=/your/simba/os/path
BIN=tests
CFLAGS=-I${SIMBA_PATH}/src \
       -I${SIMBA_PATH}/src/kernel/ports/linux/gnu \
       -I${SIMBA_PATH}/src/boards/linux \
       -I${SIMBA_PATH}/src/mcus/linux \
       -I${SIMBA_PATH}/src/filesystems \
       -I${SIMBA_PATH}/3pp/compat \
       -I${SIMBA_PATH}/src/drivers/ports/linux

SRCS=foo.c bar.c
OBJS = $(SRCS:.c=.o)

$(BIN): $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(BIN)

Then you can even use Simba OS functions in tested code, but you have to stub them in tests.

I think it’s not that hard to integrate it with Platformio, using custom targets, but I have no experience with Scons and didn’t try it yet.