This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
forked from google/flatbuffers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.bzl
48 lines (44 loc) · 1.58 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
"""Helper macros and rules for tests."""
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
def flatbuffers_as_external_repo_test(name, directory):
"""Run all tests in a bazel workspace that imports flatbuffers as an external repository.
Args:
name: The name of the test target.
directory: The directory in which the bazel workspace is located. This is the directory
that imports flatbuffers as an external repository.
"""
expand_template(
name = name + "__template_expansion",
out = name + ".sh",
substitutions = {
"{{REPOSITORY_DIR}}": paths.join(native.package_name(), directory),
},
template = "//tests:bazel_repository_test_template.sh",
)
native.sh_test(
name = name,
srcs = [":%s.sh" % name],
data = [
"//:distribution",
"@bazel_linux_x86_64//file",
] + native.glob(
[
directory + "/**/*",
],
exclude = [
directory + "/bazel-*/**",
],
),
tags = [
# Since we have bazel downloading external repositories inside this
# test, we need to give it access to the internet.
"requires-network",
],
# We only have x86_64 Linux bazel exposed so restrict the test to that.
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)