mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
Merge pull request #916 from gzliudan/quick-test
build: add command `make quick-test` to save test time
This commit is contained in:
commit
95c7b224af
3 changed files with 16 additions and 7 deletions
4
Makefile
4
Makefile
|
|
@ -54,6 +54,10 @@ all:
|
|||
test: all
|
||||
go run build/ci.go test
|
||||
|
||||
#? quick-test: Run the tests except time-consuming tests.
|
||||
quick-test: all
|
||||
go run build/ci.go test --quick
|
||||
|
||||
#? lint: Run certain pre-selected linters.
|
||||
lint: ## Run linters.
|
||||
$(GORUN) build/ci.go lint
|
||||
|
|
|
|||
|
|
@ -219,10 +219,10 @@ func goToolArch(arch string, cc string, subcmd string, args ...string) *exec.Cmd
|
|||
// Running The Tests
|
||||
//
|
||||
// "tests" also includes static analysis tools such as vet.
|
||||
|
||||
func doTest(cmdline []string) {
|
||||
coverage := flag.Bool("coverage", false, "Whether to record code coverage")
|
||||
verbose := flag.Bool("v", false, "Whether to log verbosely")
|
||||
quick := flag.Bool("quick", false, "Whether to skip long time test")
|
||||
flag.CommandLine.Parse(cmdline)
|
||||
env := build.Env()
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ func doTest(cmdline []string) {
|
|||
packages = flag.CommandLine.Args()
|
||||
} else {
|
||||
// added all files in all packages (except vendor) to coverage report files count, even there is no test file in the package
|
||||
packages = build.ExpandPackagesNoVendor(packages)
|
||||
packages = build.ExpandPackages(packages, *quick)
|
||||
}
|
||||
|
||||
// Run analysis tools before the tests.
|
||||
|
|
|
|||
|
|
@ -136,9 +136,9 @@ func GoTool(tool string, args ...string) *exec.Cmd {
|
|||
return exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), args...)
|
||||
}
|
||||
|
||||
// ExpandPackagesNoVendor expands a cmd/go import path pattern, skipping
|
||||
// vendored packages.
|
||||
func ExpandPackagesNoVendor(patterns []string) []string {
|
||||
// ExpandPackages expands a cmd/go import path pattern, skip vendor
|
||||
// packages, and skip time-consuming tests according to quick flag.
|
||||
func ExpandPackages(patterns []string, quick bool) []string {
|
||||
expand := false
|
||||
for _, pkg := range patterns {
|
||||
if strings.Contains(pkg, "...") {
|
||||
|
|
@ -153,9 +153,14 @@ func ExpandPackagesNoVendor(patterns []string) []string {
|
|||
}
|
||||
var packages []string
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
if !strings.Contains(line, "/vendor/") {
|
||||
packages = append(packages, strings.TrimSpace(line))
|
||||
if strings.Contains(line, "/vendor/") {
|
||||
continue
|
||||
}
|
||||
if quick && strings.Contains(line, "/consensus/tests/engine_v2_tests") {
|
||||
continue
|
||||
}
|
||||
packages = append(packages, strings.TrimSpace(line))
|
||||
|
||||
}
|
||||
return packages
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue