Results for sh-options.test.sh

statusoshosh_.pyosh_.cc
pass 382415
ok 111
N-I 211
FAIL 21726
total434343
caseoshosh_.pyosh_.ccdescription
0pass FAIL FAIL $- with -c
detailsdetails
1pass pass FAIL $- with pipefail
details
2pass pass pass $- and more options
3pass FAIL FAIL $- with interactive shell
detailsdetails
4pass pass FAIL pass short options like sh -e
details
5pass pass FAIL pass long options like sh -o errexit
details
6pass FAIL FAIL pass shopt options like sh -O nullglob
detailsdetails
7pass pass pass can continue after unknown option
8pass pass FAIL set with both options and argv
details
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 FAIL -u is nounset
details
14pass pass FAIL nounset with "$@"
details
15pass pass pass set -u -- clears argv
16pass pass FAIL set -u -- x y z
details
17pass pass pass reset option with long flag
18pass pass pass reset option with short flag
19pass pass FAIL set -eu (flag parsing)
details
20FAIL FAIL FAIL -n for no execution (useful with --ast-output)
detailsdetailsdetails
21pass FAIL FAIL pipefail
detailsdetails
22pass pass pass shopt -p -o prints 'set' options
23pass pass pass shopt -p prints 'shopt' options
24pass FAIL FAIL shopt with no flags prints options
detailsdetails
25pass FAIL FAIL noclobber off
detailsdetails
26FAIL FAIL FAIL noclobber on
detailsdetailsdetails
27pass FAIL FAIL SHELLOPTS is updated when options are changed
detailsdetails
28ok ok ok SHELLOPTS is readonly
detailsdetailsdetails
29pass FAIL FAIL set -o lists options
detailsdetails
30pass FAIL FAIL set without args lists variables
detailsdetails
31pass FAIL FAIL 'set' and 'eval' round trip
detailsdetails
32N-I FAIL FAIL set without args and array variables (not in OSH)
detailsdetailsdetails
33N-I N-I N-I set without args and assoc array variables (not in OSH)
detailsdetailsdetails
34pass pass pass shopt -q
35pass pass pass shopt -q invalid
36pass FAIL FAIL shopt -s strict:all
detailsdetails
37pass pass pass shopt allows for backward compatibility like bash
38pass pass FAIL shopt -p validates option names
details
39pass pass pass shopt -p -o validates option names
40pass pass pass stubbed out bash options
41pass FAIL FAIL shopt -s nounset doesn't work (may relax this later)
detailsdetails
42pass pass pass no-ops not in shopt -p output
77 passed, 3 OK, 4 not implemented, 0 BUG, 45 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 1

stdout:
stderr: 
Error running ['-o', 'nounset', '-c', 'echo $-']: [Errno 2] No such file or directory
osh_.cc0 $- with -c

[osh_.cc stdout] Expected 'u\n', got "(cmd_value.Argv argv:[-o nounset -c 'echo $-'] arg_spids:[2 4 6 8])\n"

stdout:
(cmd_value.Argv argv:[-o nounset -c 'echo $-'] arg_spids:[2 4 6 8])
stderr:
Unhandled SimpleCommand
osh_.cc1 $- with pipefail

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

stdout:
stderr: 
set 5
osh_.py3 $- with interactive shell

[osh_.py stdout] Expected 'FALSE\nTRUE\n', got 'TRUE\n'

stdout:
TRUE
stderr:
osh_.cc3 $- with interactive shell

[osh_.cc stdout] Expected 'FALSE\nTRUE\n', got 'TRUE\n'

stdout:
TRUE
stderr:
osh_.cc4 pass short options like sh -e

[osh_.cc stdout] Expected u'', got "(cmd_value.Argv argv:[-e -c 'false; echo status=$?'] arg_spids:[2 4 6])\n"
[osh_.cc status] Expected 1, got 0

stdout:
(cmd_value.Argv argv:[-e -c 'false; echo status=$?'] arg_spids:[2 4 6])
stderr:
Unhandled SimpleCommand
osh_.cc5 pass long options like sh -o errexit

[osh_.cc stdout] Expected u'', got "(cmd_value.Argv argv:[-o errexit -c 'false; echo status=$?'] arg_spids:[2 4 6 8])\n"
[osh_.cc status] Expected 1, got 0

stdout:
(cmd_value.Argv argv:[-o errexit -c 'false; echo status=$?'] arg_spids:[2 4 6 8])
stderr:
Unhandled SimpleCommand
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 1

stdout:
stderr: 
Error running ['+O', 'nullglob', '-c', 'echo foo *.nonexistent bar']: [Errno 2] No such file or directory
Error running ['-O', 'nullglob', '-c', 'echo foo *.nonexistent bar']: [Errno 2] No such file or directory
osh_.cc6 pass shopt options like sh -O nullglob

[osh_.cc stdout] Expected 'foo *.nonexistent bar\nfoo bar\n', got "(cmd_value.Argv argv:['+O' nullglob -c 'echo foo *.nonexistent bar'] arg_spids:[2 5 7 9])\n(cmd_value.Argv argv:[-O nullglob -c 'echo foo *.nonexistent bar'] arg_spids:[15 17 19 21])\n"

stdout:
(cmd_value.Argv argv:['+O' nullglob -c 'echo foo *.nonexistent bar'] arg_spids:[2 5 7 9])
(cmd_value.Argv argv:[-O nullglob -c 'echo foo *.nonexistent bar'] arg_spids:[15 17 19 21])
stderr:
Unhandled SimpleCommand
Unhandled SimpleCommand
osh_.cc8 set with both options and argv

[osh_.cc stdout] Expected 'a b c\n', got '\ndone\n'
[osh_.cc status] Expected 1, got 0

stdout:
done
stderr:
set 6
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 '___\n___\n___\n'

stdout:
___
___
___
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 '___\n___\n___\n'

stdout:
___
___
___
stderr:
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 1

stdout:
non-interactive
interactive
stderr:
Error running ['-c', 'test -o emacs; echo $?; test -o vi; echo $?']: [Errno 2] No such file or directory
Error running ['-i', '-c', 'test -o emacs; echo $?; test -o vi; echo $?']: [Errno 2] No such file or directory
osh_.cc11 interactive shell starts with emacs mode on

[osh_.cc stdout] Expected 'non-interactive\n1\n1\ninteractive\n0\n1\n', got "non-interactive\n(cmd_value.Argv argv:[-c 'test -o emacs; echo $?; test -o vi; echo $?'] arg_spids:[51 53])\ninteractive\n(cmd_value.Argv argv:[-i -c 'test -o emacs; echo $?; test -o vi; echo $?'] arg_spids:[65 67 69])\n"

stdout:
non-interactive
(cmd_value.Argv argv:[-c 'test -o emacs; echo $?; test -o vi; echo $?'] arg_spids:[51 53])
interactive
(cmd_value.Argv argv:[-i -c 'test -o emacs; echo $?; test -o vi; echo $?'] arg_spids:[65 67 69])
stderr:
Unhandled SimpleCommand
Unhandled SimpleCommand
osh_.cc13 -u is nounset

[osh_.cc stdout] Expected '[]\n', got '[]\n[]\nend\n'
[osh_.cc status] Expected 1, got 0

stdout:
[]
[]
end
stderr:
set 2
osh_.cc14 nounset with "$@"

[osh_.cc stdout] Expected 'a b c\n', got '\n'

stdout:
stderr: 
set 4
set 2
osh_.cc16 set -u -- x y z

[osh_.cc stdout] Expected 'x y z\n', got '\n'

stdout:
stderr: 
set 4
set 6
osh_.cc19 set -eu (flag parsing)

[osh_.cc stdout] Expected u'', got '[]\nstatus=0\n'
[osh_.cc status] Expected 1, got 0

stdout:
[]
status=0
stderr:
set 2
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:
set 2
set 2
osh_.py21 pipefail

[osh_.py stdout] Expected '0\n2\n', got '0\n0\n'

stdout:
0
0
stderr:
osh_.cc21 pipefail

[osh_.cc stdout] Expected '0\n2\n', got '0\n0\n'

stdout:
0
0
stderr:
osh_.py24 shopt with no flags prints options

[osh_.py stdout] Expected '2 one.txt\nnullglob\nfailglob\n1\n', got '2 one.txt\nnullglob\nfailglob\nshopt -u nullglob\nshopt -u failglob\n'

stdout:
2 one.txt
nullglob
failglob
shopt -u nullglob
shopt -u failglob
stderr:
[??? no location ???] $HOME isn't defined
osh_.cc24 shopt with no flags prints options

[osh_.cc stdout] Expected '2 one.txt\nnullglob\nfailglob\n1\n', got 'shopt -u nullglob\nshopt -u failglob\n(cmd_value.Argv argv:[wc -l one.txt] arg_spids:[14 16 18])\n(cmd_value.Argv argv:[grep -o nullglob one.txt] arg_spids:[20 22 24 26])\n(cmd_value.Argv argv:[grep -o failglob one.txt] arg_spids:[28 30 32 34])\n'

stdout:
shopt -u nullglob
shopt -u failglob
(cmd_value.Argv argv:[wc -l one.txt] arg_spids:[14 16 18])
(cmd_value.Argv argv:[grep -o nullglob one.txt] arg_spids:[20 22 24 26])
(cmd_value.Argv argv:[grep -o failglob one.txt] arg_spids:[28 30 32 34])
stderr:
[??? no location ???] $HOME isn't defined
Unhandled SimpleCommand
Unhandled SimpleCommand
Unhandled SimpleCommand
osh_.py25 noclobber off

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

stdout:
foo
foo
foo
stderr:
cat: /can-clobber: No such file or directory
  cat $TMP/can-clobber
  ^~~
[ stdin ]:7: fatal: Exiting with status 1 (command in PID 525)
osh_.cc25 noclobber off

[osh_.cc status] Expected 0, got 1

stdout:
foo
stderr:
set 2
  set +C
  ^~~
[ stdin ]:3: fatal: Exiting with status 1 (command in PID 550)
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 'foo\n0\nfoo\n0\n'

stdout:
foo
0
foo
0
stderr:
rm: cannot remove '/no-clobber': No such file or directory
osh_.cc26 noclobber on

[osh_.cc stdout] Expected u'0\n1\n', got "(cmd_value.Argv argv:[rm '/no-clobber'] arg_spids:[0 2])\nfoo\n0\nfoo\n0\n"

stdout:
(cmd_value.Argv argv:[rm '/no-clobber'] arg_spids:[0 2])
foo
0
foo
0
stderr:
Unhandled SimpleCommand
set 2
osh_.py27 SHELLOPTS is updated when options are changed

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

stdout:
0
0
0
stderr:
+ echo 0
+ set '+x'
osh_.cc27 SHELLOPTS is updated when options are changed

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

stdout:
0
0
0
stderr:
set 2
set 2
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'
osh_.py29 set -o lists options

[osh_.py stdout] Expected 'noexec\n', got ''

stdout:
stderr: 
osh_.cc29 set -o lists options

[osh_.cc stdout] Expected 'noexec\n', got ''

stdout:
stderr: 
osh_.py30 set without args lists variables

[osh_.py stdout] Expected '__GLOBAL=mutated\n__OTHERLOCAL=L\n__mylocal=L\n__var_in_parent_scope=D\n', got ''

stdout:
stderr: 
osh_.cc30 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 ''

stdout:
stderr: 
osh_.py31 'set' and 'eval' round trip

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

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, 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 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 837, in _Dispatch
    val = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1602, in EvalRhsWord
    return self.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1498, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1332, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1959, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc31 '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: mycpp/mylib.h:491: void List<int>::reverse() [T = int]: Assertion `0' failed.
osh32 set without args and array variables (not in OSH)

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

[osh_.py status] Expected 1, got 0

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

[osh_.cc status] Expected 1, got 0

stdout:
stderr: 
osh33 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_.py33 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_.cc33 set without args and assoc array variables (not in OSH)

stdout:
stderr: 
  __assoc['k e y']='v a l'
          ^
[ array LValue in TODO ]:2: fatal: Associative array keys must be strings: $x 'x' "$x" etc.
osh_.py36 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-\n-\n'

stdout:
-
-
-
stderr:
osh_.cc36 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 '-\n-\n-\n'

stdout:
-
-
-
stderr:
osh_.cc38 shopt -p validates option names

[osh_.cc stdout] Expected 'shopt -u nullglob\nstatus=2\nshopt -u nullglob\nstatus=2\n', got "shopt -u nullglob\nstatus=2\nshopt -u nullglob\n(cmd_value.Argv argv:[sed --regexp-extended 's/\\\\s+/ /' '/out.txt'] arg_spids:[31 33 35 39])\nstatus=2\n"

stdout:
shopt -u nullglob
status=2
shopt -u nullglob
(cmd_value.Argv argv:[sed --regexp-extended 's/\\s+/ /' '/out.txt'] arg_spids:[31 33 35 39])
status=2
stderr:
Unhandled SimpleCommand
osh_.py41 shopt -s nounset doesn't work (may relax this later)

[osh_.py stdout] Expected 'status=2\nset +o nounset\n', got 'status=2\n'

stdout:
status=2
stderr:
osh_.cc41 shopt -s nounset doesn't work (may relax this later)

[osh_.cc stdout] Expected 'status=2\nset +o nounset\n', got 'status=2\n'

stdout:
status=2
stderr: