Skip to content

Commit

Permalink
BUILD changes to allow cleaner downstream integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sjain-stanford committed Oct 25, 2023
1 parent 03216ba commit e868462
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 9 deletions.
9 changes: 9 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1311,3 +1311,12 @@ gentbl_cc_library(
":vhlo_ops_td_files",
],
)

test_suite(
name = "stablehlo_ci_tests",
tests = [
"//stablehlo/tests:stablehlo_tests",
"//stablehlo/testdata:stablehlo_testdata_tests",
"//stablehlo/conversions/tosa/tests:stablehlo_tosa_tests"
],
)
2 changes: 2 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# limitations under the License.
"""Workspace for StableHLO."""

workspace(name = "stablehlo")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

SKYLIB_VERSION = "1.3.0"
Expand Down
10 changes: 8 additions & 2 deletions stablehlo/conversions/tosa/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ expand_template(
substitutions = {
"@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
"@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"),
"@STABLEHLO_TOOLS_DIR@": ".",
"@STABLEHLO_SOURCE_DIR@": ".",
"\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')",
"\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')",
},
template = "lit.site.cfg.py.in",
)
Expand All @@ -45,6 +45,12 @@ expand_template(
"@llvm-project//llvm:FileCheck",
],
size = "small",
tags = ["stablehlo_tosa_tests"],
)
for src in glob(["**/*.mlir"])
]

test_suite(
name = "stablehlo_tosa_tests",
tags = ["stablehlo_tosa_tests"],
)
2 changes: 1 addition & 1 deletion stablehlo/conversions/tosa/tests/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.stablehlo_tools_dir = "@STABLEHLO_TOOLS_DIR@"
lit_config.load_config(config, "@STABLEHLO_SOURCE_DIR@/stablehlo/conversions/tosa/tests/lit.cfg.py")
lit_config.load_config(config, "@STABLEHLO_SOURCE_DIR@" + "/stablehlo/conversions/tosa/tests/lit.cfg.py")
11 changes: 9 additions & 2 deletions stablehlo/testdata/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ expand_template(
substitutions = {
"@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
"@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"),
"@STABLEHLO_TOOLS_DIR@": ".",
"@STABLEHLO_SOURCE_DIR@": ".",
"\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')",
"\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')",
},
template = "lit.site.cfg.py.in",
)
Expand All @@ -46,6 +46,13 @@ expand_template(
"@llvm-project//llvm:FileCheck",
],
size = "small",
tags = ["stablehlo_testdata_tests"],

)
for src in glob(["**/*.mlir"])
]

test_suite(
name = "stablehlo_testdata_tests",
tags = ["stablehlo_testdata_tests"],
)
2 changes: 1 addition & 1 deletion stablehlo/testdata/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.stablehlo_tools_dir = "@STABLEHLO_TOOLS_DIR@"
lit_config.load_config(config, "@STABLEHLO_SOURCE_DIR@/stablehlo/testdata/lit.cfg.py")
lit_config.load_config(config, "@STABLEHLO_SOURCE_DIR@" + "/stablehlo/testdata/lit.cfg.py")
10 changes: 8 additions & 2 deletions stablehlo/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ expand_template(
substitutions = {
"@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.",
"@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"),
"@STABLEHLO_TOOLS_DIR@": ".",
"@STABLEHLO_SOURCE_DIR@": ".",
"\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')",
"\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')",
},
template = "lit.site.cfg.py.in",
)
Expand All @@ -150,6 +150,12 @@ expand_template(
"@llvm-project//llvm:not",
] + glob(["%s.bc" % src]),
size = "small",
tags = ["stablehlo_tests"],
)
for src in glob(["**/*.mlir"])
]

test_suite(
name = "stablehlo_tests",
tags = ["stablehlo_tests"],
)
2 changes: 1 addition & 1 deletion stablehlo/tests/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.stablehlo_tools_dir = "@STABLEHLO_TOOLS_DIR@"
lit_config.load_config(config, "@STABLEHLO_SOURCE_DIR@/stablehlo/tests/lit.cfg.py")
lit_config.load_config(config, "@STABLEHLO_SOURCE_DIR@" + "/stablehlo/tests/lit.cfg.py")

0 comments on commit e868462

Please sign in to comment.