Skip to content

Commit f257e0e

Browse files
authored
Merge pull request KhronosGroup#2371 from RafaelMarinheiro/master
Use --test-root to pass files to Bazel tests.
2 parents 8f0c6bd + 89cd45c commit f257e0e

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

BUILD.bazel

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ py_binary(
5151

5252
genrule(
5353
name = "gen_build_info_h",
54-
srcs = ["CHANGES.md", "build_info.h.tmpl"],
54+
srcs = [
55+
"CHANGES.md",
56+
"build_info.h.tmpl",
57+
],
5558
outs = ["glslang/build_info.h"],
5659
cmd = "$(location build_info) $$(dirname $(location CHANGES.md)) -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)",
5760
tools = [":build_info"],
@@ -92,10 +95,8 @@ cc_library(
9295
) + [
9396
"OGLCompilersDLL/InitializeDll.cpp",
9497
] + select({
95-
"@bazel_tools//src/conditions:windows":
96-
["glslang/OSDependent/Windows/ossource.cpp"],
97-
"//conditions:default":
98-
["glslang/OSDependent/Unix/ossource.cpp"],
98+
"@bazel_tools//src/conditions:windows": ["glslang/OSDependent/Windows/ossource.cpp"],
99+
"//conditions:default": ["glslang/OSDependent/Unix/ossource.cpp"],
99100
}),
100101
hdrs = glob([
101102
"glslang/HLSL/*.h",
@@ -118,7 +119,10 @@ cc_library(
118119
],
119120
linkopts = select({
120121
"@bazel_tools//src/conditions:windows": [""],
121-
"//conditions:default": ["-lm", "-lpthread"],
122+
"//conditions:default": [
123+
"-lm",
124+
"-lpthread",
125+
],
122126
}),
123127
linkstatic = 1,
124128
)
@@ -224,18 +228,6 @@ cc_binary(
224228
],
225229
)
226230

227-
filegroup(
228-
name = "test_files",
229-
srcs = glob(
230-
["Test/**"],
231-
exclude = [
232-
"Test/bump",
233-
"Test/glslangValidator",
234-
"Test/runtests",
235-
],
236-
),
237-
)
238-
239231
cc_library(
240232
name = "glslang_test_lib",
241233
testonly = 1,
@@ -249,16 +241,9 @@ cc_library(
249241
"gtests/main.cpp",
250242
],
251243
copts = COMMON_COPTS,
252-
data = [":test_files"],
253-
defines = select({
254-
# Unfortunately we can't use $(location) in cc_library at the moment.
255-
# See https://github.com/bazelbuild/bazel/issues/1023
256-
# So we'll specify the path manually.
257-
"@bazel_tools//src/conditions:windows":
258-
["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"],
259-
"//conditions:default":
260-
["GLSLANG_TEST_DIRECTORY='\"Test\"'"],
261-
}),
244+
defines = [
245+
"GLSLANG_TEST_DIRECTORY='\"USE_FLAG_INSTEAD\"'",
246+
],
262247
linkstatic = 1,
263248
deps = [
264249
":SPIRV",
@@ -281,9 +266,13 @@ GLSLANG_TESTS = glob(
281266
[cc_test(
282267
name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test",
283268
srcs = [test_file],
269+
args = [
270+
"--test-root",
271+
"$(rootpath Test)",
272+
],
284273
copts = COMMON_COPTS,
285274
data = [
286-
":test_files",
275+
"Test",
287276
],
288277
deps = [
289278
":SPIRV",

0 commit comments

Comments
 (0)