Skip to content

Commit

Permalink
Merge pull request KhronosGroup#2371 from RafaelMarinheiro/master
Browse files Browse the repository at this point in the history
Use --test-root to pass files to Bazel tests.
  • Loading branch information
johnkslang authored Aug 17, 2020
2 parents 8f0c6bd + 89cd45c commit f257e0e
Showing 1 changed file with 18 additions and 29 deletions.
47 changes: 18 additions & 29 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ py_binary(

genrule(
name = "gen_build_info_h",
srcs = ["CHANGES.md", "build_info.h.tmpl"],
srcs = [
"CHANGES.md",
"build_info.h.tmpl",
],
outs = ["glslang/build_info.h"],
cmd = "$(location build_info) $$(dirname $(location CHANGES.md)) -i $(location build_info.h.tmpl) -o $(location glslang/build_info.h)",
tools = [":build_info"],
Expand Down Expand Up @@ -92,10 +95,8 @@ cc_library(
) + [
"OGLCompilersDLL/InitializeDll.cpp",
] + select({
"@bazel_tools//src/conditions:windows":
["glslang/OSDependent/Windows/ossource.cpp"],
"//conditions:default":
["glslang/OSDependent/Unix/ossource.cpp"],
"@bazel_tools//src/conditions:windows": ["glslang/OSDependent/Windows/ossource.cpp"],
"//conditions:default": ["glslang/OSDependent/Unix/ossource.cpp"],
}),
hdrs = glob([
"glslang/HLSL/*.h",
Expand All @@ -118,7 +119,10 @@ cc_library(
],
linkopts = select({
"@bazel_tools//src/conditions:windows": [""],
"//conditions:default": ["-lm", "-lpthread"],
"//conditions:default": [
"-lm",
"-lpthread",
],
}),
linkstatic = 1,
)
Expand Down Expand Up @@ -224,18 +228,6 @@ cc_binary(
],
)

filegroup(
name = "test_files",
srcs = glob(
["Test/**"],
exclude = [
"Test/bump",
"Test/glslangValidator",
"Test/runtests",
],
),
)

cc_library(
name = "glslang_test_lib",
testonly = 1,
Expand All @@ -249,16 +241,9 @@ cc_library(
"gtests/main.cpp",
],
copts = COMMON_COPTS,
data = [":test_files"],
defines = select({
# Unfortunately we can't use $(location) in cc_library at the moment.
# See https://github.com/bazelbuild/bazel/issues/1023
# So we'll specify the path manually.
"@bazel_tools//src/conditions:windows":
["GLSLANG_TEST_DIRECTORY='\"../../../../../Test\"'"],
"//conditions:default":
["GLSLANG_TEST_DIRECTORY='\"Test\"'"],
}),
defines = [
"GLSLANG_TEST_DIRECTORY='\"USE_FLAG_INSTEAD\"'",
],
linkstatic = 1,
deps = [
":SPIRV",
Expand All @@ -281,9 +266,13 @@ GLSLANG_TESTS = glob(
[cc_test(
name = test_file.replace("gtests/", "").replace(".FromFile.cpp", "") + "_test",
srcs = [test_file],
args = [
"--test-root",
"$(rootpath Test)",
],
copts = COMMON_COPTS,
data = [
":test_files",
"Test",
],
deps = [
":SPIRV",
Expand Down

0 comments on commit f257e0e

Please sign in to comment.