Results for sh-options.test.sh

statusoshosh_.pyosh_.cc
pass 382618
ok 222
N-I 221
FAIL 21423
total444444
caseoshosh_.pyosh_.ccdescription
0pass FAIL FAIL $- with -c
detailsdetails
1pass pass pass $- with pipefail
2pass pass pass $- and more options
3pass FAIL FAIL $- with interactive shell
detailsdetails
4pass FAIL FAIL pass short options like sh -e
detailsdetails
5pass FAIL FAIL pass long options like sh -o errexit
detailsdetails
6pass FAIL FAIL pass shopt options like sh -O nullglob
detailsdetails
7pass pass pass can continue after unknown option
8pass pass pass set with both options and argv
9pass pass pass set -o vi/emacs
10pass FAIL FAIL vi and emacs are mutually exclusive
detailsdetails
11pass FAIL FAIL interactive shell starts with emacs mode on
detailsdetails
12pass pass pass nounset
13pass pass pass -u is nounset
14pass pass pass nounset with "$@"
15pass pass pass set -u -- clears argv
16pass pass pass set -u -- x y z
17pass pass pass reset option with long flag
18pass pass pass reset option with short flag
19pass pass pass set -eu (flag parsing)
20FAIL FAIL FAIL -n for no execution (useful with --ast-output)
detailsdetailsdetails
21pass pass FAIL pipefail
details
22pass pass pass shopt -p -o prints 'set' options
23pass pass FAIL shopt -p prints 'shopt' options
details
24pass FAIL FAIL shopt with no flags prints options
detailsdetails
25pass FAIL FAIL noclobber off
detailsdetails
26FAIL FAIL FAIL noclobber on
detailsdetailsdetails
27pass pass FAIL SHELLOPTS is updated when options are changed
details
28ok ok ok SHELLOPTS is readonly
detailsdetailsdetails
29ok ok ok set - -
detailsdetailsdetails
30pass pass FAIL set -o lists options
details
31pass pass FAIL set without args lists variables
details
32pass FAIL FAIL 'set' and 'eval' round trip
detailsdetails
33N-I N-I FAIL set without args and array variables (not in OSH)
detailsdetailsdetails
34N-I N-I N-I set without args and assoc array variables (not in OSH)
detailsdetailsdetails
35pass pass pass shopt -q
36pass pass pass shopt -q invalid
37pass FAIL FAIL shopt -s strict:all
detailsdetails
38pass pass FAIL shopt allows for backward compatibility like bash
details
39pass FAIL FAIL shopt -p validates option names
detailsdetails
40pass pass pass shopt -p -o validates option names
41pass pass pass stubbed out bash options
42pass pass FAIL shopt -s nounset works in Oil, not in bash
details
43pass pass FAIL no-ops not in shopt -p output
details
82 passed, 6 OK, 5 not implemented, 0 BUG, 39 failed, 0 timeouts, 0 cases skipped
2 failed under osh

Details on runs that didn't PASS

osh_.py0 $- with -c

[osh_.py stdout] Expected 'u\n', got ''
[osh_.py status] Expected 0, got 127

stdout:
stderr: 
  $SH -o nounset -c 'echo $-'
      ^~
[ stdin ]:1: '-o' not found
osh_.cc0 $- with -c

[osh_.cc stdout] Expected 'u\n', got ''
[osh_.cc status] Expected 0, got 127

stdout:
stderr: 
  $SH -o nounset -c 'echo $-'
      ^~
[ stdin ]:1: '-o' not found
osh_.py3 $- with interactive shell

[osh_.py stdout] Expected 'FALSE\nTRUE\n', got 'FALSE\n'
[osh_.py status] Expected 0, got 1

stdout:
FALSE
stderr:
  $SH -c 'echo $-' | grep i || echo FALSE
      ^~
[ stdin ]:1: '-c' not found
  $SH -i -c 'echo $-' | grep -q i && echo TRUE
      ^~
[ stdin ]:2: '-i' not found
osh_.cc3 $- with interactive shell

[osh_.cc stdout] Expected 'FALSE\nTRUE\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.py4 pass short options like sh -e

[osh_.py status] Expected 1, got 127

stdout:
stderr: 
  $SH -e -c 'false; echo status=$?'
      ^~
[ stdin ]:1: '-e' not found
osh_.cc4 pass short options like sh -e

[osh_.cc status] Expected 1, got 127

stdout:
stderr: 
  $SH -e -c 'false; echo status=$?'
      ^~
[ stdin ]:1: '-e' not found
osh_.py5 pass long options like sh -o errexit

[osh_.py status] Expected 1, got 127

stdout:
stderr: 
  $SH -o errexit -c 'false; echo status=$?'
      ^~
[ stdin ]:1: '-o' not found
osh_.cc5 pass long options like sh -o errexit

[osh_.cc status] Expected 1, got 127

stdout:
stderr: 
  $SH -o errexit -c 'false; echo status=$?'
      ^~
[ stdin ]:1: '-o' not found
osh_.py6 pass shopt options like sh -O nullglob

[osh_.py stdout] Expected 'foo *.nonexistent bar\nfoo bar\n', got ''
[osh_.py status] Expected 0, got 127

stdout:
stderr: 
  $SH +O nullglob -c 'echo foo *.nonexistent bar'
      ^
[ stdin ]:1: '+O' not found
  $SH -O nullglob -c 'echo foo *.nonexistent bar'
      ^~
[ stdin ]:2: '-O' not found
osh_.cc6 pass shopt options like sh -O nullglob

[osh_.cc stdout] Expected 'foo *.nonexistent bar\nfoo bar\n', got ''
[osh_.cc status] Expected 0, got 127

stdout:
stderr: 
  $SH +O nullglob -c 'echo foo *.nonexistent bar'
      ^
[ stdin ]:1: '+O' not found
  $SH -O nullglob -c 'echo foo *.nonexistent bar'
      ^~
[ stdin ]:2: '-O' not found
osh_.py10 vi and emacs are mutually exclusive

[osh_.py stdout] Expected 'set +o emacs\nset +o vi\n___\nset -o emacs\nset +o vi\n___\nset +o emacs\nset -o vi\n___\n', got 'set +o emacs\nset +o vi\n___\nset -o emacs\nset +o vi\n___\nset -o emacs\nset -o vi\n___\n'

stdout:
set +o emacs
set +o vi
___
set -o emacs
set +o vi
___
set -o emacs
set -o vi
___
stderr:
osh_.cc10 vi and emacs are mutually exclusive

[osh_.cc stdout] Expected 'set +o emacs\nset +o vi\n___\nset -o emacs\nset +o vi\n___\nset +o emacs\nset -o vi\n___\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.py11 interactive shell starts with emacs mode on

[osh_.py stdout] Expected 'non-interactive\n1\n1\ninteractive\n0\n1\n', got 'non-interactive\ninteractive\n'
[osh_.py status] Expected 0, got 127

stdout:
non-interactive
interactive
stderr:
  $SH $flag -c "$code"
            ^~
[ stdin ]:5: '-c' not found
  $SH $flag -i -c "$code"
            ^~
[ stdin ]:7: '-i' not found
osh_.cc11 interactive shell starts with emacs mode on

[osh_.cc stdout] Expected 'non-interactive\n1\n1\ninteractive\n0\n1\n', got 'non-interactive\ninteractive\n'
[osh_.cc status] Expected 0, got 127

stdout:
non-interactive
interactive
stderr:
  $SH $flag -c "$code"
            ^~
[ stdin ]:5: '-c' not found
  $SH $flag -i -c "$code"
            ^~
[ stdin ]:7: '-i' not found
osh20 -n for no execution (useful with --ast-output)

[osh stdout] Expected '1\n', got '1\n2\n3\n'

stdout:
1
2
3
stderr:
osh_.py20 -n for no execution (useful with --ast-output)

[osh_.py stdout] Expected '1\n', got '1\n2\n3\n'

stdout:
1
2
3
stderr:
osh_.cc20 -n for no execution (useful with --ast-output)

[osh_.cc stdout] Expected '1\n', got '1\n2\n3\n'

stdout:
1
2
3
stderr:
osh_.cc21 pipefail

[osh_.cc stdout] Expected '0\n2\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.cc23 shopt -p prints 'shopt' options

[osh_.cc stdout] Expected 'shopt -u nullglob\nshopt -s nullglob\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: _build/cpp/consts.cc:859: Str *consts::OptionName(option_asdl::option_t): Assertion `0' failed.
osh_.py24 shopt with no flags prints options

[osh_.py stdout] Expected '2 one.txt\nnullglob\nfailglob\n1\n', got 'nullglob\nfailglob\n'
[osh_.py status] Expected 0, got 127

stdout:
nullglob
failglob
stderr:
  cd $TMP
  ^~
[ stdin ]:1: $HOME isn't defined
  wc -l one.txt
  ^~
[ stdin ]:3: 'wc' not found
  shopt | grep nullglob | wc -l
                          ^~
[ stdin ]:6: 'wc' not found
osh_.cc24 shopt with no flags prints options

[osh_.cc stdout] Expected '2 one.txt\nnullglob\nfailglob\n1\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
  cd $TMP
  ^~
[ stdin ]:1: $HOME isn't defined
osh_eval.dbg: cpp/posix.h:143: void posix::dup2(int, int): Assertion `0' failed.
osh_.py25 noclobber off

[osh_.py stdout] Expected 'foo\n', got ''
[osh_.py status] Expected 0, got 1

stdout:
stderr: 
  echo foo > $TMP/can-clobber
           ^
[ stdin ]:2: Can't open '/can-clobber': Permission denied
  echo foo > $TMP/can-clobber
  ^~~~
[ stdin ]:2: fatal: Exiting with status 1 (command in PID 24864)
osh_.cc25 noclobber off

[osh_.cc stdout] Expected 'foo\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:143: void posix::dup2(int, int): Assertion `0' failed.
osh26 noclobber on

[osh stdout] Expected u'0\n1\n', got '0\n0\n'

stdout:
0
0
stderr:
osh_.py26 noclobber on

[osh_.py stdout] Expected u'0\n1\n', got '1\n1\n'

stdout:
1
1
stderr:
rm: cannot remove '/no-clobber': No such file or directory
  echo foo > $TMP/no-clobber
           ^
[ stdin ]:3: Can't open '/no-clobber': Permission denied
  echo foo > $TMP/no-clobber
           ^
[ stdin ]:5: Can't open '/no-clobber': Permission denied
osh_.cc26 noclobber on

[osh_.cc stdout] Expected u'0\n1\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
rm: cannot remove '/no-clobber': No such file or directory
osh_eval.dbg: cpp/posix.h:143: void posix::dup2(int, int): Assertion `0' failed.
osh_.cc27 SHELLOPTS is updated when options are changed

[osh_.cc stdout] Expected u'1\n0\n1\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh28 SHELLOPTS is readonly

stdout:
stderr: 
  SHELLOPTS=x
  ^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
osh_.py28 SHELLOPTS is readonly

stdout:
stderr: 
  SHELLOPTS=x
  ^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
osh_.cc28 SHELLOPTS is readonly

stdout:
stderr: 
  SHELLOPTS=x
  ^~~~~~~~~~
[ stdin ]:1: fatal: Can't assign to readonly value 'SHELLOPTS'
osh29 set - -

stdout:
a b
- a b
a b
- -
- +
+ -
--
stderr:
osh_.py29 set - -

stdout:
a b
- a b
a b
- -
- +
+ -
--
stderr:
osh_.cc29 set - -

stdout:
a b
- a b
a b
- -
- +
+ -
--
stderr:
osh_.cc30 set -o lists options

[osh_.cc stdout] Expected 'noexec\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.cc31 set without args lists variables

[osh_.cc stdout] Expected '__GLOBAL=mutated\n__OTHERLOCAL=L\n__mylocal=L\n__var_in_parent_scope=D\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.py32 'set' and 'eval' round trip

[osh_.py stdout] Expected '[ ]\nOK\nOK\nOK\nOK\nOK\n', got '[ ]\n'
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
[ ]
stderr:
  varfile=$TMP/vars-$(basename $SH).txt
                      ^~~~~~~~
[ stdin ]:6: 'basename' not found
  set | grep '^_' > "$varfile"
                  ^
[ stdin ]:7: Can't open '/vars-.txt': Permission denied
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 74, in <module>
    sys.exit(main(sys.argv))
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 42, in main
    None)
  File "/home/andy/git/oilshell/oil/core/shell_native.py", line 474, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 324, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1490, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1337, in _Execute
    status, check_errexit = self._Dispatch(node, pipeline_st)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 623, in _Dispatch
    status = self._RunSimpleCommand(cmd_val, node.do_fork)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 477, in _RunSimpleCommand
    return self.shell_ex.RunSimpleCommand(cmd_val, do_fork)
  File "/home/andy/git/oilshell/oil/core/executor.py", line 193, in RunSimpleCommand
    status = self.RunBuiltin(builtin_id, cmd_val)
  File "/home/andy/git/oilshell/oil/core/executor.py", line 121, in RunBuiltin
    builtin_func = self.builtins[builtin_id]
KeyError: 2
osh_.cc32 'set' and 'eval' round trip

[osh_.cc stdout] Expected '[ ]\nOK\nOK\nOK\nOK\nOK\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh33 set without args and array variables (not in OSH)

stdout:
stderr: 
osh_.py33 set without args and array variables (not in OSH)

stdout:
stderr: 
osh_.cc33 set without args and array variables (not in OSH)

[osh_.cc status] Expected 1, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh34 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
  __assoc[a]=b
  ^~~~~~~~
[ stdin ]:3: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
osh_.py34 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
  __assoc[a]=b
  ^~~~~~~~
[ stdin ]:3: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
osh_.cc34 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
  __assoc[a]=b
  ^~~~~~~~
[ stdin ]:3: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
osh_.py37 shopt -s strict:all

[osh_.py stdout] Expected 'shopt -u strict_argv\nshopt -u strict_arith\n-\nshopt -s strict_argv\nshopt -s strict_arith\n-\nshopt -s strict_argv\nshopt -u strict_arith\n-\n', got '-\n'
[osh_.py status] Expected 0, got 127

stdout:
-
stderr:
    shopt -p | grep 'strict_' | head -n $n
                                ^~~~
[ stdin ]:3: 'head' not found
    shopt -p | grep 'strict_' | head -n $n
                                ^~~~
[ stdin ]:3: 'head' not found
    shopt -p | grep 'strict_' | head -n $n
                                ^~~~
[ stdin ]:3: fatal: Exiting with status 127 (command in PID 26719)
    shopt -p | grep 'strict_' | head -n $n
                                ^~~~
[ stdin ]:3: fatal: Exiting with status 127 (pipeline invoked from PID 26719)
osh_.cc37 shopt -s strict:all

[osh_.cc stdout] Expected 'shopt -u strict_argv\nshopt -u strict_arith\n-\nshopt -s strict_argv\nshopt -s strict_arith\n-\nshopt -s strict_argv\nshopt -u strict_arith\n-\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.cc38 shopt allows for backward compatibility like bash

[osh_.cc stdout] Expected 'shopt -u nullglob\nstatus=0\nshopt -s nullglob\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: _build/cpp/consts.cc:859: Str *consts::OptionName(option_asdl::option_t): Assertion `0' failed.
osh_.py39 shopt -p validates option names

[osh_.py stdout] Expected 'status=2\nstatus=2\n', got 'status=2\nstatus=1\n'

stdout:
status=2
status=1
stderr:
  shopt -p nullglob invalid failglob
  ^~~~~
[ stdin ]:1: 'shopt' got invalid option 'invalid'
  shopt nullglob invalid failglob > $TMP/out.txt
                                  ^
[ stdin ]:3: Can't open '/out.txt': Permission denied
sed: can't read /out.txt: No such file or directory
osh_.cc39 shopt -p validates option names

[osh_.cc stdout] Expected 'status=2\nstatus=2\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
  shopt -p nullglob invalid failglob
  ^~~~~
[ stdin ]:1: 'shopt' got invalid option 'invalid'
osh_eval.dbg: cpp/posix.h:143: void posix::dup2(int, int): Assertion `0' failed.
osh_.cc42 shopt -s nounset works in Oil, not in bash

[osh_.cc stdout] Expected 'status=0\nset -o nounset\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.
osh_.cc43 no-ops not in shopt -p output

[osh_.cc stdout] Expected '--\n', got ''
[osh_.cc status] Expected 0, got -6

stdout:
stderr: 
osh_eval.dbg: cpp/posix.h:106: Tuple2<int, int> posix::pipe(): Assertion `0' failed.