Results for ysh-purity.test.sh

statusosh
pass 6
FAIL 11
total17
caseoshdescription
0pass eval() is a pure function
1FAIL evalExpr() is a pure function
details
2FAIL Idiom to handle purity errors from untrusted config files
details
3pass Executor: can run user-defined Procs
4pass Executor: can run Hay (while Hay is hard-coded)
5pass Executor: External Commands not allowed
6FAIL Command subs, pipelines not allowed with --eval-pure
details
7pass Process subs, subshells not allowed with eval()
8pass Background job &
9FAIL Are any builtins allowed? true, false
details
10FAIL Are source or use builtins allowed?
details
11FAIL Can log to stderr in pure mode
details
12FAIL io and vm are not allowed
details
13FAIL Can't make an alias of io->eval and call it, etc.
details
14FAIL Globbing not allowed
details
15FAIL $RANDOM $SECONDS
details
16FAIL Purely-evaluated code can't set traps for later
details
6 passed, 0 OK, 0 not implemented, 0 BUG, 11 failed, 0 timeouts, 0 cases skipped
11 failed under osh

Details on runs that didn't PASS

osh1 evalExpr() is a pure function

[osh stdout] Expected 'pure=43\nimpure code=5\nimpure=45\n', got 'pure=43\nimpure code=5\n'
[osh status] Expected 0, got 1
[osh stderr] Found 'Traceback (most recent'

stdout:
pure=43
impure code=5
stderr:
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 1253, in Main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/uke/oil/core/main_loop.py", line 336, in Batch
    was_parsed, status = Batch2(cmd_ev, c_parser, errfmt, cmd_flags=cmd_flags)
  File "/home/uke/oil/core/main_loop.py", line 401, in Batch2
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2175, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1974, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1701, in _Dispatch
    status = self._DoSimple(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 904, in _DoSimple
    allow_assign=True)
  File "/home/uke/oil/osh/word_eval.py", line 2494, in EvalWordSequence2
    allow_assign)
  File "/home/uke/oil/osh/word_eval.py", line 2455, in SimpleEvalWordSequence2
    self._EvalWordToParts(w, part_vals, 0)  # not quoted
  File "/home/uke/oil/osh/word_eval.py", line 1989, in _EvalWordToParts
    self._EvalWordPart(p, word_part_vals, eval_flags)
  File "/home/uke/oil/osh/word_eval.py", line 1941, in _EvalWordPart
    part_val = self.expr_ev.EvalExprSub(part)
  File "/home/uke/oil/ysh/expr_eval.py", line 410, in EvalExprSub
    val = self.EvalExpr(part.child, part.left)
  File "/home/uke/oil/ysh/expr_eval.py", line 397, in EvalExpr
    val = self._EvalExpr(node)
  File "/home/uke/oil/ysh/expr_eval.py", line 1370, in _EvalExpr
    return self._EvalFuncCall(node)
  File "/home/uke/oil/ysh/expr_eval.py", line 907, in _EvalFuncCall
    return self._CallFunc(to_call, rd)
  File "/home/uke/oil/ysh/expr_eval.py", line 871, in _CallFunc
    return f.Call(rd)
  File "/home/uke/oil/builtin/method_io.py", line 86, in Call
    result = self.expr_ev.EvalExpr(lazy.e, blame_tok)
  File "/home/uke/oil/ysh/expr_eval.py", line 397, in EvalExpr
    val = self._EvalExpr(node)
  File "/home/uke/oil/ysh/expr_eval.py", line 1262, in _EvalExpr
    return self._EvalBinary(node)
  File "/home/uke/oil/ysh/expr_eval.py", line 681, in _EvalBinary
    right = self._EvalExpr(node.right)
  File "/home/uke/oil/ysh/expr_eval.py", line 1201, in _EvalExpr
    stdout_str = self.shell_ex.RunCommandSub(node)
  File "/home/uke/oil/core/executor.py", line 691, in RunCommandSub
    status, stdout_str, stderr_str = self.CaptureStdout(node)
  File "/home/uke/oil/core/executor.py", line 619, in CaptureStdout
    fds, w, exc = select.select([r,r2], [], [r,r2], -1)
NameError: global name 'select' is not defined
osh2 Idiom to handle purity errors from untrusted config files

[osh stdout] Expected '', got "TODO: what's the idiom?\n"

stdout:
TODO: what's the idiom?
stderr:
osh6 Command subs, pipelines not allowed with --eval-pure

[osh stdout] Expected 'command sub\ncommand-sub.sh=5\ncommand-sub.ysh=5\n\n3\neval\npipeline.sh=5\n' Got 'command-sub.sh=5\ncommand-sub.ysh=5\n\n3\neval\npipeline.sh=5\n'
[osh stderr] Found 'Traceback (most recent'

stdout:
command-sub.sh=5
command-sub.ysh=5

3
eval
pipeline.sh=5
stderr:
Traceback (most recent call last):
  File "/home/uke/oil/bin/oils_for_unix.py", line 202, in <module>
    sys.exit(main(sys.argv))
  File "/home/uke/oil/bin/oils_for_unix.py", line 171, in main
    return AppBundleMain(argv)
  File "/home/uke/oil/bin/oils_for_unix.py", line 141, in AppBundleMain
    return shell.Main('osh', arg_r, environ, login_shell, loader, readline)
  File "/home/uke/oil/core/shell.py", line 981, in Main
    cmd_ev, lang)
  File "/home/uke/oil/core/main_loop.py", line 480, in EvalFile
    was_parsed, status = Batch2(cmd_ev, c_parser, cmd_ev.errfmt)
  File "/home/uke/oil/core/main_loop.py", line 401, in Batch2
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags)
  File "/home/uke/oil/osh/cmd_eval.py", line 2175, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/uke/oil/osh/cmd_eval.py", line 1974, in _Execute
    status = self._Dispatch(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1711, in _Dispatch
    status = self._DoShAssignment(node, cmd_st)
  File "/home/uke/oil/osh/cmd_eval.py", line 1028, in _DoShAssignment
    rhs = self.word_ev.EvalRhsWord(pair.rhs)
  File "/home/uke/oil/osh/word_eval.py", line 2194, in EvalRhsWord
    return self.EvalWordToString(w)
  File "/home/uke/oil/osh/word_eval.py", line 2103, in EvalWordToString
    self._EvalWordPart(p, part_vals, 0)
  File "/home/uke/oil/osh/word_eval.py", line 1881, in _EvalWordPart
    quoted)  # type: part_value_t
  File "/home/uke/oil/osh/word_eval.py", line 2629, in _EvalCommandSub
    stdout_str = self.shell_ex.RunCommandSub(cs_part)
  File "/home/uke/oil/core/executor.py", line 691, in RunCommandSub
    status, stdout_str, stderr_str = self.CaptureStdout(node)
  File "/home/uke/oil/core/executor.py", line 619, in CaptureStdout
    fds, w, exc = select.select([r,r2], [], [r,r2], -1)
NameError: global name 'select' is not defined
  x=$(echo command sub)
    ^~
command-sub.sh:1: fatal: Command subs aren't allowed in pure mode (OILS-ERR-204)
  var x = $(echo command sub)
          ^~
command-sub.ysh:1: fatal: Command subs aren't allowed in pure mode (OILS-ERR-204)
  seq 3 | wc -l
        ^
pipeline.sh:1: fatal: Pipelines aren't allowed in pure mode (OILS-ERR-204)
osh9 Are any builtins allowed? true, false

[osh status] Expected 0, got 1

stdout:
true
builtin true
command true
stderr:
    builtin false
    ^~~~~~~
[ stdin ]:13: errexit PID 5323: command.Simple failed with status 1
osh10 Are source or use builtins allowed?

[osh status] Expected 0, got 127

stdout:
stderr: 
    source foo.ysh
    ^~~~~~
[ stdin ]:5: Command 'source' not found in pure mode (OILS-ERR-102)
[ stdin ]:5: errexit PID 5326: command.Simple failed with status 127
osh11 Can log to stderr in pure mode

[osh status] Expected 0, got 127

stdout:
stderr: 
    log "hi $name"
    ^~~
[ stdin ]:7: Command 'log' not found (OILS-ERR-100)
[ stdin ]:7: errexit PID 5329: command.Simple failed with status 127
osh12 io and vm are not allowed

[osh stdout] Expected '', got '<Frame 0x7f881ee8aa70>\n(Int) 140222610844272\n<Stdin>\n<Frame 0x7f881ee8ab00>\n(Int) 140222610844416\n<Stdin>\n'

stdout:
<Frame 0x7f881ee8aa70>
(Int)   140222610844272
<Stdin>
<Frame 0x7f881ee8ab00>
(Int)   140222610844416
<Stdin>
stderr:
osh13 Can't make an alias of io->eval and call it, etc.

[osh stdout] Expected '', got 'hi\n'

stdout:
hi
stderr:
osh14 Globbing not allowed

[osh stdout] Expected '', got '*.txt\n'
[osh status] Expected 0, got 127

stdout:
*.txt
stderr:
    echo *.txt
    ^~~~
[ stdin ]:2: Command 'echo' not found in pure mode (OILS-ERR-102)
osh15 $RANDOM $SECONDS

[osh status] Expected 0, got 1

stdout:
stderr: 
    echo not-implemented=$RANDOM
                         ^~~~~~~
[ stdin ]:4: fatal: Undefined variable 'RANDOM'
osh16 Purely-evaluated code can't set traps for later

[osh status] Expected 0, got 127

stdout:
stderr: 
    trap 'echo INT' INT
    ^~~~
[ stdin ]:2: Command 'trap' not found in pure mode (OILS-ERR-102)