From 9665073e8ed8a3a5f34fd95064fbe9b8c135719e Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Wed, 7 Feb 2018 16:16:53 +0800 Subject: [PATCH] vendor: update pingcap check (#5812) --- _vendor/src/github.com/pingcap/check/check.go | 16 +++++++++++++++- _vendor/src/github.com/pingcap/check/checkers.go | 2 +- _vendor/src/github.com/pingcap/check/run.go | 2 ++ glide.lock | 2 +- glide.yaml | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/_vendor/src/github.com/pingcap/check/check.go b/_vendor/src/github.com/pingcap/check/check.go index c9485e70447de..fc535bc38fa0e 100644 --- a/_vendor/src/github.com/pingcap/check/check.go +++ b/_vendor/src/github.com/pingcap/check/check.go @@ -534,6 +534,7 @@ type RunConf struct { BenchmarkTime time.Duration // Defaults to 1 second BenchmarkMem bool KeepWorkDir bool + Exclude string } // Create a new suiteRunner able to run all methods in the given suite. @@ -578,6 +579,17 @@ func newSuiteRunner(suite interface{}, runConf *RunConf) *suiteRunner { } } + var excludeRegexp *regexp.Regexp + if conf.Exclude != "" { + if regexp, err := regexp.Compile(conf.Exclude); err != nil { + msg := "Bad exclude expression: " + err.Error() + runner.tracker.result.RunError = errors.New(msg) + return runner + } else { + excludeRegexp = regexp + } + } + for i := 0; i != suiteNumMethods; i++ { method := newMethod(suiteValue, i) switch method.Info.Name { @@ -598,7 +610,9 @@ func newSuiteRunner(suite interface{}, runConf *RunConf) *suiteRunner { continue } if filterRegexp == nil || method.matches(filterRegexp) { - runner.tests = append(runner.tests, method) + if excludeRegexp == nil || !method.matches(excludeRegexp) { + runner.tests = append(runner.tests, method) + } } } } diff --git a/_vendor/src/github.com/pingcap/check/checkers.go b/_vendor/src/github.com/pingcap/check/checkers.go index bac338729c887..3749545873763 100644 --- a/_vendor/src/github.com/pingcap/check/checkers.go +++ b/_vendor/src/github.com/pingcap/check/checkers.go @@ -212,7 +212,7 @@ type hasLenChecker struct { // The HasLen checker verifies that the obtained value has the // provided length. In many cases this is superior to using Equals -// in conjuction with the len function because in case the check +// in conjunction with the len function because in case the check // fails the value itself will be printed, instead of its length, // providing more details for figuring the problem. // diff --git a/_vendor/src/github.com/pingcap/check/run.go b/_vendor/src/github.com/pingcap/check/run.go index bf0d65ac9e54e..afa631f470484 100644 --- a/_vendor/src/github.com/pingcap/check/run.go +++ b/_vendor/src/github.com/pingcap/check/run.go @@ -42,6 +42,7 @@ var ( newBenchMem = flag.Bool("check.bmem", false, "Report memory benchmarks") newListFlag = flag.Bool("check.list", false, "List the names of all tests that will be run") newWorkFlag = flag.Bool("check.work", false, "Display and do not remove the test working directory") + newExcludeFlag = flag.String("check.exclude", "", "Regular expression to exclude tests to run") ) var CustomVerboseFlag bool @@ -62,6 +63,7 @@ func TestingT(testingT *testing.T) { BenchmarkTime: benchTime, BenchmarkMem: *newBenchMem, KeepWorkDir: *oldWorkFlag || *newWorkFlag, + Exclude: *newExcludeFlag, } if *oldListFlag || *newListFlag { w := bufio.NewWriter(os.Stdout) diff --git a/glide.lock b/glide.lock index b7089c11e5f04..9a96290bc6e38 100644 --- a/glide.lock +++ b/glide.lock @@ -103,7 +103,7 @@ imports: - name: github.com/peterh/liner version: 3f3a91ddf7d2784892a58e27ddf48d70e3304bb7 - name: github.com/pingcap/check - version: 9b266636177e249ec28b0aeffe8e86bc272bb481 + version: 1c287c953996ab3a0bf535dba9d53d809d3dc0b6 - name: github.com/pingcap/goleveldb version: 8d44bfdf1030639ae7130922c95df12d6d4da3b6 subpackages: diff --git a/glide.yaml b/glide.yaml index b80a8b1e2236e..604d60e7a4156 100644 --- a/glide.yaml +++ b/glide.yaml @@ -49,7 +49,7 @@ import: - package: github.com/peterh/liner version: 3f3a91ddf7d2784892a58e27ddf48d70e3304bb7 - package: github.com/pingcap/check - version: 9b266636177e249ec28b0aeffe8e86bc272bb481 + version: 1c287c953996ab3a0bf535dba9d53d809d3dc0b6 - package: github.com/pingcap/goleveldb version: 8d44bfdf1030639ae7130922c95df12d6d4da3b6 subpackages: