From bf5f7e6a11b8e99a4da44544167ef76572ee0b46 Mon Sep 17 00:00:00 2001 From: Yun Peng Date: Wed, 10 Jul 2024 10:16:50 +0200 Subject: [PATCH] [7.3.0] Fix CI for release-7.3.0 (#22976) - Upgraded Bazel to 7.2.1 to include remote cache fixes - Backport changes to adapt https://github.com/bazelbuild/continuous-integration/issues/1981 --------- Co-authored-by: Googler --- .bazelci/postsubmit.yml | 11 +++++-- .bazelci/presubmit.yml | 14 ++++++--- .bazelversion | 2 +- MODULE.bazel.lock | 8 ++--- examples/py_native/fail.py | 2 +- examples/py_native/test.py | 4 +-- .../build/lib/skyframe/packages/testing/BUILD | 5 ++++ src/test/cpp/option_processor_test.cc | 29 +++++++++++++------ .../lib/blackbox/bazel/DefaultToolsSetup.java | 6 +++- .../net/starlark/java/syntax/ParserTest.java | 2 +- src/test/py/bazel/action_temp_test.py | 4 +-- src/test/py/bazel/launcher_test.py | 12 ++++---- .../bazel/remote/cache_decompression_test.py | 11 ++++++- src/test/py/bazel/test_base.py | 5 +++- src/test/shell/bazel/BUILD | 3 +- src/test/shell/bazel/bazel_test_test.sh | 12 ++++++-- src/test/shell/bazel/testing_server.py | 9 +++++- src/test/shell/integration/BUILD | 3 ++ .../integration/bazel_command_log_test.sh | 6 ++++ src/test/shell/testenv.sh.tmpl | 6 ++++ tools/python/pywrapper_test.py | 2 +- 21 files changed, 116 insertions(+), 40 deletions(-) diff --git a/.bazelci/postsubmit.yml b/.bazelci/postsubmit.yml index d5f0c115bd632a..3173d0348e3735 100644 --- a/.bazelci/postsubmit.yml +++ b/.bazelci/postsubmit.yml @@ -157,6 +157,7 @@ tasks: - build - test macos: + shards: 20 shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod @@ -174,7 +175,7 @@ tasks: test_flags: - "--config=ci-macos" # Fine tune the number of test jobs running in parallel to avoid timeout - - "--local_test_jobs=8" + - "--local_test_jobs=2" test_targets: - "//scripts/..." - "//src/main/starlark/tests/builtins_bzl/..." @@ -206,11 +207,17 @@ tasks: - "-//src/test/shell/bazel/android:android_instrumentation_test_integration_test_with_head_android_tools" - "-//src/test/shell/bazel/android:aapt_integration_test" - "-//src/test/shell/bazel/android:aapt_integration_test_with_head_android_tools" + # ServerTests frequently runs into deadlocks on Intel Macs + - "-//src/test/java/com/google/devtools/build/lib/server:ServerTests" + # bazel_proto_library_test is timeout flaky on Intel Macs, which usually means a runtime of 2 hours or more + - "-//src/test/shell/bazel:bazel_proto_library_test" + # Takes too long on Intel VMs + - "-//src/test/shell/bazel:bazel_bootstrap_distfile_test" include_json_profile: - build - test macos_arm64: - xcode_version: "15.1" + shards: 5 shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index cd43f97fd2957c..e712c138dfb7a9 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -160,7 +160,7 @@ tasks: - build - test macos: - shards: 5 + shards: 20 shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod @@ -178,7 +178,7 @@ tasks: test_flags: - "--config=ci-macos" # Fine tune the number of test jobs running in parallel to avoid timeout - - "--local_test_jobs=8" + - "--local_test_jobs=2" test_targets: - "//scripts/..." - "//src/main/starlark/tests/builtins_bzl/..." @@ -258,12 +258,18 @@ tasks: # - "-//src/test/shell/bazel/android:resource_processing_integration_test_with_head_android_tools" - "-//src/test/shell/integration:aquery_test" - "-//src/test/py/bazel:mod_command_test" + # ServerTests frequently runs into deadlocks on Intel Macs + - "-//src/test/java/com/google/devtools/build/lib/server:ServerTests" + # bazel_proto_library_test is timeout flaky on Intel Macs, which usually means a runtime of 2 hours or more + - "-//src/test/shell/bazel:bazel_proto_library_test" + # Takes too long on Intel VMs + - "-//src/test/shell/bazel:bazel_bootstrap_distfile_test" + - "-//src/test/shell/bazel:bazel_bootstrap_distfile_tar_test" include_json_profile: - build - test macos_arm64: - shards: 2 - xcode_version: "15.1" + shards: 5 shell_commands: - sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^# android_ndk_repository/android_ndk_repository/' WORKSPACE.bzlmod diff --git a/.bazelversion b/.bazelversion index 0ee843cc60466c..b26a34e470564d 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.2.0 +7.2.1 diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 7b76d8836b763d..1b6aa2e1024bd4 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -5194,7 +5194,7 @@ }, "@@rules_python~//python/extensions:pip.bzl%pip": { "os:linux,arch:amd64": { - "bzlTransitiveDigest": "Vf13b56cyzDlFSuBe0jAWQ6cABEp8g1eMKvDLQ6oYzI=", + "bzlTransitiveDigest": "d1QyWbv7V6dSMI9Yy8xD50sjPPDRGHFxcSPaDqmNxVA=", "usagesDigest": "z2Y/qriRs1cB2u4zSGurJXLmeiegK0aeWcRkUhnJCfo=", "recordedFileInputs": { "@@//requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" @@ -5354,7 +5354,7 @@ ] }, "os:osx,arch:aarch64": { - "bzlTransitiveDigest": "QC+EDcwRkAC0XFrTRoCebERmIR0+pCFUTORLGWFeG9o=", + "bzlTransitiveDigest": "km3aTfEkwvJAYOBc1zDBO4P+emikHbXvbo7U8AkQbqk=", "usagesDigest": "z2Y/qriRs1cB2u4zSGurJXLmeiegK0aeWcRkUhnJCfo=", "recordedFileInputs": { "@@//requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" @@ -5514,7 +5514,7 @@ ] }, "os:osx,arch:x86_64": { - "bzlTransitiveDigest": "9GKzYppTyFpn0pd9crxJgoMeFLQji7t7VnaWvwvwSbQ=", + "bzlTransitiveDigest": "oNbVI8nuDUivFIaPyoQ0WrpVUjFuscZJZmQemGeW2KY=", "usagesDigest": "z2Y/qriRs1cB2u4zSGurJXLmeiegK0aeWcRkUhnJCfo=", "recordedFileInputs": { "@@//requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" @@ -5674,7 +5674,7 @@ ] }, "os:windows,arch:amd64": { - "bzlTransitiveDigest": "3plWzREB7/+/pm54KZG/dfyd6qX7337sV3I+2il0Q0g=", + "bzlTransitiveDigest": "/7k9xbys836jh9Fyho5BByj7pzpXoSTrZVJBSw0GsX4=", "usagesDigest": "z2Y/qriRs1cB2u4zSGurJXLmeiegK0aeWcRkUhnJCfo=", "recordedFileInputs": { "@@//requirements.txt": "ff12967a755bb8e9b4c92524f6471a99e14c30474a3d428547c55745ec8f23a0" diff --git a/examples/py_native/fail.py b/examples/py_native/fail.py index 98e35f4ee7fc09..69956c062fed8c 100644 --- a/examples/py_native/fail.py +++ b/examples/py_native/fail.py @@ -6,7 +6,7 @@ class TestGetNumber(unittest.TestCase): def test_fail(self): - self.assertEquals(GetNumber(), 0) + self.assertEqual(GetNumber(), 0) if __name__ == '__main__': diff --git a/examples/py_native/test.py b/examples/py_native/test.py index f9543aa7272536..113b11e09859f4 100644 --- a/examples/py_native/test.py +++ b/examples/py_native/test.py @@ -8,10 +8,10 @@ class TestGetNumber(unittest.TestCase): def test_ok(self): - self.assertEquals(GetNumber(), 42) + self.assertEqual(GetNumber(), 42) def test_fib(self): - self.assertEquals(Fib(5), 8) + self.assertEqual(Fib(5), 8) if __name__ == '__main__': unittest.main() diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/packages/testing/BUILD b/src/main/java/com/google/devtools/build/lib/skyframe/packages/testing/BUILD index 87c6c19fdd14f7..4c7b86e9ecf993 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/packages/testing/BUILD +++ b/src/main/java/com/google/devtools/build/lib/skyframe/packages/testing/BUILD @@ -15,6 +15,11 @@ java_binary( name = "BazelPackageLoaderTester", testonly = True, srcs = ["BazelPackageLoaderTester.java"], + jvm_flags = select({ + # For MacService machines which only have IPv6 addresses. + "//src/conditions:darwin": ["-Djava.net.preferIPv6Addresses=true"], + "//conditions:default": [], + }), deps = [ "//src/main/java/com/google/devtools/build/lib/cmdline", "//src/main/java/com/google/devtools/build/lib/events", diff --git a/src/test/cpp/option_processor_test.cc b/src/test/cpp/option_processor_test.cc index 6eab8b970766d3..4cdeb3133d5e9f 100644 --- a/src/test/cpp/option_processor_test.cc +++ b/src/test/cpp/option_processor_test.cc @@ -100,9 +100,13 @@ class OptionProcessorTest : public ::testing::Test { }; TEST_F(OptionProcessorTest, CanParseOptions) { - const std::vector args = {"bazel", "--host_jvm_args=MyParam", - "--nobatch", "command", - "--flag", "//my:target", + const std::vector args = {"bazel", + "--ignore_all_rc_files", + "--host_jvm_args=MyParam", + "--nobatch", + "command", + "--flag", + "//my:target", "--flag2=42"}; std::string error; ASSERT_EQ(blaze_exit_code::SUCCESS, @@ -135,9 +139,13 @@ TEST_F(OptionProcessorTest, CanParseOptions) { } TEST_F(OptionProcessorTest, CanParseHelpCommandSurroundedByOtherArgs) { - const std::vector args = {"bazel", "--host_jvm_args=MyParam", - "--nobatch", "help", - "--flag", "//my:target", + const std::vector args = {"bazel", + "--ignore_all_rc_files", + "--host_jvm_args=MyParam", + "--nobatch", + "help", + "--flag", + "//my:target", "--flag2=42"}; std::string error; ASSERT_EQ(blaze_exit_code::SUCCESS, @@ -196,9 +204,12 @@ TEST_F(OptionProcessorTest, CanParseEmptyArgs) { } TEST_F(OptionProcessorTest, CanParseDifferentStartupArgs) { - const std::vector args = - {"bazel", - "--nobatch", "--host_jvm_args=MyParam", "--host_jvm_args", "42"}; + const std::vector args = {"bazel", + "--nobatch", + "--ignore_all_rc_files", + "--host_jvm_args=MyParam", + "--host_jvm_args", + "42"}; std::string error; ASSERT_EQ(blaze_exit_code::SUCCESS, option_processor_->ParseOptions(args, workspace_, cwd_, &error)) diff --git a/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java b/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java index 48394f478222fa..334ac63f9b8823 100644 --- a/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java +++ b/src/test/java/com/google/devtools/build/lib/blackbox/bazel/DefaultToolsSetup.java @@ -87,7 +87,11 @@ public void setup(BlackBoxTestContext context) throws IOException { } } - lines.add("common --enable_bzlmod"); + if (OS.getCurrent() == OS.DARWIN) { + // Prefer ipv6 network on macOS + lines.add("startup --host_jvm_args=-Djava.net.preferIPv6Addresses=true"); + lines.add("build --jvmopt=-Djava.net.preferIPv6Addresses"); + } context.write(".bazelrc", lines); } diff --git a/src/test/java/net/starlark/java/syntax/ParserTest.java b/src/test/java/net/starlark/java/syntax/ParserTest.java index cc34d9b5acd291..5abf79809d7dc4 100644 --- a/src/test/java/net/starlark/java/syntax/ParserTest.java +++ b/src/test/java/net/starlark/java/syntax/ParserTest.java @@ -1348,7 +1348,7 @@ public void testParseExpressionStackOverflow() throws Exception { private static ParserInput veryDeepExpression() { StringBuilder s = new StringBuilder(); - for (int i = 0; i < 1000; i++) { + for (int i = 0; i < 5000; i++) { s.append("{"); } return ParserInput.fromString(s.toString(), "foo.star"); diff --git a/src/test/py/bazel/action_temp_test.py b/src/test/py/bazel/action_temp_test.py index 75c7f789724d57..51de0146c428c9 100644 --- a/src/test/py/bazel/action_temp_test.py +++ b/src/test/py/bazel/action_temp_test.py @@ -251,7 +251,7 @@ def _AssertOutputFileContents(self, lines, input_file_line, self.assertEqual(lines[0:3], [input_file_line, 'TMP:y', 'TEMP:y']) tmp = lines[3].split('=', 1)[1] temp = lines[4].split('=', 1)[1] - self.assertRegexpMatches(tmp, expected_tmpdir_regex) + self.assertRegex(tmp, expected_tmpdir_regex) self.assertEqual(tmp, temp) else: # 3 lines = input_file_line, foo, TMPDIR @@ -259,7 +259,7 @@ def _AssertOutputFileContents(self, lines, input_file_line, self.fail('lines=%s' % lines) self.assertEqual(lines[0:2], [input_file_line, 'foo']) tmpdir = lines[2].split('=', 1)[1] - self.assertRegexpMatches(tmpdir, expected_tmpdir_regex) + self.assertRegex(tmpdir, expected_tmpdir_regex) if __name__ == '__main__': diff --git a/src/test/py/bazel/launcher_test.py b/src/test/py/bazel/launcher_test.py index 972fa609ece48e..f986cd1ef3521e 100644 --- a/src/test/py/bazel/launcher_test.py +++ b/src/test/py/bazel/launcher_test.py @@ -53,15 +53,15 @@ def _buildJavaTargets(self, bazel_bin, binary_suffix): self.assertEqual(len(stdout), 4) self.assertEqual(stdout[0], 'hello java') if self.IsWindows(): - self.assertRegexpMatches( + self.assertRegex( stdout[1], r'java_runfiles=.*foo\\foo%s.runfiles' % binary_suffix) self.assertEqual(stdout[2], 'runfiles_manifest_only=1') - self.assertRegexpMatches( + self.assertRegex( stdout[3], r'^runfiles_manifest_file=[a-zA-Z]:[/\\].*MANIFEST$') else: - self.assertRegexpMatches(stdout[1], r'java_runfiles=.*/foo/foo.runfiles') + self.assertRegex(stdout[1], r'java_runfiles=.*/foo/foo.runfiles') self.assertEqual(stdout[2], 'runfiles_manifest_only=') - self.assertRegexpMatches(stdout[3], r'^runfiles_manifest_file.*MANIFEST$') + self.assertRegex(stdout[3], r'^runfiles_manifest_file.*MANIFEST$') def _buildShBinaryTargets(self, bazel_bin, bin1_suffix): self.RunBazel(['build', '//foo:bin1.sh']) @@ -134,7 +134,7 @@ def _buildShBinaryTargets(self, bazel_bin, bin1_suffix): self.assertEqual(stdout[0], 'hello shell') if self.IsWindows(): self.assertEqual(stdout[1], 'runfiles_manifest_only=1') - self.assertRegexpMatches( + self.assertRegex( stdout[2], (r'^runfiles_manifest_file=' r'[a-zA-Z]:/.*/foo/bin1.sh%s.runfiles/MANIFEST$' % bin1_suffix)) @@ -547,7 +547,7 @@ def testWindowsJavaExeLauncher(self): _, stdout, _ = self.RunProgram([binary, '--classpath_limit=0', print_cmd]) self.assertIn('-classpath', stdout) classpath = stdout[stdout.index('-classpath') + 1] - self.assertRegexpMatches(classpath, r'foo-[A-Za-z0-9]+-classpath.jar$') + self.assertRegex(classpath, r'foo-[A-Za-z0-9]+-classpath.jar$') def testWindowsNativeLauncherInNonEnglishPath(self): if not self.IsWindows(): diff --git a/src/test/py/bazel/remote/cache_decompression_test.py b/src/test/py/bazel/remote/cache_decompression_test.py index f297a0cd3acf45..e6ca6cde47c112 100644 --- a/src/test/py/bazel/remote/cache_decompression_test.py +++ b/src/test/py/bazel/remote/cache_decompression_test.py @@ -64,12 +64,21 @@ def do_GET(self): self.finish() +class HTTPServerV6(HTTPServer): + address_family = socket.AF_INET6 + + class CacheDecompressionTest(test_base.TestBase): def setUp(self): test_base.TestBase.setUp(self) server_port = self.GetFreeTCPPort() - self.httpd = HTTPServer(('localhost', server_port), MemoryStorageHandler) + if self.IsDarwin(): + self.httpd = HTTPServerV6( + ('localhost', server_port), MemoryStorageHandler + ) + else: + self.httpd = HTTPServer(('localhost', server_port), MemoryStorageHandler) self.httpd.storage = {} self.url = 'http://localhost:{}'.format(server_port) self.background = threading.Thread(target=self.httpd.serve_forever) diff --git a/src/test/py/bazel/test_base.py b/src/test/py/bazel/test_base.py index 691817a3cde342..dd96a4ba923509 100644 --- a/src/test/py/bazel/test_base.py +++ b/src/test/py/bazel/test_base.py @@ -137,7 +137,10 @@ def setUp(self): if TestBase.IsDarwin(): # For reducing SSD usage on our physical Mac machines. f.write('common --experimental_repository_cache_hardlinks\n') - f.write('common --enable_bzlmod\n') + if TestBase.IsDarwin(): + # Prefer ipv6 network on macOS + f.write('startup --host_jvm_args=-Djava.net.preferIPv6Addresses=true\n') + f.write('build --jvmopt=-Djava.net.preferIPv6Addresses\n') # An empty MODULE.bazel and a corresponding MODULE.bazel.lock will prevent # tests from accessing BCR self.ScratchFile('MODULE.bazel') diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD index 76b5d821792351..22025b222c56db 100644 --- a/src/test/shell/bazel/BUILD +++ b/src/test/shell/bazel/BUILD @@ -436,6 +436,7 @@ sh_test( tags = [ "no-sandbox", "no_windows", + "requires-network", # For Bzlmod ], ) @@ -793,7 +794,7 @@ sh_test( sh_test( name = "external_remote_file_test", - size = "small", + size = "medium", srcs = ["external_remote_file_test.sh"], data = [ ":test-deps", diff --git a/src/test/shell/bazel/bazel_test_test.sh b/src/test/shell/bazel/bazel_test_test.sh index ffa794d1af2208..7b10cac656c00f 100755 --- a/src/test/shell/bazel/bazel_test_test.sh +++ b/src/test/shell/bazel/bazel_test_test.sh @@ -174,8 +174,16 @@ sh_test( ) EOF + # The next line ensures that the test passes in IPv6-only networks on macOS. + if is_darwin; then + export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv6Addresses=true" + export STARTUP_OPTS="--host_jvm_args=-Djava.net.preferIPv6Addresses=true" + else + export STARTUP_OPTS="" + fi + # Test BAR is set from --action_env - BAZ=fromaction bazel --ignore_all_rc_files test --test_output=all \ + BAZ=fromaction bazel --ignore_all_rc_files $STARTUP_OPTS test --test_output=all \ --action_env=BAR=fromcli --action_env=BAZ \ //foo &> $TEST_log || fail "Test failed" expect_log "foo: frombuild" @@ -187,7 +195,7 @@ EOF # Test FOO from the BUILD file wins # Test BAR is set from --test_env # Test BAZ is set from --test_env - BAZ=fromtest bazel --ignore_all_rc_files test --test_output=all \ + BAZ=fromtest bazel --ignore_all_rc_files $STARTUP_OPTS test --test_output=all \ --action_env=FOO=fromcli --test_env=FOO=fromcli --test_env=BAR=fromcli \ --test_env=BAZ //foo &> $TEST_log || fail "Test failed" expect_log "foo: frombuild" diff --git a/src/test/shell/bazel/testing_server.py b/src/test/shell/bazel/testing_server.py index e4255b46687394..74598fa751e11b 100644 --- a/src/test/shell/bazel/testing_server.py +++ b/src/test/shell/bazel/testing_server.py @@ -41,6 +41,10 @@ import time +class TCPServerV6(TCPServer): + address_family = socket.AF_INET6 + + class Handler(BaseHTTPRequestHandler): """Handlers for testing HTTP server.""" auth = False @@ -152,7 +156,10 @@ def main(argv): while port is None: try: port = random.randrange(32760, 59760) - httpd = TCPServer(('', port), Handler) + if sys.platform == 'darwin': + httpd = TCPServerV6(('', port), Handler) + else: + httpd = TCPServer(('', port), Handler) except socket.error: port = None sys.stdout.write('%d\nstarted\n' % (port,)) diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD index 49e397ea0bc92e..3d1261327618e5 100644 --- a/src/test/shell/integration/BUILD +++ b/src/test/shell/integration/BUILD @@ -129,6 +129,9 @@ sh_test( "@bazel_tools//tools/bash/runfiles", ], shard_count = 8, + tags = [ + "requires-network", # For Bzlmod + ], ) sh_test( diff --git a/src/test/shell/integration/bazel_command_log_test.sh b/src/test/shell/integration/bazel_command_log_test.sh index c8e1ff9cdc762c..e6a64a6e1a663c 100755 --- a/src/test/shell/integration/bazel_command_log_test.sh +++ b/src/test/shell/integration/bazel_command_log_test.sh @@ -21,6 +21,9 @@ source "${CURRENT_DIR}/../integration_test_setup.sh" \ log="$(bazel --batch info command_log)" +# Less network flakiness without bzlmod +disable_bzlmod + function tear_down() { # Clean up after ourselves. bazel --nobatch shutdown @@ -45,6 +48,9 @@ function strip_lines_from_bazel_cc() { -e '/^WARNING: Waiting for server process to terminate (waited 5 seconds, waiting at most 60)$/d' \ -e '/^WARNING: The startup option --host_javabase is deprecated; prefer --server_javabase.$/d' \ -e '/^WARNING: The home directory is not defined, no home_rc will be looked for.$/d' \ + -e '/^WARNING: ignoring JAVA_TOOL_OPTIONS in environment.$/d' \ + -e '/^WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:$/d' \ + -e '/^\/etc\/bazel.bazelrc$/d' \ -e '/Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release/d' \ -e '/^E[0-9]* /d' \ $TEST_log) diff --git a/src/test/shell/testenv.sh.tmpl b/src/test/shell/testenv.sh.tmpl index e5809ca8288150..1eb994bf1bdafd 100755 --- a/src/test/shell/testenv.sh.tmpl +++ b/src/test/shell/testenv.sh.tmpl @@ -349,6 +349,12 @@ EOF echo "testenv.sh: Using shared install base at $TEST_INSTALL_BASE." echo "startup --install_base=$TEST_INSTALL_BASE" >> $TEST_TMPDIR/bazelrc fi + + if is_darwin; then + echo "Add flags to prefer ipv6 network" + echo "startup --host_jvm_args=-Djava.net.preferIPv6Addresses=true" >> $TEST_TMPDIR/bazelrc + echo "build --jvmopt=-Djava.net.preferIPv6Addresses" >> $TEST_TMPDIR/bazelrc + fi } function setup_android_sdk_support() { diff --git a/tools/python/pywrapper_test.py b/tools/python/pywrapper_test.py index baee22c7b99ca2..a014d7ac3dfeac 100644 --- a/tools/python/pywrapper_test.py +++ b/tools/python/pywrapper_test.py @@ -158,7 +158,7 @@ def assert_wrapper_success(self, returncode, out, err): def assert_wrapper_failure(self, returncode, out, err, message): self.assertEqual(returncode, 1, msg="Expected to exit with error code 1") - self.assertRegexpMatches( + self.assertRegex( err, message, msg="stderr did not contain expected string") def test_finds_python(self):