From ce2dd97afe73c939203a6a19870bddaf0d4687a6 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Wed, 24 Jul 2024 15:29:51 +0000 Subject: [PATCH] Fix tests on Windows --- src/test/py/bazel/bazel_windows_cpp_test.py | 1 + src/test/py/bazel/bazel_windows_test.py | 5 ++++- src/test/py/bazel/test_wrapper_test.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/py/bazel/bazel_windows_cpp_test.py b/src/test/py/bazel/bazel_windows_cpp_test.py index 5da2227d4c2086..fbfcaf7b0d9e0b 100644 --- a/src/test/py/bazel/bazel_windows_cpp_test.py +++ b/src/test/py/bazel/bazel_windows_cpp_test.py @@ -740,6 +740,7 @@ def testCppErrorShouldBeVisible(self): def testBuildWithClangClByToolchainResolution(self): self.DisableBzlmod() + self.ScratchFile('WORKSPACE', [ 'register_execution_platforms(', ' ":windows_clang"', ')', diff --git a/src/test/py/bazel/bazel_windows_test.py b/src/test/py/bazel/bazel_windows_test.py index 488838847349e3..aec5d2141452df 100644 --- a/src/test/py/bazel/bazel_windows_test.py +++ b/src/test/py/bazel/bazel_windows_test.py @@ -20,6 +20,9 @@ class BazelWindowsTest(test_base.TestBase): def createProjectFiles(self): + self.ScratchFile('MODULE.bazel', [ + 'bazel_dep(name = "platforms", version = "0.0.9")', + ]) self.ScratchFile('foo/BUILD', [ 'platform(', ' name = "x64_windows-msys-gcc",', @@ -133,7 +136,7 @@ def testWindowsCompilesAssembly(self): def testWindowsEnvironmentVariablesSetting(self): self.ScratchFile('BUILD') rule_definition = [ - 'my_repo = use_repo_rule(":repo.bzl", "my_repo")', + 'my_repo = use_repo_rule("//:repo.bzl", "my_repo")', 'my_repo(name = "env_test")', ] self.ScratchFile('MODULE.bazel', rule_definition) diff --git a/src/test/py/bazel/test_wrapper_test.py b/src/test/py/bazel/test_wrapper_test.py index 19651db70ccece..f48fc48f51b4df 100644 --- a/src/test/py/bazel/test_wrapper_test.py +++ b/src/test/py/bazel/test_wrapper_test.py @@ -680,6 +680,7 @@ def testRunningTestFromExternalRepo(self): ] self.ScratchFile('MODULE.bazel', rule_definition) self.ScratchFile('BUILD', ['py_test(name = "x", srcs = ["x.py"])']) + self.ScratchFile('a/REPO.bazel') self.ScratchFile('a/BUILD', ['py_test(name = "x", srcs = ["x.py"])']) self.ScratchFile('x.py') self.ScratchFile('a/x.py')