There is a wonderful post by Chis on this topic. This blog post is a complement of that post, reflecting my efforts on testing FatFS.
After cloning the rtems, make sure you build tests:
$ git clone https://gitlab.rtems.org/rtems/rtos/rtems.git
$ cd rtems
Here’s the sample ini
config:
[DEFAULT]
RTEMS_DEBUG = False
RTEMS_POSIX_API = True
[i386/pc686]
BUILD_TESTS = True
Then just run:
$ ./waf configure --pefix=/opt/rtems/7 --rtems-config=../pc686.ini
$ ./waf
And it will compile rtems + tests. Now you have to run rtems-test
command. The executable of rtems-test
is in the bin
folder of your prefix. You have to use the pc-qemu
as the bsp. This is how you would run filesystem tests:
$ /opt/rtems/7/bin/rtems-test --rtems-bsp=pc-qemu /PATH/TO/RTEMS/build/i386/pc686/testsuites/fstests
How to add a test
You need to add the tests to the spec
for the waf to actually build them. Add a yaml
file describing your tests to spec/build/testsuites/fstests
. Here’s an example:
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
build-type: test-program
cflags: []
copyrights:
- Copyright (C) 2020 embedded brains GmbH & Co. KG
cppflags: []
cxxflags: []
enabled-by: true
features: c cprogram
includes:
- testsuites/fstests/fatfs_support
ldflags: []
links: []
source:
- testsuites/fstests/fatfs_rdwr/init.c
stlib: []
target: testsuites/fstests/fatfs_rdwr.exe
type: build
use-after: []
use-before:
- testfatfs
And then edit spec/build/testsuites/fstests/grp.yml
to include your test. You can use the same logic as above to run your own tests.