(command.CommandList
  children: [
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (C {(set)} {(-o)} {(errexit)})
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:OSH)
          op: Equal
          rhs: 
            {
              (word_part.BracedVarSub
                token: <VSub_Name OSH>
                suffix_op: 
                  (suffix_op.StringUnary
                    op_id: VTest_ColonHyphen
                    arg_word: {(bin) (Lit_Slash /) (osh)}
                  )
              )
            }
        )
      ]
    )
    (command.Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:JOBS)
          op: Equal
          rhs: 
            {
              (word_part.ArithSubPart
                anode: 
                  (arith_expr.ArithBinary
                    op_id: Arith_Minus
                    left: 
                      (arith_expr.ArithWord
                        w: 
                          {
                            (word_part.CommandSubPart
                              command_list: (command.CommandList children:[(C {(nproc)})])
                              left_token: <Left_DollarParen '$('>
                            )
                          }
                      )
                    right: (arith_expr.ArithWord w:{(Lit_Digits 1)})
                  )
              )
            }
        )
      ]
    )
    (command.FuncDef
      name: log
      body: 
        (command.BraceGroup
          children: [
            (command.SimpleCommand
              words: [{(echo)} {(DQ ($ VSub_At '$@'))}]
              redirects: [(redir.Redir op:<Redir_GreatAnd '1>&'> fd:1 arg_word:{(2)})]
            )
          ]
        )
    )
    (command.FuncDef
      name: die
      body: 
        (command.BraceGroup
          children: [
            (C {(log)} {(DQ ($ VSub_At '$@'))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.FuncDef
      name: fail
      body: 
        (command.BraceGroup
          children: [
            (C {(echo)} {(SQ <'TEST FAILURE  '>)} {(DQ ($ VSub_At '$@'))})
            (command.ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
        )
    )
    (command.FuncDef
      name: assert
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(test)} {(DQ ($ VSub_At '$@'))})
                (C {(die)} {(DQ ("'") ($ VSub_At '$@') ("' failed"))})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: run-task-with-status
      body: 
        (command.BraceGroup
          children: [
            (command.Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (lhs_expr.LhsName name:out_file)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                )
              ]
            )
            (C {(shift)})
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(/usr/bin/env)} {(KW_Time time)} {(--output)} {($ VSub_DollarName '$out_file')} 
                  {(--format)} {(SQ <'%x %e'>)} {(--)} {(DQ ($ VSub_At '$@'))}
                )
                (C {(true)})
              ]
            )
            (C {(sed)} {(-i)} {(SQ <'/Command exited with non-zero status/d'>)} 
              {($ VSub_DollarName '$out_file')}
            )
          ]
        )
    )
    (command.FuncDef
      name: run-task-with-status-test
      body: 
        (command.BraceGroup
          children: [
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(run-task-with-status)} {(_tmp/status.txt)} {(sh)} {(-c)} {(SQ <'sleep 0.1; exit 1'>)})
                (C {(true)})
              ]
            )
            (C {(cat)} {(_tmp/status.txt)})
            (command.AndOr
              ops: [Op_DPipe]
              children: [
                (C {(test)} 
                  {
                    (DQ 
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.SimpleCommand
                                words: [{(wc)} {(-l)}]
                                redirects: [
                                  (redir.Redir
                                    op: <Redir_Less '<'>
                                    fd: 16777215
                                    arg_word: {(_tmp/status.txt)}
                                  )
                                ]
                              )
                            ]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    )
                  } {(Lit_Other '=')} {(SQ <1>)}
                )
                (C {(die)} {(DQ ('Expected only one line'))})
              ]
            )
          ]
        )
    )
    (command.FuncDef
      name: run-all
      body: 
        (command.BraceGroup
          children: [
            (command.ForEach
              iter_name: t
              iter_words: [{(DQ ($ VSub_At '$@'))}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (C {($ VSub_DollarName '$t')})
                    (C {(echo)} {(DQ ('OK  ') ($ VSub_DollarName '$t'))})
                  ]
                )
            )
            (C {(echo)})
            (C {(echo)} {(DQ ('All ') ($ VSub_Number '$0') (' tests passed.'))})
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(test)} 
                  {
                    (DQ 
                      (word_part.CommandSubPart
                        command_list: 
                          (command.CommandList
                            children: [(C {(basename)} {($ VSub_Number '$0')})]
                          )
                        left_token: <Left_DollarParen '$('>
                      )
                    )
                  } {(Lit_Other '=')} {(SQ <common.sh>)}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(DQ ($ VSub_At '$@'))})]
        )
      ]
    )
  ]
)