Results for builtin-getopts.test.sh

statusdashbashmkshashosh
pass 2528232728
ok 41430
BUG 22410
FAIL 00003
total3131313131
casedashbashmkshashoshdescription
0pass pass pass pass pass getopts empty
1pass pass pass pass pass getopts sees unknown arg
2pass pass pass pass pass getopts three invocations
3pass pass pass pass pass getopts resets OPTARG
4pass BUG BUG pass pass OPTARG is empty (not unset) after parsing a flag doesn't take an arg
detailsdetails
5pass pass pass pass pass Basic getopts invocation
6pass ok ok pass pass getopts with invalid variable name
detailsdetails
7pass pass pass pass pass getopts with invalid flag
8pass pass pass pass pass getopts with with -
9pass pass pass pass pass getopts missing required argument
10pass pass pass pass pass getopts doesn't look for flags after args
11pass pass pass pass pass getopts with explicit args
12pass pass pass pass pass OPTIND
13pass pass BUG pass FAIL OPTIND after multiple getopts with same spec
detailsdetails
14BUG pass BUG BUG FAIL OPTIND after multiple getopts with different spec
detailsdetailsdetailsdetails
15pass BUG BUG pass FAIL OPTIND narrowed down
detailsdetailsdetails
16pass pass pass pass pass Getopts parses the function's arguments
17pass pass pass pass pass Local OPTIND
18ok pass ok ok pass two flags: -ab
detailsdetailsdetails
19BUG pass pass pass pass flag and arg: -c10
details
20ok pass ok ok pass More Smooshing 1
detailsdetailsdetails
21ok pass ok ok pass More Smooshing 2
detailsdetailsdetails
22ok pass pass pass pass OPTIND should be >= 1 (regression)
details
23pass pass pass pass pass getopts bug #1523
24pass pass pass pass pass More regression for #1523
25pass pass pass pass pass getopts silent error reporting - invalid option
26pass pass pass pass pass getopts silent error reporting - missing required argument
27pass pass pass pass pass getopts normal mode - invalid option (compare with silent)
28pass pass pass pass pass getopts normal mode - missing required argument (compare with silent)
29pass pass pass pass pass getopts handles '--' #2579
30pass pass pass pass pass getopts leaves all args after '--' as operands #2579
131 passed, 12 OK, 0 not implemented, 9 BUG, 3 failed, 0 timeouts, 0 cases skipped
3 failed under osh

Details on runs that didn't PASS

bash4 OPTARG is empty (not unset) after parsing a flag doesn't take an arg

stdout:
name=a
stderr:
bash: line 4: OPTARG: unbound variable
mksh4 OPTARG is empty (not unset) after parsing a flag doesn't take an arg

stdout:
name=a
stderr:
mksh: <stdin>[4]: OPTARG: parameter not set
bash6 getopts with invalid variable name

stdout:
status=1 opt= OPTARG=foo OPTIND=3
stderr:
bash: line 2: getopts: `opt-': not a valid identifier
mksh6 getopts with invalid variable name

stdout:
status=1 opt= OPTARG= OPTIND=1
stderr:
mksh: <stdin>[2]: getopts: opt-: is not an identifier
mksh13 OPTIND after multiple getopts with same spec

stdout:
OPTIND=1
-
-
OPTIND=4
OPTIND=4
stderr:
mksh: <stdin>[15]: getopts: arguments changed since last call
osh13 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=4
stderr:
dash14 OPTIND after multiple getopts with different spec

stdout:
.
OPTIND=2
-
-
-
OPTIND=5
_
OPTIND=2
stderr:
No arg for -f option
mksh14 OPTIND after multiple getopts with different spec

stdout:
.
OPTIND=2
-
-
OPTIND=5
OPTIND=5
stderr:
mksh: <stdin>[16]: getopts: arguments changed since last call
ash14 OPTIND after multiple getopts with different spec

stdout:
.
OPTIND=2
-
-
-
OPTIND=5
_
OPTIND=2
stderr:
No arg for -f option
osh14 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=5
stderr:
bash15 OPTIND narrowed down

stdout:
a=1 b= c= d=1 e=E
stderr:
mksh15 OPTIND narrowed down

stdout:
a=1 b= c= d=1 e=E
stderr:
osh15 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=E
stderr:
dash18 two flags: -ab

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=2 opt=b OPTARG=
stderr:
mksh18 two flags: -ab

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=2 opt=b OPTARG=
stderr:
ash18 two flags: -ab

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=2 opt=b OPTARG=
stderr:
dash19 flag and arg: -c10

stdout:
OPTIND=2 opt=c OPTARG=10
OPTIND=2 opt=? OPTARG=10
stderr:
dash20 More Smooshing 1

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=3 opt=b OPTARG=hi
OPTIND=5 opt=c OPTARG=hello
stderr:
mksh20 More Smooshing 1

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=3 opt=b OPTARG=hi
OPTIND=5 opt=c OPTARG=hello
stderr:
ash20 More Smooshing 1

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=3 opt=b OPTARG=hi
OPTIND=5 opt=c OPTARG=hello
stderr:
dash21 More Smooshing 2

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=2 opt=b OPTARG=
OPTIND=2 opt=c OPTARG=10
stderr:
mksh21 More Smooshing 2

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=2 opt=b OPTARG=
OPTIND=2 opt=c OPTARG=10
stderr:
ash21 More Smooshing 2

stdout:
OPTIND=2 opt=a OPTARG=
OPTIND=2 opt=b OPTARG=
OPTIND=2 opt=c OPTARG=10
stderr:
dash22 OPTIND should be >= 1 (regression)

stdout:
stderr: 
dash: 1: Illegal number: -1