Skip to content

Commit

Permalink
setup bridge between test infras
Browse files Browse the repository at this point in the history
Signed-off-by: tison <wander4096@gmail.com>
  • Loading branch information
tisonkun committed Jul 9, 2021
1 parent 95e8cf9 commit 2fd97fe
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ task GoTest BuildFailPoint, {
}
$env:log_level = 'fatal'
$env:TZ = 'Asia/Shanghai'
exec { & $GO test -p $P -ldflags "`"$testFlags`"" -cover $packages '-check.p' true '-check.timeout' 4s }
exec { & $GO test -p $P -ldflags "`"$testFlags`"" -cover $packages '-check.p' true '-check.timeout' 4s '-timeout' 4s }
} -Done {
Disable-FailPoint
$env:log_level = $Task.Data.logLevel
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ ifeq ("$(TRAVIS_COVERAGE)", "1")
else
@echo "Running in native mode."
@export log_level=info; export TZ='Asia/Shanghai'; \
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' $(EXTRA_TEST_ARGS) -cover $(PACKAGES) -check.p true -check.timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' $(EXTRA_TEST_ARGS) -cover $(PACKAGES) -check.p true -check.timeout 4s -timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
endif
@$(FAILPOINT_DISABLE)

Expand Down Expand Up @@ -259,7 +259,7 @@ ifeq ("$(pkg)", "")
else
@echo "Running unit test for github.com/pingcap/tidb/$(pkg)"
@export log_level=fatal; export TZ='Asia/Shanghai'; \
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover github.com/pingcap/tidb/$(pkg) -check.p true -check.timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover github.com/pingcap/tidb/$(pkg) -check.p true -check.timeout 4s -timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
endif
@$(FAILPOINT_DISABLE)

Expand Down
1 change: 1 addition & 0 deletions errno/infoschema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package errno
import (
"testing"

_ "github.com/pingcap/tidb/util/testbridge"
"github.com/stretchr/testify/assert"
)

Expand Down
25 changes: 25 additions & 0 deletions util/testbridge/bridge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2021 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !codes

package testbridge

import (
"flag"
)

var (
_ = flag.Duration("check.timeout", 0, "timeout value for each function")
_ = flag.Bool("check.p", false, "Run suites in parallel")
)

0 comments on commit 2fd97fe

Please sign in to comment.