syzkaller: github.com/google/syzkaller/pkg/vcs Index | Files

package vcs

import "github.com/google/syzkaller/pkg/vcs"

Package vcs provides helper functions for working with various repositories (e.g. git).

Index

Package Files

akaros.go freebsd.go fuchsia.go git.go git_test_util.go linux.go netbsd.go openbsd.go testos.go vcs.go

Constants

const SyzkallerRepo = "https://github.com/google/syzkaller"

func CanonicalizeCommit Uses

func CanonicalizeCommit(title string) string

CanonicalizeCommit returns commit title that can be used when checking if a particular commit is present in a git tree. Some trees add prefixes to commit titles during backporting, so we want e.g. commit "foo bar" match "BACKPORT: foo bar".

func CheckBranch Uses

func CheckBranch(branch string) bool

CheckBranch does a best-effort approximate check of a git branch name.

func CheckCommitHash Uses

func CheckCommitHash(hash string) bool

func CheckRepoAddress Uses

func CheckRepoAddress(repo string) bool

CheckRepoAddress does a best-effort approximate check of a git repo address.

func CommitLink(url, hash string) string
func LogLink(url, hash string) string

func Patch Uses

func Patch(dir string, patch []byte) error
func TreeLink(url, hash string) string

type BisectEnv Uses

type BisectEnv struct {
    Compiler     string
    KernelConfig []byte
}

type BisectResult Uses

type BisectResult int
const (
    BisectBad BisectResult = iota
    BisectGood
    BisectSkip
)

type Bisecter Uses

type Bisecter interface {
    // Bisect bisects good..bad commit range against the provided predicate (wrapper around git bisect).
    // The predicate should return an error only if there is no way to proceed
    // (it will abort the process), if possible it should prefer to return BisectSkip.
    // Progress of the process is streamed to the provided trace.
    // Returns the first commit on which the predicate returns BisectBad,
    // or multiple commits if bisection is inconclusive due to BisectSkip.
    Bisect(bad, good string, trace io.Writer, pred func() (BisectResult, error)) ([]*Commit, error)

    // PreviousReleaseTags returns list of preceding release tags that are reachable from the given commit.
    PreviousReleaseTags(commit string) ([]string, error)

    IsRelease(commit string) (bool, error)

    EnvForCommit(binDir, commit string, kernelConfig []byte) (*BisectEnv, error)
}

Bisecter may be optionally implemented by Repo.

type Commit Uses

type Commit struct {
    Hash       string
    Title      string
    Author     string
    AuthorName string
    CC         []string
    Tags       []string
    Parents    []string
    Date       time.Time
}

type Repo Uses

type Repo interface {
    // Poll checkouts the specified repository/branch.
    // This involves fetching/resetting/cloning as necessary to recover from all possible problems.
    // Returns hash of the HEAD commit in the specified branch.
    Poll(repo, branch string) (*Commit, error)

    // CheckoutBranch checkouts the specified repository/branch.
    CheckoutBranch(repo, branch string) (*Commit, error)

    // CheckoutCommit checkouts the specified repository on the specified commit.
    CheckoutCommit(repo, commit string) (*Commit, error)

    // SwitchCommit checkouts the specified commit without fetching.
    SwitchCommit(commit string) (*Commit, error)

    // HeadCommit returns info about the HEAD commit of the current branch of git repository.
    HeadCommit() (*Commit, error)

    // GetCommitByTitle finds commit info by the title.
    // Remote is not fetched, the commit needs to be reachable from the current repo state
    // (e.g. do CheckoutBranch before). If the commit is not found, nil is returned.
    GetCommitByTitle(title string) (*Commit, error)

    // GetCommitsByTitles is a batch version of GetCommitByTitle.
    // Returns list of commits and titles of commits that are not found.
    GetCommitsByTitles(titles []string) ([]*Commit, []string, error)

    // ListRecentCommits returns list of recent commit titles starting from baseCommit.
    ListRecentCommits(baseCommit string) ([]string, error)

    // ExtractFixTagsFromCommits extracts fixing tags for bugs from git log.
    // Given email = "user@domain.com", it searches for tags of the form "user+tag@domain.com"
    // and returns commits with these tags.
    ExtractFixTagsFromCommits(baseCommit, email string) ([]*Commit, error)
}

func NewRepo Uses

func NewRepo(os, vm, dir string) (Repo, error)

func NewSyzkallerRepo Uses

func NewSyzkallerRepo(dir string) Repo

type TestRepo Uses

type TestRepo struct {
    Dir string

    Commits map[string]map[string]*Commit
    // contains filtered or unexported fields
}

func CloneTestRepo Uses

func CloneTestRepo(t *testing.T, baseDir string, name string, originRepo *TestRepo) *TestRepo

func CreateTestRepo Uses

func CreateTestRepo(t *testing.T, baseDir, name string) *TestRepo

func MakeTestRepo Uses

func MakeTestRepo(t *testing.T, dir string) *TestRepo

func (*TestRepo) CommitChange Uses

func (repo *TestRepo) CommitChange(description string) *Commit

func (*TestRepo) CommitFileChange Uses

func (repo *TestRepo) CommitFileChange(branch, change string)

func (*TestRepo) Git Uses

func (repo *TestRepo) Git(args ...string)

func (*TestRepo) SetTag Uses

func (repo *TestRepo) SetTag(tag string)

func (*TestRepo) SupportsBisection Uses

func (repo *TestRepo) SupportsBisection() bool

Package vcs imports 18 packages (graph) and is imported by 9 packages. Updated 2019-12-12. Refresh now. Tools for package owners.