(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: 
            {
              (SQ <'gitweb as standalone script (http status tests).\n'> <'\n'> 
                <'This test runs gitweb (git web interface) as a CGI script from the\n'> <'commandline, and checks that it returns the expected HTTP status\n'> <'code and message.'>
              )
            }
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./gitweb-lib.sh'>})
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.Simple
          words: [{<perl>} {<-MHTTP> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <Date>} {<-e>} {<0>}]
          redirects: [
            (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
        (C {<test_set_prereq>} {<DATE_PARSER>})
      ]
    )
    (command.AndOr
      ops: [Id.Op_DAmp]
      children: [
        (command.Simple
          words: [{<perl>} {<-MTime> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <ParseDate>} {<-e>} {<0>}]
          redirects: [
            (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
            (redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
        (C {<test_set_prereq>} {<DATE_PARSER>})
      ]
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {(DQ <'\n'> <'\ttest_commit \'SnapshotTests\' \'i can has snapshot\'\n'>)}
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<gitweb_config.perl>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 118
              stdin_parts: [<'$feature{\'snapshot\'}{\'override\'} = 0;\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'snapshots: tgz only default format enabled'>)} 
      {
        (SQ <'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&\n'> 
          <'    grep "Status: 200 OK" gitweb.output &&\n'> <'    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&\n'> 
          <'    grep "403 - Unsupported snapshot format" gitweb.output &&\n'> <'    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&\n'> 
          <'    grep "403 - Snapshot format not allowed" gitweb.output &&\n'> <'    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&\n'> 
          <'    grep "403 - Unsupported snapshot format" gitweb.output'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<gitweb_config.perl>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 153
              stdin_parts: [
                <'$feature{\'snapshot\'}{\'default\'} = [\'tgz\',\'tbz2\',\'txz\',\'zip\'];\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'snapshots: all enabled in default, use default disabled value'>)} 
      {
        (SQ <'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&\n'> 
          <'    grep "Status: 200 OK" gitweb.output &&\n'> <'    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tbz2" &&\n'> 
          <'    grep "Status: 200 OK" gitweb.output &&\n'> <'    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=txz" &&\n'> 
          <'    grep "403 - Snapshot format not allowed" gitweb.output &&\n'> <'    gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&\n'> <'    grep "Status: 200 OK" gitweb.output'>
        )
      }
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<gitweb_config.perl>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 188
              stdin_parts: [<'$known_snapshot_formats{\'zip\'}{\'disabled\'} = 1;\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'snapshots: zip explicitly disabled'>)} 
      {
        (SQ <'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=zip" &&\n'> 
          <'    grep "403 - Snapshot format not allowed" gitweb.output'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.output'>)})
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<gitweb_config.perl>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 223
              stdin_parts: [<'$known_snapshot_formats{\'tgz\'}{\'disabled\'} = 0;\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'snapshots: tgz explicitly enabled'>)} 
      {
        (SQ <'gitweb_run "p=.git;a=snapshot;h=HEAD;sf=tgz" &&\n'> 
          <'    grep "Status: 200 OK" gitweb.output'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {(SQ <'snapshots: good tree-ish id'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&\n'> 
          <'\tgrep "Status: 200 OK" gitweb.output\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {(SQ <'snapshots: bad tree-ish id'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "p=.git;a=snapshot;h=frizzumFrazzum;sf=tgz" &&\n'> 
          <'\tgrep "404 - Object does not exist" gitweb.output\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.output'>)})
    (C {<test_expect_success>} {(SQ <'snapshots: bad tree-ish id (tagged object)'>)} 
      {
        (SQ <'\n'> <'\techo object > tag-object &&\n'> <'\tgit add tag-object &&\n'> 
          <'\ttest_tick && git commit -m "Object to be tagged" &&\n'> <'\tgit tag tagged-object $(git hash-object tag-object) &&\n'> 
          <'\tgitweb_run "p=.git;a=snapshot;h=tagged-object;sf=tgz" &&\n'> <'\tgrep "400 - Object is not a tree-ish" gitweb.output\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.output'>)})
    (C {<test_expect_success>} {(SQ <'snapshots: good object id'>)} 
      {
        (SQ <'\n'> <'\tID=$(git rev-parse --verify HEAD) &&\n'> 
          <'\tgitweb_run "p=.git;a=snapshot;h=$ID;sf=tgz" &&\n'> <'\tgrep "Status: 200 OK" gitweb.output\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {(SQ <'snapshots: bad object id'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "p=.git;a=snapshot;h=abcdef01234;sf=tgz" &&\n'> 
          <'\tgrep "404 - Object does not exist" gitweb.output\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.output'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} {(SQ <'modification: feed last-modified'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "p=.git;a=atom;h=master" &&\n'> 
          <'\tgrep "Status: 200 OK" gitweb.headers &&\n'> <'\tgrep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} {(SQ <'modification: feed if-modified-since (modified)'>)} 
      {
        (SQ <'\n'> <'\tHTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&\n'> 
          <'\texport HTTP_IF_MODIFIED_SINCE &&\n'> <'\ttest_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&\n'> 
          <'\tgitweb_run "p=.git;a=atom;h=master" &&\n'> <'\tgrep "Status: 200 OK" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} 
      {(SQ <'modification: feed if-modified-since (unmodified)'>)} 
      {
        (SQ <'\n'> <'\tHTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&\n'> 
          <'\texport HTTP_IF_MODIFIED_SINCE &&\n'> <'\ttest_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&\n'> 
          <'\tgitweb_run "p=.git;a=atom;h=master" &&\n'> <'\tgrep "Status: 304 Not Modified" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} {(SQ <'modification: snapshot last-modified'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&\n'> 
          <'\tgrep "Status: 200 OK" gitweb.headers &&\n'> <'\tgrep "Last-modified: Thu, 7 Apr 2005 22:14:13 +0000" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} 
      {(SQ <'modification: snapshot if-modified-since (modified)'>)} 
      {
        (SQ <'\n'> <'\tHTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&\n'> 
          <'\texport HTTP_IF_MODIFIED_SINCE &&\n'> <'\ttest_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&\n'> 
          <'\tgitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&\n'> <'\tgrep "Status: 200 OK" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} 
      {(SQ <'modification: snapshot if-modified-since (unmodified)'>)} 
      {
        (SQ <'\n'> <'\tHTTP_IF_MODIFIED_SINCE="Thu, 7 Apr 2005 22:14:13 +0000" &&\n'> 
          <'\texport HTTP_IF_MODIFIED_SINCE &&\n'> <'\ttest_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&\n'> 
          <'\tgitweb_run "p=.git;a=snapshot;h=master;sf=tgz" &&\n'> <'\tgrep "Status: 304 Not Modified" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_expect_success>} {<DATE_PARSER>} {(SQ <'modification: tree snapshot'>)} 
      {
        (SQ <'\n'> <'\tID=$(git rev-parse --verify HEAD^{tree}) &&\n'> 
          <'\tHTTP_IF_MODIFIED_SINCE="Wed, 6 Apr 2005 22:14:13 +0000" &&\n'> <'\texport HTTP_IF_MODIFIED_SINCE &&\n'> <'\ttest_when_finished "unset HTTP_IF_MODIFIED_SINCE" &&\n'> 
          <'\tgitweb_run "p=.git;a=snapshot;h=$ID;sf=tgz" &&\n'> <'\tgrep "Status: 200 OK" gitweb.headers &&\n'> <'\t! grep -i "last-modified" gitweb.headers\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<gitweb_config.perl>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 548
              stdin_parts: [<'our $maxload = -1;\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'load checking: load too high (default action)'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "p=.git" &&\n'> 
          <'\tgrep "Status: 503 Service Unavailable" gitweb.headers &&\n'> <'\tgrep "503 - The load average on the server is too high" gitweb.body\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_DGreat '>>'> loc:(redir_loc.Fd fd:1) arg:{<gitweb_config.perl>})
        (redir
          op: <Id.Redir_DLess '<<'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 583
              stdin_parts: [<'our $maxload = undef;\n'>]
            )
        )
      ]
      do_fork: T
    )
    (C {<test_expect_success>} {(SQ <'invalid arguments: invalid regexp (in project search)'>)} 
      {
        (SQ <'\n'> <'\tgitweb_run "a=project_list;s=*\\.git;sr=1" &&\n'> 
          <'\tgrep "Status: 400" gitweb.headers &&\n'> <'\tgrep "400 - Invalid.*regexp" gitweb.body\n'>
        )
      }
    )
    (C {<test_debug>} {(SQ <'cat gitweb.headers'>)})
    (C {<test_done>})
  ]
)