(CommandList
  children: [
    (C {(add_to_bazelrc)} {(DQ ("build --crosstool_top=@bazel_tools//tools/cpp:default-toolchain"))})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:CURRENT_DIR)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (AndOr
                          children: [
                            (C {(cd)} 
                              {
                                (DQ 
                                  (CommandSubPart
                                    command_list: 
                                      (CommandList
                                        children: [
                                          (C {(dirname)} 
                                            {
                                              (DQ 
                                                (BracedVarSub
                                                  token: <VSub_Name BASH_SOURCE>
                                                  bracket_op: 
                                                    (ArrayIndex
                                                      expr: (ArithWord w:{(Lit_Digits 0)})
                                                    )
                                                  spids: [81 86]
                                                )
                                              )
                                            }
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub "$(">
                                    spids: [77 88]
                                  )
                                )
                              }
                            )
                            (C {(pwd)})
                          ]
                          op_id: Op_DAmp
                        )
                      ]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [73 94]
                )
              )
            }
          spids: [71]
        )
      ]
      spids: [71]
    )
    (AndOr
      children: [
        (C {(source)} {(DQ (${ VSub_Name CURRENT_DIR) (/../integration_test_setup.sh))})
        (BraceGroup
          children: [
            (Sentence
              child: 
                (SimpleCommand
                  words: [{(echo)} {(DQ ("integration_test_setup.sh not found!"))}]
                  redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[118])]
                )
              terminator: <Op_Semi ";">
            )
            (Sentence child:(C {(exit)} {(1)}) terminator:<Op_Semi ";">)
          ]
          spids: [110]
        )
      ]
      op_id: Op_DPipe
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:output_base)
          op: Equal
          rhs: {($ VSub_Name "$TEST_TMPDIR") (/out)}
          spids: [130]
        )
      ]
      spids: [130]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:TEST_stderr)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(dirname)} {($ VSub_Name "$TEST_log")})])
                left_token: <Left_CommandSub "$(">
                spids: [135 139]
              ) (/stderr)
            }
          spids: [134]
        )
      ]
      spids: [134]
    )
    (FuncDef
      name: set_up
      body: (BraceGroup children:[(C {(cd)} {(${ VSub_Name WORKSPACE_DIR)})] spids:[153])
      spids: [147 152]
    )
    (FuncDef
      name: tear_down
      body: (BraceGroup children:[(C {(bazel)} {(shutdown)})] spids:[171])
      spids: [165 170]
    )
    (FuncDef
      name: test_query_buildfiles_with_load
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(x)}) (C {(fail)} {(DQ ("mkdir x failed"))})]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("load('/y/rules', 'a')"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(x/BUILD)} spids:[215])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("cc_library(name='x')"))}]
              redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(x/BUILD)} spids:[225])]
            )
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(y)}) (C {(fail)} {(DQ ("mkdir y failed"))})]
              op_id: Op_DPipe
            )
            (C {(touch)} {(y/BUILD)})
            (SimpleCommand
              words: [{(echo)} {(DQ ("a=1"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(y/rules.bzl)} spids:[255])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(--noshow_progress)} {(SQ <"buildfiles(//x)">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [270]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(//x) (Lit_Other ":") (BUILD)})
            (C {(expect_log)} {(//y) (Lit_Other ":") (BUILD)})
            (C {(expect_log)} {(//y) (Lit_Other ":") (rules.bzl)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(--noshow_progress)} {(--null)} {(SQ <"buildfiles(//x)">)}]
                  redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(null.log)} spids:[321])]
                )
                (C {(fail)} {(DQ ("Expected null success"))})
              ]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(printf)} {(SQ <"//y:rules.bzl\\0//y:BUILD\\0//x:BUILD\\0">)}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(null.ref.log)} spids:[340])]
            )
            (AndOr
              children: [(C {(cmp)} {(null.ref.log)} {(null.log)}) (C {(fail)} {(DQ ("Expected match"))})]
              op_id: Op_DPipe
            )
            (C {(rm)} {(-f)} {(y/rules.bzl)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(--noshow_progress)} {(SQ <"buildfiles(//x)">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: 2
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [381]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected error"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("Extension file not found. Unable to load file '//y:rules.bzl'"))})
          ]
          spids: [191]
        )
      spids: [185 190]
    )
    (FuncDef
      name: test_non_error_target_in_bad_pkg
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(a)}) (C {(fail)} {(DQ ("mkdir a failed"))})]
              op_id: Op_DPipe
            )
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(b)}) (C {(fail)} {(DQ ("mkdir b failed"))})]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("sh_library(name = 'a', data = ['//b'])"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(a/BUILD)} spids:[458])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("exports_files(['b'])"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(b/BUILD)} spids:[469])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("genrule(name='r1', cmd = '', outs = ['conflict'])"))}]
              redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(b/BUILD)} spids:[480])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("genrule(name='r2', cmd = '', outs = ['conflict'])"))}]
              redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(b/BUILD)} spids:[491])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(build)} {(--nobuild)} {(-k)} {(//a)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [507]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("'conflict' in rule"))})
            (C {(expect_not_log)} {(DQ ("Loading failed"))})
            (C {(expect_log)} {(DQ ("but there were loading phase errors"))})
            (C {(expect_not_log)} {(DQ ("Loading succeeded for only"))})
          ]
          spids: [418]
        )
      spids: [412 417]
    )
    (FuncDef
      name: test_options_errors
      body: 
        (BraceGroup
          children: [
            (Pipeline
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(help)}]
                  redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[579])]
                )
                (C {(grep)} {(SQ <"^  [a-z]">)})
                (C {(grep)} {(-v)} {(SQ <"^  ">) (${ VSub_Name PRODUCT_NAME) (SQ <" ">)})
                (C {(awk)} {(SQ <"{print $1}">)})
                (While
                  cond: [(Sentence child:(C {(read)} {(command)}) terminator:<Op_Semi ";">)]
                  body: 
                    (DoGroup
                      children: [
                        (AndOr
                          children: [
                            (SimpleCommand
                              words: [{(bazel)} {($ VSub_Name "$command")}]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: -1
                                  arg_word: {($ VSub_Name "$TEST_log")}
                                  spids: [634]
                                )
                                (Redir
                                  op_id: Redir_GreatAnd
                                  fd: 2
                                  arg_word: {(1)}
                                  spids: [637]
                                )
                              ]
                            )
                            (C {(true)})
                          ]
                          op_id: Op_DPipe
                        )
                        (C {(expect_not_log)} {(DQ ("Duplicate option name"))})
                        (C {(expect_not_log)} {(DQ ("at com.google.devtools.build.lib"))})
                        (C {(expect_not_log)} {(DQ ("lib.util.options.*Exception"))})
                      ]
                      spids: [627 670]
                    )
                )
              ]
              negated: False
            )
          ]
          spids: [568]
        )
      spids: [562 567]
    )
    (FuncDef
      name: test_bazelrc_option
      body: 
        (BraceGroup
          children: [
            (C {(cp)} {(${ VSub_Name bazelrc)} 
              {(${ VSub_Name new_workspace_dir) (/.) (${ VSub_Name PRODUCT_NAME) (rc)}
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("build --cpu=armeabi-v7a"))}]
              redirects: [
                (Redir
                  op_id: Redir_DGreat
                  fd: -1
                  arg_word: {(.) (${ VSub_Name PRODUCT_NAME) (rc)}
                  spids: [707]
                )
              ]
            )
            (SimpleCommand
              words: [{($ VSub_Name "$PATH_TO_BAZEL_BIN")} {(info)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[722])
                (Redir
                  op_id: Redir_Great
                  fd: 2
                  arg_word: {($ VSub_Name "$TEST_log")}
                  spids: [725]
                )
              ]
            )
            (C {(expect_log)} 
              {
                (DQ ("Reading.*") 
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(pwd)})])
                    left_token: <Left_CommandSub "$(">
                    spids: [733 735]
                  ) (/.) (${ VSub_Name PRODUCT_NAME) ("rc:\n") (".*--cpu=armeabi-v7a")
                )
              }
            )
            (C {(cp)} {(.) (${ VSub_Name PRODUCT_NAME) (rc)} {(foo)})
            (SimpleCommand
              words: [{(echo)} {(DQ ("build --cpu=armeabi-v7a"))}]
              redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(foo)} spids:[763])]
            )
            (SimpleCommand
              words: [
                {($ VSub_Name "$PATH_TO_BAZEL_BIN")}
                {(--) (${ VSub_Name PRODUCT_NAME) (Lit_VarLike "rc=") (foo)}
                {(info)}
              ]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[781])
                (Redir
                  op_id: Redir_Great
                  fd: 2
                  arg_word: {($ VSub_Name "$TEST_log")}
                  spids: [784]
                )
              ]
            )
            (C {(expect_log)} 
              {
                (DQ ("Reading.*") 
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(pwd)})])
                    left_token: <Left_CommandSub "$(">
                    spids: [792 794]
                  ) ("/foo:\n") (".*--cpu=armeabi-v7a")
                )
              }
            )
          ]
          spids: [681]
        )
      spids: [675 680]
    )
    (FuncDef
      name: test_all_help_topics_succeed
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:topics)
                  op: Equal
                  rhs: 
                    {
                      (ArrayLiteralPart
                        words: [
                          {
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [
                                    (Pipeline
                                      children: [
                                        (SimpleCommand
                                          words: [{(bazel)} {(help)}]
                                          redirects: [
                                            (Redir
                                              op_id: Redir_Great
                                              fd: 2
                                              arg_word: {(/dev/null)}
                                              spids: [824]
                                            )
                                          ]
                                        )
                                        (C {(grep)} {(SQ <"^  [a-z]">)})
                                        (C {(grep)} {(-v)} 
                                          {(SQ <"^  ">) (${ VSub_Name PRODUCT_NAME) (SQ <" ">)}
                                        )
                                        (C {(awk)} {(SQ <"{print $1}">)})
                                      ]
                                      negated: False
                                    )
                                  ]
                                )
                              left_token: <Left_CommandSub "$(">
                              spids: [819 861]
                            )
                          }
                          {(startup_options)}
                          {(target-syntax)}
                        ]
                      )
                    }
                  spids: [817]
                )
              ]
              spids: [817]
            )
            (ForEach
              iter_name: topic
              iter_words: [
                {
                  (BracedVarSub
                    token: <VSub_Name topics>
                    bracket_op: (WholeArray op_id:Lit_At)
                    spids: [879 884]
                  )
                }
              ]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (AndOr
                      children: [
                        (SimpleCommand
                          words: [{(bazel)} {(help)} {($ VSub_Name "$topic")}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: -1
                              arg_word: {($ VSub_Name "$TEST_log")}
                              spids: [896]
                            )
                            (Redir
                              op_id: Redir_GreatAnd
                              fd: 2
                              arg_word: {(1)}
                              spids: [899]
                            )
                          ]
                        )
                        (BraceGroup
                          children: [
                            (C {(fail)} {(DQ ("help ") ($ VSub_Name "$topic") (" failed"))})
                            (C {(expect_not_log)} {(.)})
                          ]
                          spids: [904]
                        )
                      ]
                      op_id: Op_DPipe
                    )
                  ]
                  spids: [887 927]
                )
              spids: [878 885]
            )
            (AndOr
              children: [
                (C {(Lit_Other "[")} 
                  {
                    (BracedVarSub
                      token: <VSub_Name topics>
                      prefix_op: VSub_Pound
                      bracket_op: (WholeArray op_id:Lit_At)
                      spids: [932 938]
                    )
                  } {(-gt)} {(15)} {(Lit_Other "]")}
                )
                (C {(fail)} 
                  {
                    (DQ ("Hmmm: not many topics: ") 
                      (BracedVarSub
                        token: <VSub_Name topics>
                        bracket_op: (WholeArray op_id:Lit_At)
                        spids: [952 957]
                      ) (.)
                    )
                  }
                )
              ]
              op_id: Op_DPipe
            )
          ]
          spids: [814]
        )
      spids: [808 813]
    )
    (FuncDef
      name: test_regress_cycle_during_analysis_phase
      body: 
        (BraceGroup
          children: [
            (C {(mkdir)} {(-p)} {(cycle)} {(main)})
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(main/BUILD)} spids:[987])
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: 
                    {
                      (DQ 
                        (
"genrule(name='mygenrule', outs=['baz.h'], srcs=['//cycle:foo.h'], cmd=':')\n"
                        )
                      )
                    }
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [990]
                )
              ]
            )
            (SimpleCommand
              words: [{(cat)}]
              redirects: [
                (Redir op_id:Redir_Great fd:-1 arg_word:{(cycle/BUILD)} spids:[997])
                (HereDoc
                  op_id: Redir_DLess
                  fd: -1
                  body: {(DQ ("genrule(name='foo.h', outs=['bar.h'], srcs=['foo.h'], cmd=':')\n"))}
                  do_expansion: True
                  here_end: EOF
                  was_filled: True
                  spids: [1000]
                )
              ]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(build)} {(--nobuild)} {(//cycle) (Lit_Other ":") (foo.h)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1015]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1018])
                  ]
                )
                (C {(true)})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("in genrule rule //cycle:foo.h: .*dependency graph"))})
            (C {(expect_log)} {(DQ ("//cycle:foo.h.*self-edge"))})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(build)} {(--nobuild)} {(//main) (Lit_Other ":") (mygenrule)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1051]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1054])
                  ]
                )
                (C {(true)})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("in genrule rule //cycle:foo.h: .*dependency graph"))})
            (C {(expect_log)} {(DQ ("//cycle:foo.h.*self-edge"))})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(build)} {(--nobuild)} {(//cycle) (Lit_Other ":") (foo.h)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1087]
                    )
                    (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1090])
                  ]
                )
                (C {(true)})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("in genrule rule //cycle:foo.h: .*dependency graph"))})
            (C {(expect_log)} {(DQ ("//cycle:foo.h.*self-edge"))})
          ]
          spids: [973]
        )
      spids: [967 972]
    )
    (FuncDef
      name: test_warning_for_weird_parameters
      body: 
        (BraceGroup
          children: [
            (SimpleCommand
              words: [
                {(bazel)}
                {(build)}
                {(--check_tests_up_to_date)}
                {(--check_up_to_date)}
                {(--nobuild)}
              ]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: -1
                  arg_word: {($ VSub_Name "$TEST_log")}
                  spids: [1136]
                )
                (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[1139])
              ]
            )
            (C {(expect_log)} {(DQ ("WARNING: Option 'check_up_to_date' is implicitly defined by"))})
          ]
          spids: [1123]
        )
      spids: [1117 1122]
    )
    (FuncDef
      name: test_glob_with_subpackage
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(p/subpkg)}) (C {(fail)} {(DQ ("mkdir p/subpkg failed"))})]
              op_id: Op_DPipe
            )
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(p/dir)}) (C {(fail)} {(DQ ("mkdir p/dir failed"))})]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("exports_files(glob(['**/*.txt']))"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/BUILD)} spids:[1201])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("# Empty"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/subpkg/BUILD)} spids:[1211])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (p/t1.txt))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/t1.txt)} spids:[1222])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (p/dir/t2.txt))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/dir/t2.txt)} spids:[1233])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (p/subpkg/t3.txt))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/subpkg/t3.txt)} spids:[1244])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"p:*">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1258]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(SQ <"//p:t1\\.txt">)})
            (C {(expect_log)} {(SQ <"//p:dir/t2\\.txt">)})
            (C {(expect_log)} {(SQ <"//p:BUILD">)})
            (C {(expect_not_log)} {(SQ <"t3\\.txt">)})
            (C {(assert_equals)} {(DQ (3))} 
              {
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(wc)} {(-l)} {(DQ ($ VSub_Name "$TEST_log"))})]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [1304 1312]
                )
              }
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("exports_files(glob(['subpkg/t3.txt']))"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/BUILD)} spids:[1326])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"p:*">)} {(-k)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1340]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(SQ <"//p:BUILD">)})
            (C {(assert_equals)} {(DQ (1))} 
              {
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(wc)} {(-l)} {(DQ ($ VSub_Name "$TEST_log"))})]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [1365 1373]
                )
              }
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("exports_files(glob(['subpkg/no_glob.txt']))"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/BUILD)} spids:[1387])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"p:*">)} {(-k)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1401]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(SQ <"//p:BUILD">)})
            (C {(assert_equals)} {(DQ (1))} 
              {
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(wc)} {(-l)} {(DQ ($ VSub_Name "$TEST_log"))})]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [1426 1434]
                )
              }
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("exports_files(glob(['*.txt', '*/*.txt']))"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/BUILD)} spids:[1448])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"p:*">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1460]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(SQ <"//p:t1\\.txt">)})
            (C {(expect_log)} {(SQ <"//p:dir/t2\\.txt">)})
            (C {(expect_log)} {(SQ <"//p:BUILD">)})
            (C {(expect_not_log)} {(SQ <"t3\\.txt">)})
            (C {(assert_equals)} {(DQ (3))} 
              {
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(wc)} {(-l)} {(DQ ($ VSub_Name "$TEST_log"))})]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [1506 1514]
                )
              }
            )
          ]
          spids: [1161]
        )
      spids: [1155 1160]
    )
    (FuncDef
      name: test_glob_with_subpackage2
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [
                (C {(mkdir)} {(-p)} {(p/q/subpkg)})
                (C {(fail)} {(DQ ("mkdir p/q/subpkg failed"))})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(p/q/dir)}) (C {(fail)} {(DQ ("mkdir p/q/dir failed"))})]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("exports_files(glob(['**/*.txt']))"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/q/BUILD)} spids:[1565])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ("# Empty"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/q/subpkg/BUILD)} spids:[1575])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (p/q/t1.txt))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/q/t1.txt)} spids:[1586])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (p/q/dir/t2.txt))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/q/dir/t2.txt)} spids:[1597])]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (p/q/subpkg/t3.txt))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(p/q/subpkg/t3.txt)} spids:[1608])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"p/q:*">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_Great
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1622]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(SQ <"//p/q:t1\\.txt">)})
            (C {(expect_log)} {(SQ <"//p/q:dir/t2\\.txt">)})
            (C {(expect_log)} {(SQ <"//p/q:BUILD">)})
            (C {(expect_not_log)} {(SQ <"t3\\.txt">)})
            (C {(assert_equals)} {(DQ (3))} 
              {
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [(C {(wc)} {(-l)} {(DQ ($ VSub_Name "$TEST_log"))})]
                    )
                  left_token: <Left_CommandSub "$(">
                  spids: [1668 1676]
                )
              }
            )
          ]
          spids: [1525]
        )
      spids: [1519 1524]
    )
    (FuncDef
      name: test_glob_with_io_error
      body: 
        (BraceGroup
          children: [
            (C {(mkdir)} {(-p)} {(t/u)})
            (C {(touch)} {(t/u/v)})
            (SimpleCommand
              words: [{(echo)} {(DQ ("filegroup(name='t', srcs=glob(['u/*']))"))}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(t/BUILD)} spids:[1709])]
            )
            (C {(chmod)} {(000)} {(t/u)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"//t:*">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1730]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(SQ <"error globbing.*Permission denied">)})
            (C {(chmod)} {(755)} {(t/u)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"//t:*">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1766]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_not_log)} {(SQ <"error globbing.*Permission denied">)})
            (C {(expect_log)} {(SQ <"//t:u">)})
            (C {(expect_log)} {(SQ <"//t:u/v">)})
          ]
          spids: [1687]
        )
      spids: [1681 1686]
    )
    (FuncDef
      name: test_build_file_symlinks
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [(C {(mkdir)} {(b)}) (C {(fail)} {(DQ ("couldn't make b"))})]
              op_id: Op_DPipe
            )
            (AndOr
              children: [(C {(ln)} {(-s)} {(b)} {(a)}) (C {(fail)} {(DQ ("couldn't link a to b"))})]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(a) (Lit_Other ":") (all)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1850]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("no such package 'a'"))})
            (C {(touch)} {(b/BUILD)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(a) (Lit_Other ":") (all)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1884]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("Empty results"))})
            (AndOr
              children: [(C {(unlink)} {(a)}) (C {(fail)} {(DQ ("couldn't unlink a"))})]
              op_id: Op_DPipe
            )
            (C {(ln)} {(-s)} {(c)} {(a)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(a) (Lit_Other ":") (all)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1935]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("no such package 'a'"))})
            (AndOr
              children: [(C {(mkdir)} {(c)}) (C {(fail)} {(DQ ("couldn't make c"))})]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (C {(ln)} {(-s)} {(foo)} {(c/BUILD)})
                (C {(DQ ("couldn't link c/BUILD to c/foo"))})
              ]
              op_id: Op_DPipe
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(a) (Lit_Other ":") (all)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [1992]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("no such package 'a'"))})
            (C {(touch)} {(c/foo)})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(a) (Lit_Other ":") (all)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2026]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("Empty results"))})
          ]
          spids: [1808]
        )
      spids: [1802 1807]
    )
    (FuncDef
      name: test_visibility_edge_causes_cycle
      body: 
        (BraceGroup
          children: [
            (AndOr
              children: [(C {(mkdir)} {(-p)} {(a)} {(b)}) (C {(fail)} {(DQ ("mkdir failed"))})]
              op_id: Op_DPipe
            )
            (SimpleCommand
              words: [{(echo)} {(SQ <"sh_library(name=\"a\", visibility=[\"//b\"])">)}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(a/BUILD)} spids:[2080])]
            )
            (SimpleCommand
              words: [{(echo)} {(SQ <"sh_library(name=\"b\", deps=[\"//a\"])">)}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(b/BUILD)} spids:[2091])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"deps(//a)">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2104]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("cycle in dependency graph"))})
            (C {(expect_log)} {(DQ ("The cycle is caused by a visibility edge"))})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"deps(//b)">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2139]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected failure"))})
              ]
              op_id: Op_DAmp
            )
            (C {(expect_log)} {(DQ ("cycle in dependency graph"))})
            (C {(expect_log)} {(DQ ("The cycle is caused by a visibility edge"))})
            (SimpleCommand
              words: [{(echo)} {(SQ <"sh_library(name=\"a\", visibility=[\"//b:__pkg__\"])">)}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(a/BUILD)} spids:[2172])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"deps(//a)">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2185]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("//a:a"))})
            (C {(expect_not_log)} {(DQ ("//b:b"))})
            (AndOr
              children: [
                (SimpleCommand
                  words: [{(bazel)} {(query)} {(SQ <"deps(//b)">)}]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2220]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("//a:a"))})
            (C {(expect_log)} {(DQ ("//b:b"))})
          ]
          spids: [2054]
        )
      spids: [2048 2053]
    )
    (FuncDef
      name: test_incremental_deleting_package_roots
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:other_root)
                  op: Equal
                  rhs: {($ VSub_Name "$TEST_TMPDIR") (/other_root/) (${ VSub_Name WORKSPACE_NAME)}
                  spids: [2266]
                )
              ]
              spids: [2264]
            )
            (C {(mkdir)} {(-p)} {($ VSub_Name "$other_root") (/a)})
            (C {(touch)} {($ VSub_Name "$other_root") (/WORKSPACE)})
            (SimpleCommand
              words: [{(echo)} {(SQ <"sh_library(name=\"external\")">)}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: -1
                  arg_word: {($ VSub_Name "$other_root") (/a/BUILD)}
                  spids: [2294]
                )
              ]
            )
            (C {(mkdir)} {(-p)} {(a)})
            (SimpleCommand
              words: [{(echo)} {(SQ <"sh_library(name=\"internal\")">)}]
              redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(a/BUILD)} spids:[2313])]
            )
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(bazel)}
                    {(query)}
                    {(--package_path) (Lit_Other "=") ($ VSub_Name "$other_root") (Lit_Other ":") (.)}
                    {(a) (Lit_Other ":") (all)}
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2333]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("//a:external"))})
            (C {(expect_not_log)} {(DQ ("//a:internal"))})
            (C {(rm)} {(-r)} {($ VSub_Name "$other_root")})
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(bazel)}
                    {(query)}
                    {(--package_path) (Lit_Other "=") ($ VSub_Name "$other_root") (Lit_Other ":") (.)}
                    {(a) (Lit_Other ":") (all)}
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2383]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("//a:internal"))})
            (C {(expect_not_log)} {(DQ ("//a:external"))})
            (C {(mkdir)} {(-p)} {($ VSub_Name "$other_root")})
            (AndOr
              children: [
                (SimpleCommand
                  words: [
                    {(bazel)}
                    {(query)}
                    {(--package_path) (Lit_Other "=") ($ VSub_Name "$other_root") (Lit_Other ":") (.)}
                    {(a) (Lit_Other ":") (all)}
                  ]
                  redirects: [
                    (Redir
                      op_id: Redir_GreatAnd
                      fd: -1
                      arg_word: {($ VSub_Name "$TEST_log")}
                      spids: [2433]
                    )
                  ]
                )
                (C {(fail)} {(DQ ("Expected success"))})
              ]
              op_id: Op_DPipe
            )
            (C {(expect_log)} {(DQ ("//a:internal"))})
            (C {(expect_not_log)} {(DQ ("//a:external"))})
          ]
          spids: [2261]
        )
      spids: [2255 2260]
    )
    (C {(run_suite)} 
      {
        (DQ ("Integration tests of ") (${ VSub_Name PRODUCT_NAME) (" using loading/analysis phases."))
      }
    )
  ]
)