-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use on embedded hardware #158
Comments
Thanks a lot for sharing your experience! I don't program embedded devices myself, but I always had this in the back of my head as a potential use case for snitch. My main worry was that weird compiler requirements might make it impossible to use C++20. Cool to see that it isn't the case, and I'm excited to see that snitch is indeed viable in this parallel universe, even if after a few tweaks. The thread-local issue is definitely something we should merge, and your commit seems almost on the mark: it is missing the Meson support, as well as documentation in the README. I would also put the The printing stuff is annoying. Are you able to use
Option 3 is the simplest, since the code is already there. It is just not as optimised as the STL stuff, so we currently branch out to the "fast" algorithm at runtime when possible for maximum speed. Option 2 would be ideal, but I don't think it has broad enough compiler support; so perhaps a mix of option 2 and 3 would be optimal: use |
Willing to clean up the commit and open an MR on the THREAD_LOCAL fix As far as the printing, falling back on the constexpr functions you have isn't bad. Having unit tests running on hardware is already pretty amazing and the performance hit wouldn't mean much compared to the bottle-neck of flashing the target. I agree though that a mix of 2 and 3 would be best, and as support for As far as the |
Sorry I had forgotten about that last one! A simple fix would be to make
Probably a bug, will take a look. Edit 1: can't seem to be able to reproduce this. Can you show which values you used to trigger the problem, please? Or alternatively, send us a copy of your |
I actually ended up creating customization points for my SDK to redirect standard streams. But I have worked in systems before where that isn't an easy option for various reasons. Since that function reference exists it would be best to use it IMO.
so something like int main(int argc, char** argv) {
snitch::tests.print_callback = &my_print;
snitch::cli::console_print = &my_print;
std::optional<snitch::cli::input> args = snitch::cli::parse_arguments(argc, argv);
if (args) {
snitch::tests.configure(*args);
return snitch::tests.run_tests(*args) ? 0 : 1;
}
return 1;
} |
This is fixed in #163. |
This is done in #165.
Yep! |
Awesome that you found this! I was just thinking that I owed a repro on this bug. The tiny nit that I found that I failed to mention I think: snitch/src/snitch_reporter_teamcity.cpp Line 118 in 81cce09
I think should use a float literal to avoid an implicit promotion of duration to a double: append_or_truncate(string, static_cast<std::size_t>(duration * 1e6f)); I found this because I recently replaced the GCC option -fsingle-precision-constant here is an article on the topic if anyone is interested in more depth. |
Ah that's a good point! I didn't know that some platforms would emulate doubles in software... It's such a small change, I'll piggy back on one of the two open PRs. Thanks. |
I think all the reported issues have not been fixed in the main branch, and released as v1.2.5. Thank you for all the useful feedback! |
I have been looking for a test framework that will work for host side and on target testing without compromising modernity. I found snitch and it seems to be exactly what i am looking for!
Our systems are C++20 and bare metal / RTOS but the main restrictions are just:
With the customizable nature of snitch it was pretty easy to get it running, just a few things I had to patch and some things I noticed. So this issue is an FYI and if you are interested I can clean up and upstream my changes to you.
thread_local
triggers a dynamic allocation (commit)using
thread_local
triggers a dynamic allocation in newlib-nano. I don't know much about this, it was caught by an assert I have in_sbrk
. since snitch doesn't appear to support sharding or other mutli-threaded things right now I took the easy route here and added a configure optionSNITCH_WITH_MULTITHREADING
, and when it is off just don't usethread_local
Using a custom snprintf (commit)
newlib-nano doesn't support
%llu
and just prints outlu
instead of the actual number. there are at least half a dozen ways to solve this and I tried a few but the least intrusive one I landed on was to have a configuration optionSNITCH_DEFINE_APPEND_FAST
that is ON by default but when disabled excluded the contents of snitch_append.cpp. The program then has to provide implementations of the variousappend_fast
functions.Some smaller things I noticed but haven't addressed yet since they aren't an issue in normal flow of running tests:
SNITCH_MAX_EXPR_LENGTH
andSNITCH_MAX_MESSAGE_LENGTH
aren't the same, no conversion between a short string with the two different lengthsThe text was updated successfully, but these errors were encountered: