(command.CommandList
  children: [
    (C {(KW_Set set)} {(-o)} {(nounset)})
    (C {(KW_Set set)} {(-o)} {(pipefail)})
    (C {(KW_Set set)} {(-o)} {(errexit)})
    (C {(source)} {(test/common.sh)})
    (C {(export)} {(Lit_VarLike 'PYTHONPATH=') (.)})
    (command.ShFunction
      name: unit
      body: (command.BraceGroup children:[(C {(DQ ($ VSub_At '$@'))})])
    )
    (command.ShFunction
      name: delete-pyc
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.Pipeline
                  children: [
                    (C {(find)} {(.)} {(-name)} {(SQ <'*.pyc'>)})
                    (C {(xargs)} {(--no-run-if-empty)} {(--)} {(rm)})
                  ]
                  negated: F
                )
                (C {(true)})
              ]
            )
          ]
        )
    )
    (C {(readonly)} {(Lit_VarLike 'PY_273=') (Lit_TildeLike '~') (/src/languages/Python-2.7.3/python)})
    (C {(readonly)} {(Lit_VarLike 'PY_272=') (Lit_TildeLike '~') (/src/languages/Python-2.7.2/python)})
    (C {(readonly)} {(Lit_VarLike 'PY_27=') (Lit_TildeLike '~') (/src/languages/Python-2.7/python)})
    (command.ShFunction
      name: banner
      body: 
        (command.BraceGroup
          children: [(C {(echo)} {(-----)}) (C {(echo)} {(DQ ($ VSub_At '$@'))}) (C {(echo)} {(----)})]
        )
    )
    (command.ShFunction
      name: tests-to-run
      body: 
        (command.BraceGroup
          children: [
            (command.ForEach
              iter_name: t
              iter_words: [
                (word.BracedTree
                  parts: [
                    (word_part.BracedTuple
                      words: [{(build)} {(test)} {(native)} {(asdl)} {(core)} {(osh)} {(test)} {(tools)}]
                    )
                    (/)
                    (Lit_Star '*')
                    (_test.py)
                  ]
                )
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (command.AndOr
                                  ops: [Op_DAmp]
                                  children: [
                                    (C {(test)} {($ VSub_DollarName '$t')} {(Lit_Equals '=')} 
                                      {(SQ <native/fastlex_test.py>)}
                                    )
                                    (command.Pipeline
                                      children: [(C {(test)} {(-e)} {(SQ <fastlex.so>)})]
                                      negated: T
                                    )
                                  ]
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(command.ControlFlow token:<ControlFlow_Continue continue>)]
                        )
                      ]
                    )
                    (C {(echo)} {($ VSub_DollarName '$t')})
                  ]
                )
            )
          ]
        )
    )
    (command.ShFunction
      name: run-test-and-maybe-abort
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 't=') ($ VSub_Number '$1')})
            (C {(echo)})
            (C {(echo)} {(DQ ('[') ($ VSub_DollarName '$t') (']'))})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{($ VSub_DollarName '$t')}]
                              redirects: [
                                (redir.Redir
                                  op: <Redir_Great '>'>
                                  fd: 16777215
                                  arg_word: {(/dev/null)}
                                )
                              ]
                            )
                          ]
                          negated: T
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)})
                    (C {(echo)} {(DQ ('*** ') ($ VSub_DollarName '$t') (' FAILED ***'))})
                    (C {(echo)})
                    (command.ControlFlow
                      token: <ControlFlow_Return return>
                      arg_word: {(255)}
                    )
                  ]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: all
      body: 
        (command.BraceGroup
          children: [
            (command.TimeBlock
              pipeline: 
                (command.Pipeline
                  children: [
                    (C {(tests-to-run)})
                    (C {(xargs)} {(-n)} {(1)} {(--)} {($ VSub_Number '$0')} {(run-test-and-maybe-abort)})
                  ]
                  negated: F
                )
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('All unit tests passed.'))})
          ]
        )
    )
    (command.ShFunction
      name: all-in-one
      body: 
        (command.BraceGroup
          children: [
            (command.Simple
              words: [
                {(python)}
                {(-m)}
                {(unittest)}
                {(discover)}
                {(--failfast)}
                {(--verbose)}
                {(--pattern)}
                {(SQ <'*_test.py'>)}
              ]
              more_env: [(env_pair name:_OVM_RESOURCE_ROOT val:{($ VSub_DollarName '$PWD')})]
            )
          ]
        )
    )
    (command.ShFunction
      name: run-test-and-log
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'tasks_csv=') ($ VSub_Number '$1')})
            (C {(local)} {(Lit_VarLike 't=') ($ VSub_Number '$2')})
            (C {(local)} {(Lit_VarLike 'log=') (_tmp/unit/) ($ VSub_DollarName '$t') (.txt)})
            (C {(mkdir)} {(-p)} 
              {
                (command_sub
                  left_token: <Left_DollarParen '$('>
                  command_list: 
                    (command.CommandList
                      children: [(C {(dirname)} {($ VSub_DollarName '$log')})]
                    )
                )
              }
            )
            (command.Simple
              words: [
                {(benchmarks/time.py)}
                {(--out)}
                {($ VSub_DollarName '$tasks_csv')}
                {(--field)}
                {($ VSub_DollarName '$t')}
                {(--field)}
                {(DQ ($ VSub_DollarName '$t') (.txt))}
                {(--)}
                {($ VSub_DollarName '$t')}
              ]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$log')}
                )
                (redir.Redir op:<Redir_GreatAnd '2>&'> fd:2 arg_word:{(1)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: run-all-and-log
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'out_dir=') (_tmp/unit)})
            (C {(mkdir)} {(-p)} {($ VSub_DollarName '$out_dir')})
            (C {(rm)} {(-r)} {(-f)} {($ VSub_DollarName '$out_dir') (/) (Lit_Star '*')})
            (C {(local)} {(Lit_VarLike 'tasks_csv=') ($ VSub_DollarName '$out_dir') (/tasks.csv)})
            (C {(local)} {(Lit_VarLike 'status=') (0)})
            (command.Simple
              words: [{(echo)} {(SQ <'status,elapsed_secs,test,test_HREF'>)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$tasks_csv')}
                )
              ]
            )
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (command.TimeBlock
                  pipeline: 
                    (command.Pipeline
                      children: [
                        (C {(tests-to-run)})
                        (C {(xargs)} {(-n)} {(1)} {(--)} {($ VSub_Number '$0')} {(run-test-and-log)} 
                          {($ VSub_DollarName '$tasks_csv')}
                        )
                      ]
                      negated: F
                    )
                )
                (command.ShAssignment
                  pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:status) op:Equal rhs:{(1)})]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: (C {(test)} {($ VSub_DollarName '$status')} {(-ne)} {(0)})
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(cat)} {($ VSub_DollarName '$tasks_csv')})
                    (C {(echo)})
                    (C {(echo)} 
                      {
                        (DQ ('*** Some tests failed.  See ') ($ VSub_DollarName '$tasks_csv') (' ***'))
                      }
                    )
                    (C {(echo)})
                    (command.ControlFlow
                      token: <ControlFlow_Return return>
                      arg_word: {($ VSub_DollarName '$status')}
                    )
                  ]
                )
              ]
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('All unit tests passed.'))})
          ]
        )
    )
    (C {(source)} {(benchmarks/common.sh)})
    (command.ShFunction
      name: print-report
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} 
              {(Lit_VarLike 'in_dir=') 
                (braced_var_sub
                  token: <VSub_Number 1>
                  suffix_op: 
                    (suffix_op.Unary
                      op_id: VTest_ColonHyphen
                      arg_word: {(_tmp) (Lit_Slash /) (unit)}
                    )
                )
              }
            )
            (C {(local)} {(Lit_VarLike 'base_url=') (SQ <../../web>)})
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 798
                  stdin_parts: [
                    ('<!DOCTYPE html>\n')
                    ('<html>\n')
                    ('  <head>\n')
                    ('    <title>Unit Test Results</title>\n')
                    ('    <script type=')
                    (Right_DoubleQuote '"')
                    (text/javascript)
                    (Right_DoubleQuote '"')
                    (' src=')
                    (Right_DoubleQuote '"')
                    ($ VSub_DollarName '$base_url')
                    (/table/table-sort.js)
                    (Right_DoubleQuote '"')
                    ('></script>\n')
                    ('    <link rel=')
                    (Right_DoubleQuote '"')
                    (stylesheet)
                    (Right_DoubleQuote '"')
                    (' type=')
                    (Right_DoubleQuote '"')
                    (text/css)
                    (Right_DoubleQuote '"')
                    (' href=')
                    (Right_DoubleQuote '"')
                    ($ VSub_DollarName '$base_url')
                    (/table/table-sort.css)
                    (Right_DoubleQuote '"')
                    (' />\n')
                    ('    <link rel=')
                    (Right_DoubleQuote '"')
                    (stylesheet)
                    (Right_DoubleQuote '"')
                    (' type=')
                    (Right_DoubleQuote '"')
                    (text/css)
                    (Right_DoubleQuote '"')
                    (' href=')
                    (Right_DoubleQuote '"')
                    ($ VSub_DollarName '$base_url')
                    (/benchmarks.css)
                    (Right_DoubleQuote '"')
                    (' />\n')
                    ('\n')
                    ('  </head>\n')
                    ('  <body>\n')
                    ('    <p id=')
                    (Right_DoubleQuote '"')
                    (home-link)
                    (Right_DoubleQuote '"')
                    ('>\n')
                    ('      <a href=')
                    (Right_DoubleQuote '"')
                    (/)
                    (Right_DoubleQuote '"')
                    ('>oilshell.org</a>\n')
                    ('    </p>\n')
                    ('    <h2>Unit Test Results</h2>\n')
                    ('\n')
                  ]
                )
              ]
            )
            (C {(csv2html)} {($ VSub_DollarName '$in_dir') (/report.csv)})
            (command.Simple
              words: [{(cat)}]
              redirects: [
                (redir.HereDoc
                  op: <Redir_DLess '<<'>
                  fd: 16777215
                  here_begin: {(EOF)}
                  here_end_span_id: 815
                  stdin_parts: [('  </body>\n') ('</html>\n')]
                )
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: write-report
      body: 
        (command.BraceGroup
          children: [
            (C {(local)} {(Lit_VarLike 'out=') (_tmp/unit/index.html)})
            (C {(test/report.R)} {(unit)} {(_tmp/unit)} {(_tmp/unit)})
            (command.Simple
              words: [{(print-report)}]
              redirects: [
                (redir.Redir
                  op: <Redir_Great '>'>
                  fd: 16777215
                  arg_word: {($ VSub_DollarName '$out')}
                )
              ]
            )
            (C {(echo)} {(DQ ('Wrote ') ($ VSub_DollarName '$out'))})
          ]
        )
    )
    (command.ShFunction
      name: run-for-release
      body: (command.BraceGroup children:[(C {(run-all-and-log)}) (C {(write-report)})])
    )
    (C {(DQ ($ VSub_At '$@'))})
  ]
)