Results for builtin-getopts.test.sh

statusdashbashmkshashoshosh_ALT
pass 182217202121
ok 414300
BUG 213133
total242424242424
casedashbashmkshashoshosh_ALTdescription
0pass pass pass pass pass pass getopts empty
1pass pass pass pass pass pass getopts sees unknown arg
2pass pass pass pass pass pass getopts three invocations
3pass pass pass pass pass pass getopts resets OPTARG
4pass pass pass pass pass pass Basic getopts invocation
5pass ok ok pass pass pass getopts with invalid variable name
detailsdetails
6pass pass pass pass pass pass getopts with invalid flag
7pass pass pass pass pass pass getopts with with -
8pass pass pass pass pass pass getopts missing required argument
9pass pass pass pass pass pass getopts doesn't look for flags after args
10pass pass pass pass pass pass getopts with explicit args
11pass pass pass pass pass pass OPTIND
12pass pass BUG pass BUG BUG OPTIND after multiple getopts with same spec
detailsdetailsdetails
13BUG pass BUG BUG BUG BUG OPTIND after multiple getopts with different spec
detailsdetailsdetailsdetailsdetails
14pass BUG BUG pass BUG BUG OPTIND narrowed down
detailsdetailsdetailsdetails
15pass pass pass pass pass pass Getopts parses the function's arguments
16pass pass pass pass pass pass Local OPTIND
17ok pass ok ok pass pass two flags: -ab
detailsdetailsdetails
18BUG pass pass pass pass pass flag and arg: -c10
details
19ok pass ok ok pass pass More Smooshing 1
detailsdetailsdetails
20ok pass ok ok pass pass More Smooshing 2
detailsdetailsdetails
21ok pass pass pass pass pass OPTIND should be >= 1 (regression)
details
22pass pass pass pass pass pass getopts bug #1523
23pass pass pass pass pass pass More regression for #1523
119 passed, 12 OK, 0 not implemented, 13 BUG, 0 failed, 0 timeouts, 0 cases skipped

Details on runs that didn't PASS

bash5 getopts with invalid variable name

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

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

stdout:
1
-
-
4
4
stderr:
mksh: <stdin>[15]: getopts: arguments changed since last call
osh12 OPTIND after multiple getopts with same spec

stdout:
1
-
-
4
4
stderr:
osh_ALT12 OPTIND after multiple getopts with same spec

stdout:
1
-
-
4
4
stderr:
dash13 OPTIND after multiple getopts with different spec

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

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

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

stdout:
.
2
-
-
5
5
stderr:
osh_ALT13 OPTIND after multiple getopts with different spec

stdout:
.
2
-
-
5
5
stderr:
bash14 OPTIND narrowed down

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

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

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

stdout:
a=1 b= c= d=1 e=E
stderr:
dash17 two flags: -ab

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

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

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

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

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

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

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

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

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

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

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