Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.



    View Source
    const (
    	RemoteCros              = "cros"
    	RemoteCrosInternal      = "cros-internal"
    	ProjectManifest         = "manifest"
    	ProjectManifestInternal = "manifest-internal"


    View Source
    var (
    	DefaultRemotes = []repo.Remote{
    		{Name: RemoteCros},
    		{Name: RemoteCrosInternal},
    	DefaultVersionProject = repo.Project{
    		Name:       "chromiumos-overlay/overlays/chromiumos-overlay",
    		Path:       "src/third_party/chromiumos-overlay",
    		RemoteName: RemoteCros,
    	DefaultManifestProject = repo.Project{
    		Name:       "chromiumos/" + ProjectManifest,
    		Path:       ProjectManifest,
    		RemoteName: RemoteCros,
    	DefaultManifestInternalProject = repo.Project{
    		Name:       "chromiumos/" + ProjectManifestInternal,
    		Path:       ProjectManifestInternal,
    		RemoteName: RemoteCrosInternal,
    	DefaultProjects = []repo.Project{
    	// Default config for a CrOS repo harness.
    	DefaultCrosHarnessConfig = CrosRepoHarnessConfig{
    		Manifest: repo.Manifest{
    			Projects: DefaultProjects,
    			Remotes:  DefaultRemotes,
    			Default: repo.Default{
    				RemoteName: RemoteCros,
    				Revision:   "refs/heads/main",
    		VersionProject: DefaultVersionProject.Name,


    func AssertNoDefaultRevisions

    func AssertNoDefaultRevisions(manifest repo.Manifest) error

      AssertNoDefaultRevisions asserts that the given manifest has no default revisions.


      type CrosRepoHarness

      type CrosRepoHarness struct {
      	Harness rh.RepoHarness
      	// contains filtered or unexported fields

      func (*CrosRepoHarness) AssertCommentsPersist

      func (r *CrosRepoHarness) AssertCommentsPersist(
      	project rh.RemoteProject, branch string, sourceManifestFiles map[string]string) error

        AssertCommentsPersist asserts that the comments from the source manifests (i.e. the manifests of the source branch) persist in the new branch.

        func (*CrosRepoHarness) AssertCrosBranchFromManifest

        func (r *CrosRepoHarness) AssertCrosBranchFromManifest(manifest repo.Manifest, branch string, sourceBranch string) error

          AssertCrosBranchFromManifest asserts that the specified CrOS branch descends from the given manifest. sourceBranch should be set if branch was the result of a branch rename.

          func (*CrosRepoHarness) AssertCrosBranches

          func (r *CrosRepoHarness) AssertCrosBranches(branches []string) error

            AssertCrosBranches asserts that remote projects have the expected chromiumos branches.

            func (*CrosRepoHarness) AssertCrosBranchesMissing

            func (r *CrosRepoHarness) AssertCrosBranchesMissing(branches []string) error

              AssertCrosBranchesMissing asserts that the specified chromium branch does not exist in any projects.

              func (*CrosRepoHarness) AssertCrosVersion

              func (r *CrosRepoHarness) AssertCrosVersion(branch string, version mv.VersionInfo) error

                AssertCrosVersion asserts that has the expected version numbers.

                func (*CrosRepoHarness) AssertManifestProjectRepaired

                func (r *CrosRepoHarness) AssertManifestProjectRepaired(
                	project rh.RemoteProject, branch string, manifestFiles []string) error

                  AssertManifestProjectRepaired asserts that the specified manifest XML files in the specified branch of a project were repaired. This function assumes that r.Harness.SyncLocalCheckout() has just been run.

                  func (*CrosRepoHarness) AssertMinimalManifestChanges

                  func (r *CrosRepoHarness) AssertMinimalManifestChanges(
                  	project rh.RemoteProject, branch string, expectedManifestFiles map[string]string) error

                    AssertMinimalManifestChanges asserts that the manifests in project/branch exactly match the expected contents with three exceptions: 1. Ignore whitespace. 2. Ignore revision attributes (which are checked in other tests). 3. Ignore fetch attributes (which are just mock values in the test harness). 4. Ignore upstream attributes (doing so makes branch_util_test.go cleaner and they aren't really relevant anyways)

                    func (*CrosRepoHarness) AssertProjectRevisionsMatchBranch

                    func (r *CrosRepoHarness) AssertProjectRevisionsMatchBranch(manifest repo.Manifest, branch, sourceBranch string) error

                      AssertProjectRevisionsMatchBranch asserts that the project revisions match the given CrOS branch.

                      func (*CrosRepoHarness) GetRecentRemoteSnapshot

                      func (r *CrosRepoHarness) GetRecentRemoteSnapshot(remote string) (string, error)

                        GetRecentRemoteSnapshot returns the path of the most recent snapshot for a particular remote.

                        func (*CrosRepoHarness) Initialize

                        func (r *CrosRepoHarness) Initialize(config *CrosRepoHarnessConfig) error

                        func (*CrosRepoHarness) SetVersion

                        func (r *CrosRepoHarness) SetVersion(branch string, version mv.VersionInfo) error

                          SetVersion sets the version file contents for the specified branch. If branch is not set, will use the version project's revision.

                          func (*CrosRepoHarness) TakeSnapshot

                          func (r *CrosRepoHarness) TakeSnapshot() error

                            TakeSnapshot takes a snapshot of the current state of each remote and stores them within the harness struct.

                            func (*CrosRepoHarness) Teardown

                            func (r *CrosRepoHarness) Teardown() error

                            type CrosRepoHarnessConfig

                            type CrosRepoHarnessConfig struct {
                            	// Initialize() will create a test harness with
                            	// the appropriate remote repos and a local repo.
                            	// Both remote and local repos will have the appropriate
                            	// projects created (with initialized git repos inside them).
                            	Manifest repo.Manifest
                            	// Version info project name. Should exist in Manifest.
                            	VersionProject string

                            Source Files