-
Notifications
You must be signed in to change notification settings - Fork 9
/
defs.bzl
75 lines (67 loc) · 2.2 KB
/
defs.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
load(
"@rules_bazel_integration_test//bazel_integration_test:defs.bzl",
"bazel_integration_test",
"bazel_integration_tests",
"integration_test_utils",
)
_configs = ["bzlmod", "nobzlmod"]
def gen_name(name_prefix, bazel_binary_name, config):
return "{}_{}_{}".format(name_prefix, bazel_binary_name, config)
def gen_test_names(name_prefix, bazel_binaries, config):
return [
gen_name(name_prefix, bazel_binary_name, config)
for bazel_binary_name in bazel_binaries.keys()
]
def gen_test_names_each(name_prefixes, bazel_binaries):
result = []
for name_prefix in name_prefixes:
for config in _configs:
result += gen_test_names(name_prefix, bazel_binaries, config)
return result
def rules_elm_integration_test(
name,
workspace_path,
bazel_cmd,
expected_output,
test_runner,
**kwargs,
):
bazel_integration_test(
name = name,
test_runner = test_runner,
workspace_path = workspace_path,
workspace_files = integration_test_utils.glob_workspace_files(workspace_path) + [
"@rules_elm//:local_repository_files"
],
env = {
"BAZEL_CMD": bazel_cmd,
"EXPECTED_OUTPUT": expected_output,
},
**kwargs,
)
def rules_elm_integration_test_each_bazel(
name,
bazel_binaries,
workspace_path,
bazel_cmd,
expected_output,
test_runner = ":output_match_runner",
**kwargs,
):
for config in _configs:
for bazel_binary_name in bazel_binaries:
rules_elm_integration_test(
name = gen_name(name, bazel_binary_name, config),
workspace_path = workspace_path,
bazel_cmd = bazel_cmd + " --config={}_{}".format(bazel_binary_name, config),
expected_output = expected_output,
test_runner = test_runner,
bazel_binary = bazel_binaries[bazel_binary_name],
tags = [
bazel_binary_name,
# for bazel7 sandboxing issue
# https://github.com/bazelbuild/bazel/issues/1990
"no-sandbox",
],
**kwargs,
)