(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'Clone repositories and store files in Mock LFS'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./lib-git-p4.sh'>})
    (command.ShFunction
      name: test_file_is_not_in_mock_lfs
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:FILE)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$1'))}
                      spids: [23]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:CONTENT)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$2'))}
                      spids: [31]
                    )
                  ]
                )
                (command.Simple
                  words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$CONTENT'))}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<expect_content>}
                    )
                  ]
                  do_fork: T
                )
                (C {<test_path_is_file>} {(DQ ($ Id.VSub_DollarName '$FILE'))})
                (C {<test_cmp>} {<expect_content>} {(DQ ($ Id.VSub_DollarName '$FILE'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_file_is_in_mock_lfs
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
              ]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:FILE)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$1'))}
                      spids: [79]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:CONTENT)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$2'))}
                      spids: [87]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:LOCAL_STORAGE)
                      op: assign_op.Equal
                      rhs: {(DQ <'.git/mock-storage/local/'> ($ Id.VSub_DollarName '$CONTENT'))}
                      spids: [95]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:SERVER_STORAGE)
                      op: assign_op.Equal
                      rhs: {(DQ <'.git/mock-storage/remote/'> ($ Id.VSub_DollarName '$CONTENT'))}
                      spids: [104]
                    )
                  ]
                )
                (command.Simple
                  words: [{<echo>} {(DQ <pointer-> ($ Id.VSub_DollarName '$CONTENT'))}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<expect_pointer>}
                    )
                  ]
                  do_fork: T
                )
                (command.Simple
                  words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$CONTENT'))}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<expect_content>}
                    )
                  ]
                  do_fork: T
                )
                (C {<test_path_is_file>} {(DQ ($ Id.VSub_DollarName '$FILE'))})
                (C {<test_path_is_file>} {(DQ ($ Id.VSub_DollarName '$LOCAL_STORAGE'))})
                (C {<test_path_is_file>} {(DQ ($ Id.VSub_DollarName '$SERVER_STORAGE'))})
                (C {<test_cmp>} {<expect_pointer>} {(DQ ($ Id.VSub_DollarName '$FILE'))})
                (C {<test_cmp>} {<expect_content>} {(DQ ($ Id.VSub_DollarName '$LOCAL_STORAGE'))})
                (C {<test_cmp>} {<expect_content>} {(DQ ($ Id.VSub_DollarName '$SERVER_STORAGE'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_file_is_deleted_in_mock_lfs
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
                Id.Op_DAmp
              ]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:FILE)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$1'))}
                      spids: [206]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:CONTENT)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$2'))}
                      spids: [214]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:LOCAL_STORAGE)
                      op: assign_op.Equal
                      rhs: {(DQ <'.git/mock-storage/local/'> ($ Id.VSub_DollarName '$CONTENT'))}
                      spids: [222]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:SERVER_STORAGE)
                      op: assign_op.Equal
                      rhs: {(DQ <'.git/mock-storage/remote/'> ($ Id.VSub_DollarName '$CONTENT'))}
                      spids: [231]
                    )
                  ]
                )
                (command.Simple
                  words: [{<echo>} {(DQ <pointer-> ($ Id.VSub_DollarName '$CONTENT'))}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<expect_pointer>}
                    )
                  ]
                  do_fork: T
                )
                (command.Simple
                  words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$CONTENT'))}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<expect_content>}
                    )
                  ]
                  do_fork: T
                )
                (C {<test_path_is_missing>} {(DQ ($ Id.VSub_DollarName '$FILE'))})
                (C {<test_path_is_file>} {(DQ ($ Id.VSub_DollarName '$LOCAL_STORAGE'))})
                (C {<test_path_is_file>} {(DQ ($ Id.VSub_DollarName '$SERVER_STORAGE'))})
                (C {<test_cmp>} {<expect_content>} {(DQ ($ Id.VSub_DollarName '$LOCAL_STORAGE'))})
                (C {<test_cmp>} {<expect_content>} {(DQ ($ Id.VSub_DollarName '$SERVER_STORAGE'))})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_file_count_in_dir
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:DIR)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$1'))}
                      spids: [322]
                    )
                  ]
                )
                (command.ShAssignment
                  pairs: [
                    (assign_pair
                      lhs: (sh_lhs_expr.Name name:EXPECTED_COUNT)
                      op: assign_op.Equal
                      rhs: {(DQ ($ Id.VSub_Number '$2'))}
                      spids: [330]
                    )
                  ]
                )
                (command.Simple
                  words: [{<find>} {(DQ ($ Id.VSub_DollarName '$DIR'))} {<-type>} {<f>}]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})]
                  do_fork: T
                )
                (C {<test_line_count>} {<Id.Lit_Equals '='>} {($ Id.VSub_DollarName '$EXPECTED_COUNT')} 
                  {<actual>}
                )
              ]
            )
          ]
        )
    )
    (C {<test_expect_success>} {(SQ <'start p4d'>)} {(SQ <'\n'> <'\tstart_p4d\n'>)})
    (C {<test_expect_success>} {(SQ <'Create repo with binary files'>)} 
      {
        (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> 
          <'\n'> <'\t\techo "content 1 txt 23 bytes" >file1.txt &&\n'> <'\t\tp4 add file1.txt &&\n'> 
          <'\t\techo "content 2-3 bin 25 bytes" >file2.dat &&\n'> <'\t\tp4 add file2.dat &&\n'> <'\t\tp4 submit -d "Add text and binary file" &&\n'> <'\n'> 
          <'\t\tmkdir "path with spaces" &&\n'> <'\t\techo "content 2-3 bin 25 bytes" >"path with spaces/file3.bin" &&\n'> 
          <'\t\tp4 add "path with spaces/file3.bin" &&\n'> <'\t\tp4 submit -d "Add another binary file with same content and spaces in path" &&\n'> <'\n'> 
          <'\t\techo "content 4 bin 26 bytes XX" >file4.bin &&\n'> <'\t\tp4 add file4.bin &&\n'> <'\t\tp4 submit -d "Add another binary file with different content"\n'> 
          <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Store files in Mock LFS based on size (>24 bytes)'>)} 
      {
        (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> 
          <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> 
          <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem MockLFS &&\n'> 
          <'\t\tgit config git-p4.largeFileThreshold 24 &&\n'> <'\t\tgit config git-p4.largeFilePush True &&\n'> 
          <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&\n'> 
          <'\t\ttest_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_is_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&\n'> 
          <'\t\ttest_file_is_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&\n'> <'\n'> <'\t\ttest_file_count_in_dir ".git/mock-storage/local" 2 &&\n'> 
          <'\t\ttest_file_count_in_dir ".git/mock-storage/remote" 2\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Store files in Mock LFS based on extension (dat)'>)} 
      {
        (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> 
          <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> 
          <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem MockLFS &&\n'> 
          <'\t\tgit config git-p4.largeFileExtensions dat &&\n'> <'\t\tgit config git-p4.largeFilePush True &&\n'> 
          <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&\n'> 
          <'\t\ttest_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_is_not_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&\n'> 
          <'\t\ttest_file_is_not_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&\n'> <'\n'> <'\t\ttest_file_count_in_dir ".git/mock-storage/local" 1 &&\n'> 
          <'\t\ttest_file_count_in_dir ".git/mock-storage/remote" 1\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {
        (SQ 
          <
'Store files in Mock LFS based on extension (dat) and use git p4 sync and no client spec'
          >
        )
      } 
      {
        (SQ <'\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> 
          <'\t\tgit init &&\n'> <'\t\tgit config git-p4.useClientSpec true &&\n'> 
          <'\t\tgit config git-p4.largeFileSystem MockLFS &&\n'> <'\t\tgit config git-p4.largeFileExtensions dat &&\n'> 
          <'\t\tgit config git-p4.largeFilePush True &&\n'> <'\t\tgit p4 sync //depot &&\n'> <'\t\tgit checkout p4/master &&\n'> <'\n'> 
          <'\t\ttest_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&\n'> <'\t\ttest_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&\n'> 
          <
'\t\ttest_file_is_not_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&\n'
          > <'\t\ttest_file_is_not_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&\n'> <'\n'> 
          <'\t\ttest_file_count_in_dir ".git/mock-storage/local" 1 &&\n'> <'\t\ttest_file_count_in_dir ".git/mock-storage/remote" 1\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} 
      {(SQ <'Remove file from repo and store files in Mock LFS based on size (>24 bytes)'>)} 
      {
        (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> <'\t(\n'> <'\t\tcd "$cli" &&\n'> 
          <'\t\tp4 delete file4.bin &&\n'> <'\t\tp4 submit -d "Remove file"\n'> <'\t) &&\n'> <'\n'> 
          <'\tclient_view "//depot/... //client/..." &&\n'> <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> 
          <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem MockLFS &&\n'> 
          <'\t\tgit config git-p4.largeFileThreshold 24 &&\n'> <'\t\tgit config git-p4.largeFilePush True &&\n'> 
          <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&\n'> 
          <'\t\ttest_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&\n'> <'\t\ttest_file_is_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&\n'> 
          <'\t\ttest_file_is_deleted_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&\n'> <'\n'> <'\t\ttest_file_count_in_dir ".git/mock-storage/local" 2 &&\n'> 
          <'\t\ttest_file_count_in_dir ".git/mock-storage/remote" 2\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'Run git p4 submit in repo configured with large file system'>)} 
      {
        (SQ <'\n'> <'\tclient_view "//depot/... //client/..." &&\n'> 
          <'\ttest_when_finished cleanup_git &&\n'> <'\t(\n'> <'\t\tcd "$git" &&\n'> <'\t\tgit init . &&\n'> 
          <'\t\tgit config git-p4.useClientSpec true &&\n'> <'\t\tgit config git-p4.largeFileSystem MockLFS &&\n'> 
          <'\t\tgit config git-p4.largeFileThreshold 24 &&\n'> <'\t\tgit config git-p4.largeFilePush True &&\n'> 
          <'\t\tgit p4 clone --destination="$git" //depot@all &&\n'> <'\n'> <'\t\ttest_must_fail git p4 submit\n'> <'\t)\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'kill p4d'>)} {(SQ <'\n'> <'\tkill_p4d\n'>)})
    (C {<test_done>})
  ]
)