Reimport Shell Command questions

I’m in the poking around and getting my bearings phase of this, and I have a couple of clarification questions:

-I’m really focused on robust testing on these, Is there a preexisting test harness or API to feed standard input and assert against standard output? Or would a custom test bench be required for automated testing?

-I’ve noticed in the forums some friction around global state variables like ‘optind’, is the RTEMS preferred way to manually reset ‘optind =1;’ and ‘optreset = 1;’ at the beginning of rtems_shell_main_[cmd] functions? Or is there a mechanism within the current infrastructure that I should be using to isolate these?

Any advice or pointers around testsuites to where I should be looking is appreciated.

Feel free to ask specific questions here.

I will review proposals that are linked through the tracking page on gitlab. I would rather not have every contributor asking for individual blanket reviews of their proposal here.

Understood, I’ll keep this thread reserved for specific questions as I dig deeper.

I think there are a few tests (capture and shell) that do something for testing interactive I/O, but I don’t know if there is any standard way. There is also a unit testing framework (“T Tests”) that could be investigated for suitability.

Hey Gedare,

So I’ve been digging, I just wanted to confirm my understanding of what I’m seeing is correct.

It looks like the shell is the right move, scripted test could be performed like in testsuites/libtests/init.c on line 121.

The T test framework appears to be more geared toward validating specific lower-level C logic where appropriate.

Also it appears that the prefered pattern with globals is to convert upstream commands to use ‘getopt_r’ with a local state object.

Do those points all sound right to you?