The Linux man page requires that the getopt_long() and getopt_long_only() functions accept arguments to options in a form like:
--option=argument
This PR adds a test that missing functionality that was recently added to NuttX.
This change also fixes an error in string comparison that was working before only because of the way that strings are stored by in linker ELF. The address of the strings were being compared, not the value of the string.
This change effects only the getopt() tests of the OS test.
Tested on a simulator NSH configuration and used to verify the NuttX change.
Fix optind range checking. optind may index through argc (to the NULL argv entry) on the last option since optind is required to always point to the next command line argument.
Add two more test cases were the final thing on the command line is an invalid long option.
Fix a check that used an older, obsoleted hard-coded value that was not updated.
This should have no impact other than to the getopt() test cases of the OS test.
Tested on the simulator using a modified NSH configuration.
Add logic to assure that the getopt() functions parse exactly the correct number of parameters. Previously if the test terminated early, the error would be undetected. Also, prevents indexing past the end of the results array.
Fixes a coding error that was not causing a test failure.
Add some minimal level of testing for invalid options (this found a good bug in getopt_long()).
Affects only the getopt() test cases of the OS test.
Verified using an NSH simulator configuration set up to add apps/testing/ostest as a built-in command.
This new test was used to verify the new implementations of getopt_long() and getopt_long_only() and to verify that there are no regressions to the existing getopts().
Only the OS test is affect by this change.
Verified with the getopt() modifications on a modified version of the sim:nsh configuration.