From 086cee7faacfb975d31d87c70097fc9772b7a1ab Mon Sep 17 00:00:00 2001 From: Farid Zakaria Date: Tue, 13 Feb 2024 17:20:38 +0000 Subject: [PATCH] Fix test source directory Please see https://github.com/bazelbuild/bazel/issues/18128 Workspace names are going away. --- MODULE.bazel | 10 +++++++--- stablehlo/conversions/linalg/tests/BUILD.bazel | 4 ++-- stablehlo/conversions/tosa/tests/BUILD.bazel | 4 ++-- stablehlo/testdata/BUILD.bazel | 4 ++-- stablehlo/tests/BUILD.bazel | 4 ++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 7a888b7cb2..8e9b856b58 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -5,11 +5,15 @@ # For more details, please check https://github.com/bazelbuild/bazel/issues/18958 ############################################################################### bazel_dep(name = "bazel_skylib", version = "1.3.0") - bazel_dep(name = "rules_python", version = "0.30.0") python = use_extension("@rules_python//python/extensions:python.bzl", "python") + +# There is a problem at the moment running lit using Python311 +# Our CI system enforces Python310 to get around it but we should set the toolchain +# in Bazel itself to avoid this problem. +# https://github.com/llvm/llvm-project/issues/75963 python.toolchain( - python_version = "3.10", is_default = True, -) \ No newline at end of file + python_version = "3.10", +) diff --git a/stablehlo/conversions/linalg/tests/BUILD.bazel b/stablehlo/conversions/linalg/tests/BUILD.bazel index a9f8e43427..8940b6329e 100644 --- a/stablehlo/conversions/linalg/tests/BUILD.bazel +++ b/stablehlo/conversions/linalg/tests/BUILD.bazel @@ -25,8 +25,8 @@ expand_template( testonly = True, out = "lit.site.cfg.py", substitutions = { - "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", - "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", + "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", + "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.", "@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"), }, diff --git a/stablehlo/conversions/tosa/tests/BUILD.bazel b/stablehlo/conversions/tosa/tests/BUILD.bazel index 43297613a0..17340b3eb8 100644 --- a/stablehlo/conversions/tosa/tests/BUILD.bazel +++ b/stablehlo/conversions/tosa/tests/BUILD.bazel @@ -25,8 +25,8 @@ expand_template( testonly = True, out = "lit.site.cfg.py", substitutions = { - "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", - "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", + "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", + "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.", "@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"), }, diff --git a/stablehlo/testdata/BUILD.bazel b/stablehlo/testdata/BUILD.bazel index 45cf7c2483..fd9dc25473 100644 --- a/stablehlo/testdata/BUILD.bazel +++ b/stablehlo/testdata/BUILD.bazel @@ -25,8 +25,8 @@ expand_template( testonly = True, out = "lit.site.cfg.py", substitutions = { - "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", - "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", + "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", + "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.", "@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"), }, diff --git a/stablehlo/tests/BUILD.bazel b/stablehlo/tests/BUILD.bazel index a6a3eeef1b..8ce1011441 100644 --- a/stablehlo/tests/BUILD.bazel +++ b/stablehlo/tests/BUILD.bazel @@ -134,8 +134,8 @@ expand_template( testonly = True, out = "lit.site.cfg.py", substitutions = { - "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", - "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], 'stablehlo')", + "\"@STABLEHLO_SOURCE_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", + "\"@STABLEHLO_TOOLS_DIR@\"": "os.path.join(os.environ['TEST_SRCDIR'], '_main')", "@LIT_SITE_CFG_IN_HEADER@": "# Autogenerated, do not edit.", "@LLVM_TOOLS_DIR@": package_path("@llvm-project//llvm:BUILD"), },