You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been writing some logging utilities lately and wanted to be able to unit test stuff on my desktop to speed up the process.
My use case involves using Mbed's C++ file system API to take advantage of the mbed::FileHandle polymorphism; Using a mbed::FileHandle allows logging output to by dynamically redirected to non-volatile files or to a serial port or anything else subclassing mbed::FileHandle (eg: mbed::BufferedSerial, etc).
I'm on a time crunch, so I decided to simply write my logging stuff with the C file I/O API. This is already portable because Mbed redirects the C file I/O calls.
I think a nice approach for bench-testing Mbed applications that require realistic file system operations would be to implement an mbed::FileSystem that calls the standard C file I/O functions underneath. This would make Mbed's C++ filesystem API portable (at least to Linux).
I figured I would mention this here because it's the same end-goal: being able to build and bench-test Mbed-OS applications on a PC rather than target hardware.
The text was updated successfully, but these errors were encountered:
I definitely think something like this would be on our future road map, but I'm not sure how much bandwidth we have right now. If you want, we would love it if you helped us with the implementation of this, if you'd be willing.
@AGlass0fMilk a bit late to the game, so it might not be relevant for you now, but we found ourselves in the same situation working on a simple logger using mbed::FileHandle
To be able to run the unit tests and check the output of the logger, we added a small abstraction on top of that to allow us to define a sink function which is the one responsible for actually printing stuff.
A default one is provided using mbed::BufferedSerial but it can be easily overridden in unit tests.
Hi USCRPL,
Thanks for all the work you've done with Mbed-OS!
I have been writing some logging utilities lately and wanted to be able to unit test stuff on my desktop to speed up the process.
My use case involves using Mbed's C++ file system API to take advantage of the
mbed::FileHandle
polymorphism; Using ambed::FileHandle
allows logging output to by dynamically redirected to non-volatile files or to a serial port or anything else subclassingmbed::FileHandle
(eg:mbed::BufferedSerial
, etc).I'm on a time crunch, so I decided to simply write my logging stuff with the C file I/O API. This is already portable because Mbed redirects the C file I/O calls.
I think a nice approach for bench-testing Mbed applications that require realistic file system operations would be to implement an
mbed::FileSystem
that calls the standard C file I/O functions underneath. This would make Mbed's C++ filesystem API portable (at least to Linux).I figured I would mention this here because it's the same end-goal: being able to build and bench-test Mbed-OS applications on a PC rather than target hardware.
The text was updated successfully, but these errors were encountered: