{"id":58,"date":"2025-07-08T00:13:24","date_gmt":"2025-07-08T00:13:24","guid":{"rendered":"https:\/\/blog.ganji.dev\/?p=58"},"modified":"2025-07-08T00:13:24","modified_gmt":"2025-07-08T00:13:24","slug":"how-to-test-filesystems-in-rtems","status":"publish","type":"post","link":"https:\/\/blog.ganji.dev\/?p=58","title":{"rendered":"How to test filesystems in RTEMS"},"content":{"rendered":"\n<p>There is a wonderful <a href=\"https:\/\/users.rtems.org\/t\/file-system-development-testing-and-debugging\/200\">post<\/a> by Chis on this topic. This blog post is a complement of that post, reflecting my efforts on testing FatFS.<\/p>\n\n\n\n<p>After cloning the rtems, make sure you build tests:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ git clone https:\/\/gitlab.rtems.org\/rtems\/rtos\/rtems.git\n$ cd rtems<\/code><\/pre>\n\n\n\n<p>Here&#8217;s the sample <code>ini<\/code> config:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;DEFAULT]\nRTEMS_DEBUG = False\nRTEMS_POSIX_API = True\n\n&#91;i386\/pc686]\nBUILD_TESTS = True<\/code><\/pre>\n\n\n\n<p>Then just run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ .\/waf configure --pefix=\/opt\/rtems\/7 --rtems-config=..\/pc686.ini\n$ .\/waf<\/code><\/pre>\n\n\n\n<p>And it will compile rtems + tests. Now you have to run <code>rtems-test<\/code> command. The executable of <code>rtems-test<\/code>  is in the <code>bin<\/code> folder of your prefix. You have to use the <code>pc-qemu<\/code> as the bsp. This is how you would run filesystem tests:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ \/opt\/rtems\/7\/bin\/rtems-test --rtems-bsp=pc-qemu \/PATH\/TO\/RTEMS\/build\/i386\/pc686\/testsuites\/fstests<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">How to add a test<\/h2>\n\n\n\n<p>You need to add the tests to the <code>spec<\/code> for the waf to actually build them. Add a <code>yaml<\/code> file describing your tests to <code>spec\/build\/testsuites\/fstests<\/code>. Here&#8217;s an example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause\nbuild-type: test-program\ncflags: &#91;]\ncopyrights:\n- Copyright (C) 2020 embedded brains GmbH &amp; Co. KG\ncppflags: &#91;]\ncxxflags: &#91;]\nenabled-by: true\nfeatures: c cprogram\nincludes:\n- testsuites\/fstests\/fatfs_support\nldflags: &#91;]\nlinks: &#91;]\nsource:\n- testsuites\/fstests\/fatfs_rdwr\/init.c\nstlib: &#91;]\ntarget: testsuites\/fstests\/fatfs_rdwr.exe\ntype: build\nuse-after: &#91;]\nuse-before:\n- testfatfs<\/code><\/pre>\n\n\n\n<p>And then edit <code>spec\/build\/testsuites\/fstests\/grp.yml<\/code> to include your test. You can use the same logic as above to run your own tests.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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: Here&#8217;s the sample ini config: Then just run: And it will compile rtems + tests. Now you have to run rtems-test [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-58","post","type-post","status-publish","format-standard","hentry","category-gsoc"],"_links":{"self":[{"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=\/wp\/v2\/posts\/58","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=58"}],"version-history":[{"count":2,"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=\/wp\/v2\/posts\/58\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=\/wp\/v2\/posts\/58\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=58"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=58"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ganji.dev\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=58"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}