Skip to content

Commit

Permalink
chore(test): add the option to skip packages (#7286)
Browse files Browse the repository at this point in the history
* chore(test): add the option to skip packages

* fixing pkg in has

* fixing has function
  • Loading branch information
aman-bansal authored Jan 13, 2021
1 parent 1707ecf commit c9e54b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion t/t.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ var (
downloadResources = pflag.BoolP("download", "d", true,
"Flag to specify whether to download resources or not")
race = pflag.Bool("race", false, "Set true to build with race")
skip = pflag.String("skip", "",
"comma separated list of packages that needs to be skipped. "+
"Package Check uses string.Contains(). Please check the flag carefully")
)

func commandWithContext(ctx context.Context, args ...string) *exec.Cmd {
Expand Down Expand Up @@ -427,14 +430,16 @@ func composeFileFor(pkg string) string {
func getPackages() []task {
has := func(list []string, in string) bool {
for _, l := range list {
if strings.Contains(in, l) {
if len(l) > 0 && strings.Contains(in, l) {
return true
}
}
return false
}

slowPkgs := []string{"systest", "ee/acl", "cmd/alpha", "worker", "e2e"}
skipPkgs := strings.Split(*skip, ",")

moveSlowToFront := func(list []task) []task {
// These packages typically take over a minute to run.
left := 0
Expand Down Expand Up @@ -485,6 +490,11 @@ func getPackages() []task {
continue
}

if has(skipPkgs, pkg.ID) {
fmt.Printf("Skipping pacakge %s as its available in skip list \n", pkg.ID)
continue
}

fname := composeFileFor(pkg.ID)
_, err := os.Stat(fname)
t := task{pkg: pkg, isCommon: os.IsNotExist(err)}
Expand Down

0 comments on commit c9e54b9

Please sign in to comment.