From 4211a97a6cf8be642f0f04b07b1342266f4c6316 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 9 May 2023 14:47:45 +0200 Subject: [PATCH] Flip `--incompatible_check_sharding_support` RELNOTES[INC]: `--incompatible_check_sharding_support` is enabled by default. Sharded tests with test runners that do not properly advertise support for test sharding will fail. Refer to https://github.com/bazelbuild/bazel/issues/18339 for migration advice. --- .../devtools/build/lib/analysis/test/TestConfiguration.java | 2 +- src/test/py/bazel/test_wrapper_test.py | 1 + src/test/shell/bazel/bazel_test_test.sh | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java index 333dccce4389ee..940d7ab142384a 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java @@ -293,7 +293,7 @@ public static class TestOptions extends FragmentOptions { @Option( name = "incompatible_check_sharding_support", - defaultValue = "false", + defaultValue = "true", documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE}, effectTags = {OptionEffectTag.UNKNOWN}, diff --git a/src/test/py/bazel/test_wrapper_test.py b/src/test/py/bazel/test_wrapper_test.py index 36c0f00abd2120..6eb4c576db4254 100644 --- a/src/test/py/bazel/test_wrapper_test.py +++ b/src/test/py/bazel/test_wrapper_test.py @@ -70,6 +70,7 @@ def _CreateMockWorkspace(self): 'bat_test(', ' name = "sharded_test",', ' content = [', + ' "copy NUL %TEST_SHARD_STATUS_FILE%",', ' "@echo STATUS=%TEST_SHARD_STATUS_FILE%",', ' "@echo INDEX=%TEST_SHARD_INDEX% TOTAL=%TEST_TOTAL_SHARDS%",', ' ],', diff --git a/src/test/shell/bazel/bazel_test_test.sh b/src/test/shell/bazel/bazel_test_test.sh index 4bee9e4a4178c4..46127c4b2f1c66 100755 --- a/src/test/shell/bazel/bazel_test_test.sh +++ b/src/test/shell/bazel/bazel_test_test.sh @@ -540,9 +540,10 @@ EOF function test_xml_fallback_for_sharded_test() { mkdir -p dir - cat < dir/test.sh + cat <<'EOF' > dir/test.sh #!/bin/sh -exit \$((TEST_SHARD_INDEX == 1)) +touch "$TEST_SHARD_STATUS_FILE" +exit $((TEST_SHARD_INDEX == 1)) EOF chmod +x dir/test.sh