Remove blacklist from //test/runtimes
Updates #2972 PiperOrigin-RevId: 316534165
This commit is contained in:
parent
eb6d3d7710
commit
885605c5e4
|
@ -4,30 +4,30 @@ package(licenses = ["notice"])
|
|||
|
||||
runtime_test(
|
||||
name = "go1.12",
|
||||
blacklist_file = "blacklist_go1.12.csv",
|
||||
exclude_file = "exclude_go1.12.csv",
|
||||
lang = "go",
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "java11",
|
||||
blacklist_file = "blacklist_java11.csv",
|
||||
exclude_file = "exclude_java11.csv",
|
||||
lang = "java",
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "nodejs12.4.0",
|
||||
blacklist_file = "blacklist_nodejs12.4.0.csv",
|
||||
exclude_file = "exclude_nodejs12.4.0.csv",
|
||||
lang = "nodejs",
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "php7.3.6",
|
||||
blacklist_file = "blacklist_php7.3.6.csv",
|
||||
exclude_file = "exclude_php7.3.6.csv",
|
||||
lang = "php",
|
||||
)
|
||||
|
||||
runtime_test(
|
||||
name = "python3.7.3",
|
||||
blacklist_file = "blacklist_python3.7.3.csv",
|
||||
exclude_file = "exclude_python3.7.3.csv",
|
||||
lang = "python",
|
||||
)
|
||||
|
|
|
@ -10,10 +10,10 @@ def _runtime_test_impl(ctx):
|
|||
"--image",
|
||||
ctx.attr.image,
|
||||
]
|
||||
if ctx.attr.blacklist_file:
|
||||
if ctx.attr.exclude_file:
|
||||
args += [
|
||||
"--blacklist_file",
|
||||
ctx.files.blacklist_file[0].short_path,
|
||||
"--exclude_file",
|
||||
ctx.files.exclude_file[0].short_path,
|
||||
]
|
||||
|
||||
# Build a runner.
|
||||
|
@ -28,7 +28,7 @@ def _runtime_test_impl(ctx):
|
|||
return [DefaultInfo(
|
||||
executable = runner,
|
||||
runfiles = ctx.runfiles(
|
||||
files = ctx.files._runner + ctx.files.blacklist_file + ctx.files._proctor,
|
||||
files = ctx.files._runner + ctx.files.exclude_file + ctx.files._proctor,
|
||||
collect_default = True,
|
||||
collect_data = True,
|
||||
),
|
||||
|
@ -43,7 +43,7 @@ _runtime_test = rule(
|
|||
"lang": attr.string(
|
||||
mandatory = True,
|
||||
),
|
||||
"blacklist_file": attr.label(
|
||||
"exclude_file": attr.label(
|
||||
mandatory = False,
|
||||
allow_single_file = True,
|
||||
),
|
||||
|
@ -68,12 +68,12 @@ def runtime_test(name, **kwargs):
|
|||
**kwargs
|
||||
)
|
||||
|
||||
def blacklist_test(name, blacklist_file):
|
||||
"""Test that a blacklist parses correctly."""
|
||||
def exclude_test(name, exclude_file):
|
||||
"""Test that a exclude file parses correctly."""
|
||||
go_test(
|
||||
name = name + "_blacklist_test",
|
||||
name = name + "_exclude_test",
|
||||
library = ":runner",
|
||||
srcs = ["blacklist_test.go"],
|
||||
args = ["--blacklist_file", "test/runtimes/" + blacklist_file],
|
||||
data = [blacklist_file],
|
||||
srcs = ["exclude_test.go"],
|
||||
args = ["--exclude_file", "test/runtimes/" + exclude_file],
|
||||
data = [exclude_file],
|
||||
)
|
||||
|
|
|
@ -14,8 +14,8 @@ go_binary(
|
|||
)
|
||||
|
||||
go_test(
|
||||
name = "blacklist_test",
|
||||
name = "exclude_test",
|
||||
size = "small",
|
||||
srcs = ["blacklist_test.go"],
|
||||
srcs = ["exclude_test.go"],
|
||||
library = ":runner",
|
||||
)
|
||||
|
|
|
@ -25,13 +25,13 @@ func TestMain(m *testing.M) {
|
|||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
// Test that the blacklist parses without error.
|
||||
// Test that the exclude file parses without error.
|
||||
func TestBlacklists(t *testing.T) {
|
||||
bl, err := getBlacklist()
|
||||
ex, err := getExcludes()
|
||||
if err != nil {
|
||||
t.Fatalf("error parsing blacklist: %v", err)
|
||||
t.Fatalf("error parsing exclude file: %v", err)
|
||||
}
|
||||
if *blacklistFile != "" && len(bl) == 0 {
|
||||
t.Errorf("got empty blacklist for file %q", *blacklistFile)
|
||||
if *excludeFile != "" && len(ex) == 0 {
|
||||
t.Errorf("got empty excludes for file %q", *excludeFile)
|
||||
}
|
||||
}
|
|
@ -31,9 +31,9 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
lang = flag.String("lang", "", "language runtime to test")
|
||||
image = flag.String("image", "", "docker image with runtime tests")
|
||||
blacklistFile = flag.String("blacklist_file", "", "file containing blacklist of tests to exclude, in CSV format with fields: test name, bug id, comment")
|
||||
lang = flag.String("lang", "", "language runtime to test")
|
||||
image = flag.String("image", "", "docker image with runtime tests")
|
||||
excludeFile = flag.String("exclude_file", "", "file containing list of tests to exclude, in CSV format with fields: test name, bug id, comment")
|
||||
)
|
||||
|
||||
// Wait time for each test to run.
|
||||
|
@ -52,10 +52,10 @@ func main() {
|
|||
// defered functions before exiting. It returns an exit code that should be
|
||||
// passed to os.Exit.
|
||||
func runTests() int {
|
||||
// Get tests to blacklist.
|
||||
blacklist, err := getBlacklist()
|
||||
// Get tests to exclude..
|
||||
excludes, err := getExcludes()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error getting blacklist: %s\n", err.Error())
|
||||
fmt.Fprintf(os.Stderr, "Error getting exclude list: %s\n", err.Error())
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ func runTests() int {
|
|||
// Get a slice of tests to run. This will also start a single Docker
|
||||
// container that will be used to run each test. The final test will
|
||||
// stop the Docker container.
|
||||
tests, err := getTests(d, blacklist)
|
||||
tests, err := getTests(d, excludes)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err.Error())
|
||||
return 1
|
||||
|
@ -77,7 +77,7 @@ func runTests() int {
|
|||
}
|
||||
|
||||
// getTests executes all tests as table tests.
|
||||
func getTests(d *dockerutil.Docker, blacklist map[string]struct{}) ([]testing.InternalTest, error) {
|
||||
func getTests(d *dockerutil.Docker, excludes map[string]struct{}) ([]testing.InternalTest, error) {
|
||||
// Start the container.
|
||||
d.CopyFiles("/proctor", "test/runtimes/proctor/proctor")
|
||||
if err := d.Spawn(dockerutil.RunOpts{
|
||||
|
@ -108,9 +108,9 @@ func getTests(d *dockerutil.Docker, blacklist map[string]struct{}) ([]testing.In
|
|||
itests = append(itests, testing.InternalTest{
|
||||
Name: tc,
|
||||
F: func(t *testing.T) {
|
||||
// Is the test blacklisted?
|
||||
if _, ok := blacklist[tc]; ok {
|
||||
t.Skipf("SKIP: blacklisted test %q", tc)
|
||||
// Is the test excluded?
|
||||
if _, ok := excludes[tc]; ok {
|
||||
t.Skipf("SKIP: excluded test %q", tc)
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -143,14 +143,14 @@ func getTests(d *dockerutil.Docker, blacklist map[string]struct{}) ([]testing.In
|
|||
return itests, nil
|
||||
}
|
||||
|
||||
// getBlacklist reads the blacklist file and returns a set of test names to
|
||||
// getBlacklist reads the exclude file and returns a set of test names to
|
||||
// exclude.
|
||||
func getBlacklist() (map[string]struct{}, error) {
|
||||
blacklist := make(map[string]struct{})
|
||||
if *blacklistFile == "" {
|
||||
return blacklist, nil
|
||||
func getExcludes() (map[string]struct{}, error) {
|
||||
excludes := make(map[string]struct{})
|
||||
if *excludeFile == "" {
|
||||
return excludes, nil
|
||||
}
|
||||
f, err := os.Open(*blacklistFile)
|
||||
f, err := os.Open(*excludeFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -171,9 +171,9 @@ func getBlacklist() (map[string]struct{}, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
blacklist[record[0]] = struct{}{}
|
||||
excludes[record[0]] = struct{}{}
|
||||
}
|
||||
return blacklist, nil
|
||||
return excludes, nil
|
||||
}
|
||||
|
||||
// testDeps implements testing.testDeps (an unexported interface), and is
|
||||
|
|
Loading…
Reference in New Issue