| status | dash | bash | mksh | ash | osh | |
| pass | 18 | 22 | 17 | 20 | 21 | |
| ok | 4 | 1 | 4 | 3 | 0 | |
| BUG | 2 | 1 | 3 | 1 | 0 | |
| FAIL | 0 | 0 | 0 | 0 | 3 | |
| total | 24 | 24 | 24 | 24 | 24 | |
| case | dash | bash | mksh | ash | osh | description |
| 0 | pass | pass | pass | pass | pass | getopts empty |
| 1 | pass | pass | pass | pass | pass | getopts sees unknown arg |
| 2 | pass | pass | pass | pass | pass | getopts three invocations |
| 3 | pass | pass | pass | pass | pass | getopts resets OPTARG |
| 4 | pass | pass | pass | pass | pass | Basic getopts invocation |
| 5 | pass | ok | ok | pass | pass | getopts with invalid variable name |
| details | details | |||||
| 6 | pass | pass | pass | pass | pass | getopts with invalid flag |
| 7 | pass | pass | pass | pass | pass | getopts with with - |
| 8 | pass | pass | pass | pass | pass | getopts missing required argument |
| 9 | pass | pass | pass | pass | pass | getopts doesn't look for flags after args |
| 10 | pass | pass | pass | pass | pass | getopts with explicit args |
| 11 | pass | pass | pass | pass | pass | OPTIND |
| 12 | pass | pass | BUG | pass | FAIL | OPTIND after multiple getopts with same spec |
| details | details | |||||
| 13 | BUG | pass | BUG | BUG | FAIL | OPTIND after multiple getopts with different spec |
| details | details | details | details | |||
| 14 | pass | BUG | BUG | pass | FAIL | OPTIND narrowed down |
| details | details | details | ||||
| 15 | pass | pass | pass | pass | pass | Getopts parses the function's arguments |
| 16 | pass | pass | pass | pass | pass | Local OPTIND |
| 17 | ok | pass | ok | ok | pass | two flags: -ab |
| details | details | details | ||||
| 18 | BUG | pass | pass | pass | pass | flag and arg: -c10 |
| details | ||||||
| 19 | ok | pass | ok | ok | pass | More Smooshing 1 |
| details | details | details | ||||
| 20 | ok | pass | ok | ok | pass | More Smooshing 2 |
| details | details | details | ||||
| 21 | ok | pass | pass | pass | pass | OPTIND should be >= 1 (regression) |
| details | ||||||
| 22 | pass | pass | pass | pass | pass | getopts bug #1523 |
| 23 | pass | pass | pass | pass | pass | More regression for #1523 |
98 passed, 12 OK, 0 not implemented, 7 BUG, 3 failed, 0 timeouts, 0 cases skipped 3 failed under osh
| bash | 5 getopts with invalid variable name stdout: status=1 opt= OPTARG=foo OPTIND=3stderr: bash: line 2: getopts: `opt-': not a valid identifier |
| mksh | 5 getopts with invalid variable name stdout: status=1 opt= OPTARG= OPTIND=1stderr: mksh: <stdin>[2]: getopts: opt-: is not an identifier |
| mksh | 12 OPTIND after multiple getopts with same spec stdout: OPTIND=1 - - OPTIND=4 OPTIND=4stderr: mksh: <stdin>[15]: getopts: arguments changed since last call |
| osh | 12 OPTIND after multiple getopts with same spec [osh stdout] Expected 'OPTIND=1\n-\n-\nOPTIND=4\nOPTIND=1\n', got 'OPTIND=1\n-\n-\nOPTIND=4\nOPTIND=4\n' stdout: OPTIND=1 - - OPTIND=4 OPTIND=4stderr: |
| dash | 13 OPTIND after multiple getopts with different spec stdout: . OPTIND=2 - - - OPTIND=5 _ OPTIND=2stderr: No arg for -f option |
| mksh | 13 OPTIND after multiple getopts with different spec stdout: . OPTIND=2 - - OPTIND=5 OPTIND=5stderr: mksh: <stdin>[16]: getopts: arguments changed since last call |
| ash | 13 OPTIND after multiple getopts with different spec stdout: . OPTIND=2 - - - OPTIND=5 _ OPTIND=2stderr: No arg for -f option |
| osh | 13 OPTIND after multiple getopts with different spec [osh stdout] Expected '.\nOPTIND=2\n-\n-\nOPTIND=5\nOPTIND=2\n', got '.\nOPTIND=2\n-\n-\nOPTIND=5\nOPTIND=5\n' stdout: . OPTIND=2 - - OPTIND=5 OPTIND=5stderr: |
| bash | 14 OPTIND narrowed down stdout: a=1 b= c= d=1 e=Estderr: |
| mksh | 14 OPTIND narrowed down stdout: a=1 b= c= d=1 e=Estderr: |
| osh | 14 OPTIND narrowed down [osh stdout] Expected 'a=1 b= c=1 d=1 e=E\n', got 'a=1 b= c= d=1 e=E\n' stdout: a=1 b= c= d=1 e=Estderr: |
| dash | 17 two flags: -ab stdout: OPTIND=2 opt=a OPTARG= OPTIND=2 opt=b OPTARG=stderr: |
| mksh | 17 two flags: -ab stdout: OPTIND=2 opt=a OPTARG= OPTIND=2 opt=b OPTARG=stderr: |
| ash | 17 two flags: -ab stdout: OPTIND=2 opt=a OPTARG= OPTIND=2 opt=b OPTARG=stderr: |
| dash | 18 flag and arg: -c10 stdout: OPTIND=2 opt=c OPTARG=10 OPTIND=2 opt=? OPTARG=10stderr: |
| dash | 19 More Smooshing 1 stdout: OPTIND=2 opt=a OPTARG= OPTIND=3 opt=b OPTARG=hi OPTIND=5 opt=c OPTARG=hellostderr: |
| mksh | 19 More Smooshing 1 stdout: OPTIND=2 opt=a OPTARG= OPTIND=3 opt=b OPTARG=hi OPTIND=5 opt=c OPTARG=hellostderr: |
| ash | 19 More Smooshing 1 stdout: OPTIND=2 opt=a OPTARG= OPTIND=3 opt=b OPTARG=hi OPTIND=5 opt=c OPTARG=hellostderr: |
| dash | 20 More Smooshing 2 stdout: OPTIND=2 opt=a OPTARG= OPTIND=2 opt=b OPTARG= OPTIND=2 opt=c OPTARG=10stderr: |
| mksh | 20 More Smooshing 2 stdout: OPTIND=2 opt=a OPTARG= OPTIND=2 opt=b OPTARG= OPTIND=2 opt=c OPTARG=10stderr: |
| ash | 20 More Smooshing 2 stdout: OPTIND=2 opt=a OPTARG= OPTIND=2 opt=b OPTARG= OPTIND=2 opt=c OPTARG=10stderr: |
| dash | 21 OPTIND should be >= 1 (regression) stdout: stderr: dash: 1: Illegal number: -1 |