(command.CommandList
  children: [
    (C {<set>} {<-o>} {<nounset>})
    (C {<set>} {<-o>} {<pipefail>})
    (C {<set>} {<-o>} {<errexit>})
    (C {<readonly>} 
      {<Id.Lit_VarLike 'OSH='> 
        (braced_var_sub
          token: <Id.VSub_Name OSH>
          suffix_op: 
            (suffix_op.Unary
              tok: <Id.VTest_ColonHyphen ':-'>
              arg_word: {<bin> <Id.Lit_Slash '/'> <osh>}
            )
        )
      }
    )
    (C {<readonly>} 
      {<Id.Lit_VarLike 'JOBS='> 
        (word_part.ArithSub
          anode: 
            (arith_expr.Binary
              op_id: Id.Arith_Minus
              left: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<nproc>}))}
              right: {<Id.Lit_Digits 1>}
            )
        )
      }
    )
    (command.ShFunction
      name: log
      body: 
        (BraceGroup
          children: [
            (command.Simple
              words: [{<echo>} {(DQ ($ Id.VSub_At '$@'))}]
              redirects: [(redir op:<Id.Redir_GreatAnd '1>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
              do_fork: T
            )
          ]
        )
    )
    (command.ShFunction
      name: die
      body: 
        (BraceGroup
          children: [
            (C {<log>} {(DQ ($ Id.VSub_At '$@'))})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.ShFunction
      name: fail
      body: 
        (BraceGroup
          children: [
            (C {<echo>} {(SQ <'TEST FAILURE  '>)} {(DQ ($ Id.VSub_At '$@'))})
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>})
          ]
        )
    )
    (command.ShFunction
      name: assert
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<test>} {(DQ ($ Id.VSub_At '$@'))})
                (C {<die>} {(DQ <'\''> ($ Id.VSub_At '$@') <'\' failed'>)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: run-task-with-status
      body: 
        (BraceGroup
          children: [
            (C {<local>} {<Id.Lit_VarLike 'out_file='> ($ Id.VSub_Number '$1')})
            (C {<shift>})
            (command.AndOr
              ops: [Id.Op_DPipe]
              children: [
                (C {<'/usr/bin/env'>} {<Id.KW_Time time>} {<--output>} 
                  {($ Id.VSub_DollarName '$out_file')} {<--format>} {(SQ <'%x %e'>)} {<-->} {(DQ ($ Id.VSub_At '$@'))}
                )
                (C {<true>})
              ]
            )
            (C {<sed>} {<-i>} {(SQ <'/Command exited with non-zero status/d'>)} 
              {($ Id.VSub_DollarName '$out_file')}
            )
          ]
        )
    )
    (command.ShFunction
      name: run-task-with-status-test
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.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: [Id.Op_DPipe]
              children: [
                (C {<test>} 
                  {
                    (DQ 
                      (command_sub
                        left_token: <Id.Left_DollarParen '$('>
                        child: 
                          (command.Simple
                            words: [{<wc>} {<-l>}]
                            redirects: [
                              (redir
                                op: <Id.Redir_Less '<'>
                                loc: (redir_loc.Fd fd:0)
                                arg: {<'_tmp/status.txt'>}
                              )
                            ]
                            do_fork: T
                          )
                      )
                    )
                  } {<Id.Lit_Equals '='>} {(SQ <1>)}
                )
                (C {<die>} {(DQ <'Expected only one line'>)})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: run-all
      body: 
        (BraceGroup
          children: [
            (command.ForEach
              iter_names: [t]
              iterable: (for_iter.Words words:[{(DQ ($ Id.VSub_At '$@'))}])
              body: 
                (command.DoGroup
                  children: [
                    (C {($ Id.VSub_DollarName '$t')})
                    (C {<echo>} {(DQ <'OK  '> ($ Id.VSub_DollarName '$t'))})
                  ]
                )
            )
            (C {<echo>})
            (C {<echo>} {(DQ <'All '> ($ Id.VSub_Number '$0') <' tests passed.'>)})
          ]
        )
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<test>} 
                      {
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: (C {<basename>} {($ Id.VSub_Number '$0')})
                          )
                        )
                      } {<Id.Lit_Equals '='>} {(SQ <common.sh>)}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [(C {(DQ ($ Id.VSub_At '$@'))})]
          spids: [375 394]
        )
      ]
    )
  ]
)