From fd3519242b37ae28bc623fde763c5c046944c8b2 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 27 Apr 2023 13:45:24 +0200 Subject: [PATCH 1/5] Actually check `TEST_SHARD_STATUS_FILE` has been touched Adds the missing check that a test runner running a sharded test actually supports sharding. Previously, if it didn't, each shard would silently run all tests. RELNOTES: If sharding is requested for a test but the test runner does not advertise support for test sharding by touching the `TEST_SHARD_STATUS_FILE`, the tests will fail instead of silently running all tests in each shard. --- src/test/py/bazel/bazel_windows_test.py | 25 +++++++++++++++++++++++++ src/test/shell/bazel/bazel_test_test.sh | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/test/py/bazel/bazel_windows_test.py b/src/test/py/bazel/bazel_windows_test.py index 92f986ffd9b11f..f1f90ed807db20 100644 --- a/src/test/py/bazel/bazel_windows_test.py +++ b/src/test/py/bazel/bazel_windows_test.py @@ -449,6 +449,31 @@ def testZipUndeclaredTestOutputs(self): self.assertTrue(os.path.exists(output_file)) self.assertFalse(os.path.exists(output_zip)) + def testTestShardStatusFile(self): + self.CreateWorkspaceWithDefaultRepos('WORKSPACE') + self.ScratchFile( + 'BUILD', + [ + 'sh_test(', + ' name = "foo_test",', + ' srcs = ["foo.sh"],', + ' shard_count = 2,', + ')', + ], + ) + self.ScratchFile('foo.sh') + + exit_code, _, stderr = self.RunBazel(['test', '//:foo_test']) + # Check for "tests failed" exit code + self.AssertExitCode(exit_code, 3, stderr) + self.assertIn("Sharding requested, but the test runner did not advertise " + "support for it by touching TEST_SHARD_STATUS_FILE.", stderr) + + self.ScratchFile('foo.sh', ['touch "$TEST_SHARD_STATUS_FILE"']) + + exit_code, _, stderr = self.RunBazel(['test', '//:foo_test']) + self.AssertExitCode(exit_code, 0, stderr) + if __name__ == '__main__': unittest.main() diff --git a/src/test/shell/bazel/bazel_test_test.sh b/src/test/shell/bazel/bazel_test_test.sh index 709530a3ae0a84..c801663fd3e57a 100755 --- a/src/test/shell/bazel/bazel_test_test.sh +++ b/src/test/shell/bazel/bazel_test_test.sh @@ -997,4 +997,24 @@ EOF expect_log " BUILD +sh_test( + name = 'x', + srcs = ['x.sh'], + shard_count = 2, +) +EOF + touch x.sh + chmod +x x.sh + + bazel test //:x --test_output=errors &> $TEST_log \ + && fail "expected failure" + expect_log "Sharding requested, but the test runner did not advertise support for it by touching TEST_SHARD_STATUS_FILE." + + echo 'touch "$TEST_SHARD_STATUS_FILE"' > x.sh + bazel test //:x --test_output=errors &> $TEST_log \ + || fail "expected success" +} + run_suite "bazel test tests" From 570f99afed1be146354aa6d78b838ebbb02b1280 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 27 Apr 2023 13:45:24 +0200 Subject: [PATCH 2/5] Old approach --- src/test/shell/bin/bazel | 5 +++++ tools/test/test-setup.sh | 13 ++++++++++++ tools/test/windows/tw.cc | 46 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/src/test/shell/bin/bazel b/src/test/shell/bin/bazel index 985a15da082c30..6ed29a01c67f81 100755 --- a/src/test/shell/bin/bazel +++ b/src/test/shell/bin/bazel @@ -23,4 +23,9 @@ bazel_bin=$(rlocation io_bazel/src/bazel) unset RUNFILES_DIR unset RUNFILES_MANIFEST_FILE unset RUNFILES_MANIFEST_ONLY +# Also unset sharding related environment variables so that tests executed with +# bazel run do not inherit them from the integration test. +unset TEST_TOTAL_SHARDS +unset TEST_SHARD_INDEX +unset TEST_SHARD_STATUS_FILE exec $bazel_bin --nohome_rc --nosystem_rc --bazelrc=$TEST_TMPDIR/bazelrc "$@" diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh index 952754c82dd62d..47d32cccdb9ace 100755 --- a/tools/test/test-setup.sh +++ b/tools/test/test-setup.sh @@ -75,6 +75,9 @@ fi if [[ -n "$TEST_SHARD_STATUS_FILE" ]]; then is_absolute "$TEST_SHARD_STATUS_FILE" || TEST_SHARD_STATUS_FILE="$PWD/$TEST_SHARD_STATUS_FILE" mkdir -p "$(dirname "$TEST_SHARD_STATUS_FILE")" + # Get the modification time in nano second granularity or record that it was missing. + TEST_SHARD_STATUS_FILE_MTIME_AT_START=$(stat -c '%.9Y' "$TEST_SHARD_STATUS_FILE" 2> /dev/null || + echo "missing") fi is_absolute "$RUNFILES_DIR" || RUNFILES_DIR="$PWD/$RUNFILES_DIR" @@ -368,6 +371,16 @@ kill_group SIGKILL $childPid kill_group SIGKILL $cleanupPid &> /dev/null wait $cleanupPid +# Sharding was requested, verify that the test runner actually supported it. +if [[ -n "$TEST_SHARD_STATUS_FILE" ]]; then + TEST_SHARD_STATUS_FILE_MTIME_AT_END=$(stat -c '%.9Y' "$TEST_SHARD_STATUS_FILE" 2> /dev/null || + echo "missing") + if [[ "$TEST_SHARD_STATUS_FILE_MTIME_AT_START" = "$TEST_SHARD_STATUS_FILE_MTIME_AT_END" ]]; then + echo >&2 "FAILED: Sharding requested, but the test runner did not advertise support for it by touching TEST_SHARD_STATUS_FILE. Either remove the 'shard_count' attribute or use a test runner that supports sharding." + exit 1 + fi +fi + for signal in $signals; do trap - ${signal} done diff --git a/tools/test/windows/tw.cc b/tools/test/windows/tw.cc index 2992acf2129d10..02cd142aa66dd0 100644 --- a/tools/test/windows/tw.cc +++ b/tools/test/windows/tw.cc @@ -605,6 +605,42 @@ bool ExportShardStatusFile(const Path& cwd) { CreateDirectories(status_file.Dirname()); } +bool GetLenientShardStatusFileModificationTime(uint64_t* mtime) { + Path status_file; + if (!GetPathEnv(L"TEST_SHARD_STATUS_FILE", &status_file) || + status_file.Get().empty()) { + return false; + } + + bazel::windows::AutoHandle handle(CreateFileW( + AddUncPrefixMaybe(status_file).c_str(), GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, nullptr)); + if (!handle.IsValid()) { + DWORD err = GetLastError(); + if (err != ERROR_FILE_NOT_FOUND) { + LogErrorWithArgAndValue( + __LINE__, "Failed to open shard status file", status_file.Get(), err); + } + *mtime = 0; + return true; + } + + FILETIME lastWriteTime; + if (!GetFileTime(handle, nullptr, nullptr, &lastWriteTime)) { + DWORD err = GetLastError(); + LogErrorWithArgAndValue( + __LINE__, "Failed to get file time of shard status file", + status_file.Get(), err); + *mtime = 0; + return true; + } + + *mtime = ((uint64_t) lastWriteTime.dwHighDateTime << 32) | + lastWriteTime.dwLowDateTime; + return true; +} + bool ExportGtestVariables(const Path& test_tmpdir) { // # Tell googletest about Bazel sharding. std::wstring total_shards_str; @@ -1925,6 +1961,7 @@ int TestWrapperMain(int argc, wchar_t** argv) { Path test_path, exec_root, srcdir, tmpdir, test_outerr, xml_log; UndeclaredOutputs undecl; std::wstring args; + uint64_t shard_status_file_mtime_start, shard_status_file_mtime_end; if (!AddCurrentDirectoryToPATH() || !ParseArgs(argc, argv, &argv0, &test_path_arg, &args) || !PrintTestLogStartMarker() || !GetCwd(&exec_root) || !ExportUserName() || @@ -1939,8 +1976,17 @@ int TestWrapperMain(int argc, wchar_t** argv) { return 1; } + GetLenientShardStatusFileModificationTime(&shard_status_file_mtime_start); Duration test_duration; int result = RunSubprocess(test_path, args, test_outerr, &test_duration); + if (GetLenientShardStatusFileModificationTime(&shard_status_file_mtime_end) && + shard_status_file_mtime_start == shard_status_file_mtime_end) { + LogError(__LINE__, "Sharding requested, but the test runner did not" + " advertise support for it by touching TEST_SHARD_STATUS_FILE. Either" + " remove the 'shard_count' attribute or use a test runner that supports" + " sharding."); + return 1; + } if (!CreateXmlLog(xml_log, test_outerr, test_duration, result, DeleteAfterwards::kEnabled, MainType::kTestWrapperMain) || !ArchiveUndeclaredOutputs(undecl) || From 5f3703cfbad830bc486712c69a1341f74538d5c6 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 27 Apr 2023 19:29:12 +0200 Subject: [PATCH 3/5] Revert "Old approach" This reverts commit ef47019df752b77dac399047f1ef091776404946. --- src/test/shell/bin/bazel | 5 ----- tools/test/test-setup.sh | 13 ------------ tools/test/windows/tw.cc | 46 ---------------------------------------- 3 files changed, 64 deletions(-) diff --git a/src/test/shell/bin/bazel b/src/test/shell/bin/bazel index 6ed29a01c67f81..985a15da082c30 100755 --- a/src/test/shell/bin/bazel +++ b/src/test/shell/bin/bazel @@ -23,9 +23,4 @@ bazel_bin=$(rlocation io_bazel/src/bazel) unset RUNFILES_DIR unset RUNFILES_MANIFEST_FILE unset RUNFILES_MANIFEST_ONLY -# Also unset sharding related environment variables so that tests executed with -# bazel run do not inherit them from the integration test. -unset TEST_TOTAL_SHARDS -unset TEST_SHARD_INDEX -unset TEST_SHARD_STATUS_FILE exec $bazel_bin --nohome_rc --nosystem_rc --bazelrc=$TEST_TMPDIR/bazelrc "$@" diff --git a/tools/test/test-setup.sh b/tools/test/test-setup.sh index 47d32cccdb9ace..952754c82dd62d 100755 --- a/tools/test/test-setup.sh +++ b/tools/test/test-setup.sh @@ -75,9 +75,6 @@ fi if [[ -n "$TEST_SHARD_STATUS_FILE" ]]; then is_absolute "$TEST_SHARD_STATUS_FILE" || TEST_SHARD_STATUS_FILE="$PWD/$TEST_SHARD_STATUS_FILE" mkdir -p "$(dirname "$TEST_SHARD_STATUS_FILE")" - # Get the modification time in nano second granularity or record that it was missing. - TEST_SHARD_STATUS_FILE_MTIME_AT_START=$(stat -c '%.9Y' "$TEST_SHARD_STATUS_FILE" 2> /dev/null || - echo "missing") fi is_absolute "$RUNFILES_DIR" || RUNFILES_DIR="$PWD/$RUNFILES_DIR" @@ -371,16 +368,6 @@ kill_group SIGKILL $childPid kill_group SIGKILL $cleanupPid &> /dev/null wait $cleanupPid -# Sharding was requested, verify that the test runner actually supported it. -if [[ -n "$TEST_SHARD_STATUS_FILE" ]]; then - TEST_SHARD_STATUS_FILE_MTIME_AT_END=$(stat -c '%.9Y' "$TEST_SHARD_STATUS_FILE" 2> /dev/null || - echo "missing") - if [[ "$TEST_SHARD_STATUS_FILE_MTIME_AT_START" = "$TEST_SHARD_STATUS_FILE_MTIME_AT_END" ]]; then - echo >&2 "FAILED: Sharding requested, but the test runner did not advertise support for it by touching TEST_SHARD_STATUS_FILE. Either remove the 'shard_count' attribute or use a test runner that supports sharding." - exit 1 - fi -fi - for signal in $signals; do trap - ${signal} done diff --git a/tools/test/windows/tw.cc b/tools/test/windows/tw.cc index 02cd142aa66dd0..2992acf2129d10 100644 --- a/tools/test/windows/tw.cc +++ b/tools/test/windows/tw.cc @@ -605,42 +605,6 @@ bool ExportShardStatusFile(const Path& cwd) { CreateDirectories(status_file.Dirname()); } -bool GetLenientShardStatusFileModificationTime(uint64_t* mtime) { - Path status_file; - if (!GetPathEnv(L"TEST_SHARD_STATUS_FILE", &status_file) || - status_file.Get().empty()) { - return false; - } - - bazel::windows::AutoHandle handle(CreateFileW( - AddUncPrefixMaybe(status_file).c_str(), GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, nullptr)); - if (!handle.IsValid()) { - DWORD err = GetLastError(); - if (err != ERROR_FILE_NOT_FOUND) { - LogErrorWithArgAndValue( - __LINE__, "Failed to open shard status file", status_file.Get(), err); - } - *mtime = 0; - return true; - } - - FILETIME lastWriteTime; - if (!GetFileTime(handle, nullptr, nullptr, &lastWriteTime)) { - DWORD err = GetLastError(); - LogErrorWithArgAndValue( - __LINE__, "Failed to get file time of shard status file", - status_file.Get(), err); - *mtime = 0; - return true; - } - - *mtime = ((uint64_t) lastWriteTime.dwHighDateTime << 32) | - lastWriteTime.dwLowDateTime; - return true; -} - bool ExportGtestVariables(const Path& test_tmpdir) { // # Tell googletest about Bazel sharding. std::wstring total_shards_str; @@ -1961,7 +1925,6 @@ int TestWrapperMain(int argc, wchar_t** argv) { Path test_path, exec_root, srcdir, tmpdir, test_outerr, xml_log; UndeclaredOutputs undecl; std::wstring args; - uint64_t shard_status_file_mtime_start, shard_status_file_mtime_end; if (!AddCurrentDirectoryToPATH() || !ParseArgs(argc, argv, &argv0, &test_path_arg, &args) || !PrintTestLogStartMarker() || !GetCwd(&exec_root) || !ExportUserName() || @@ -1976,17 +1939,8 @@ int TestWrapperMain(int argc, wchar_t** argv) { return 1; } - GetLenientShardStatusFileModificationTime(&shard_status_file_mtime_start); Duration test_duration; int result = RunSubprocess(test_path, args, test_outerr, &test_duration); - if (GetLenientShardStatusFileModificationTime(&shard_status_file_mtime_end) && - shard_status_file_mtime_start == shard_status_file_mtime_end) { - LogError(__LINE__, "Sharding requested, but the test runner did not" - " advertise support for it by touching TEST_SHARD_STATUS_FILE. Either" - " remove the 'shard_count' attribute or use a test runner that supports" - " sharding."); - return 1; - } if (!CreateXmlLog(xml_log, test_outerr, test_duration, result, DeleteAfterwards::kEnabled, MainType::kTestWrapperMain) || !ArchiveUndeclaredOutputs(undecl) || From e4fcf0c4a2cd9d5213b3e6196ca7cfeb69837ee3 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 27 Apr 2023 20:08:20 +0200 Subject: [PATCH 4/5] New approach --- site/en/reference/test-encyclopedia.md | 5 ++-- .../lib/analysis/test/TestConfiguration.java | 17 ++++++++++++ .../lib/analysis/test/TestRunnerAction.java | 4 +++ .../lib/exec/StandaloneTestStrategy.java | 16 ++++++++++++ src/test/py/bazel/bazel_windows_test.py | 15 ++++++----- src/test/shell/bazel/bazel_test_test.sh | 10 ++++--- .../bazel/remote/remote_execution_test.sh | 26 +++++++++++++++++++ 7 files changed, 81 insertions(+), 12 deletions(-) diff --git a/site/en/reference/test-encyclopedia.md b/site/en/reference/test-encyclopedia.md index 267d11dd77b08f..ae0250a816923f 100644 --- a/site/en/reference/test-encyclopedia.md +++ b/site/en/reference/test-encyclopedia.md @@ -225,8 +225,9 @@ shard index, beginning at 0. Runners use this information to select which tests to run - for example, using a round-robin strategy. Not all test runners support sharding. If a runner supports sharding, it must create or update the last modified date of the file specified by -[`TEST_SHARD_STATUS_FILE`](#initial-conditions). Otherwise, Bazel assumes it -does not support sharding and will not launch additional runners. +[`TEST_SHARD_STATUS_FILE`](#initial-conditions). Otherwise, if +[`--incompatible_check_sharding_support`]((/reference/command-line-reference#flag--incompatible_check_sharding_support)) +is enabled, Bazel will fail the test if it is sharded. ## Initial conditions {:#initial-conditions} 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 ff9258019b9284..333dccce4389ee 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 @@ -291,6 +291,19 @@ public static class TestOptions extends FragmentOptions { + "the test exec group.") public boolean useTargetPlatformForTests; + @Option( + name = "incompatible_check_sharding_support", + defaultValue = "false", + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE}, + effectTags = {OptionEffectTag.UNKNOWN}, + help = + "If true, Bazel will fail a sharded test if the test runner does not indicate that it " + + "supports sharding by touching the file at the path in TEST_SHARD_STATUS_FILE. " + + "If false, a test runner that does not support sharding will lead to all tests " + + "running in each shard.") + public boolean checkShardingSupport; + @Override public FragmentOptions getExec() { // Options here are either: @@ -395,6 +408,10 @@ public boolean useTargetPlatformForTests() { return options.useTargetPlatformForTests; } + public boolean checkShardingSupport() { + return options.checkShardingSupport; + } + /** * Option converter that han handle two styles of value for "--runs_per_test": * diff --git a/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java b/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java index 8ead7e0ff9434a..512caef2bc9ad9 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/test/TestRunnerAction.java @@ -332,6 +332,10 @@ public boolean showsOutputUnconditionally() { return true; } + public boolean checkShardingSupport() { + return testConfiguration.checkShardingSupport(); + } + public List getSpawnOutputs() { final List outputs = new ArrayList<>(); outputs.add(ActionInputHelper.fromPath(getXmlOutputPath())); diff --git a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java index 2afb45f1d6d675..4ae72fb28b3aa1 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/StandaloneTestStrategy.java @@ -684,6 +684,22 @@ private TestAttemptResult runTestAttempt( } long endTimeMillis = actionExecutionContext.getClock().currentTimeMillis(); + if (testAction.isSharded()) { + if (testAction.checkShardingSupport() && !actionExecutionContext.getPathResolver() + .convertPath(resolvedPaths.getTestShard()).exists()) { + TestExecException e = + createTestExecException( + TestAction.Code.LOCAL_TEST_PREREQ_UNMET, + "Sharding requested, but the test runner did not advertise support for it by " + + "touching TEST_SHARD_STATUS_FILE. Either remove the 'shard_count' attribute, " + + "use a test runner that supports sharding or temporarily disable this check " + + "via --noincompatible_check_sharding_support."); + closeSuppressed(e, streamed); + closeSuppressed(e, fileOutErr); + throw e; + } + } + // SpawnActionContext guarantees the first entry to correspond to the spawn passed in (there // may be additional entries due to tree artifact handling). SpawnResult primaryResult = spawnResults.get(0); diff --git a/src/test/py/bazel/bazel_windows_test.py b/src/test/py/bazel/bazel_windows_test.py index f1f90ed807db20..b94fbe800730a4 100644 --- a/src/test/py/bazel/bazel_windows_test.py +++ b/src/test/py/bazel/bazel_windows_test.py @@ -463,16 +463,19 @@ def testTestShardStatusFile(self): ) self.ScratchFile('foo.sh') - exit_code, _, stderr = self.RunBazel(['test', '//:foo_test']) + exit_code, stdout, stderr = self.RunBazel( + ['test', '--incompatible_check_sharding_support', '//:foo_test']) # Check for "tests failed" exit code - self.AssertExitCode(exit_code, 3, stderr) - self.assertIn("Sharding requested, but the test runner did not advertise " - "support for it by touching TEST_SHARD_STATUS_FILE.", stderr) + self.AssertExitCode(exit_code, 3, stderr, stdout) + self.assertTrue(any( + "Sharding requested, but the test runner did not advertise support for" + " it by touching TEST_SHARD_STATUS_FILE." in line for line in stderr)) self.ScratchFile('foo.sh', ['touch "$TEST_SHARD_STATUS_FILE"']) - exit_code, _, stderr = self.RunBazel(['test', '//:foo_test']) - self.AssertExitCode(exit_code, 0, stderr) + exit_code, stdout, stderr = self.RunBazel( + ['test', '--incompatible_check_sharding_support', '//:foo_test']) + self.AssertExitCode(exit_code, 0, stderr, stdout) if __name__ == '__main__': diff --git a/src/test/shell/bazel/bazel_test_test.sh b/src/test/shell/bazel/bazel_test_test.sh index c801663fd3e57a..4bee9e4a4178c4 100755 --- a/src/test/shell/bazel/bazel_test_test.sh +++ b/src/test/shell/bazel/bazel_test_test.sh @@ -1008,13 +1008,15 @@ EOF touch x.sh chmod +x x.sh - bazel test //:x --test_output=errors &> $TEST_log \ - && fail "expected failure" + bazel test \ + --incompatible_check_sharding_support \ + //:x &> $TEST_log && fail "expected failure" expect_log "Sharding requested, but the test runner did not advertise support for it by touching TEST_SHARD_STATUS_FILE." echo 'touch "$TEST_SHARD_STATUS_FILE"' > x.sh - bazel test //:x --test_output=errors &> $TEST_log \ - || fail "expected success" + bazel test \ + --incompatible_check_sharding_support \ + //:x &> $TEST_log || fail "expected success" } run_suite "bazel test tests" diff --git a/src/test/shell/bazel/remote/remote_execution_test.sh b/src/test/shell/bazel/remote/remote_execution_test.sh index a29a0dbf39fb84..366667cc105442 100755 --- a/src/test/shell/bazel/remote/remote_execution_test.sh +++ b/src/test/shell/bazel/remote/remote_execution_test.sh @@ -3012,4 +3012,30 @@ function test_external_cc_binary_tool_with_dynamic_deps_sibling_repository_layou @other_repo//pkg:rule >& $TEST_log || fail "Build should succeed" } +function test_shard_status_file_checked_remote_download_minimal() { + cat <<'EOF' > BUILD +sh_test( + name = 'x', + srcs = ['x.sh'], + shard_count = 2, +) +EOF + touch x.sh + chmod +x x.sh + + bazel test \ + --remote_executor=grpc://localhost:${worker_port} \ + --incompatible_check_sharding_support \ + --remote_download_minimal \ + //:x &> $TEST_log && fail "expected failure" + expect_log "Sharding requested, but the test runner did not advertise support for it by touching TEST_SHARD_STATUS_FILE." + + echo 'touch "$TEST_SHARD_STATUS_FILE"' > x.sh + bazel test \ + --remote_executor=grpc://localhost:${worker_port} \ + --incompatible_check_sharding_support \ + --remote_download_minimal \ + //:x &> $TEST_log || fail "expected success" +} + run_suite "Remote execution and remote cache tests" From 34fccc2300169bb5842c27527aa9d415344b3c69 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Tue, 2 May 2023 21:31:37 +0200 Subject: [PATCH 5/5] Remove parentheses --- site/en/reference/test-encyclopedia.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/en/reference/test-encyclopedia.md b/site/en/reference/test-encyclopedia.md index ae0250a816923f..88aa868e8e12e1 100644 --- a/site/en/reference/test-encyclopedia.md +++ b/site/en/reference/test-encyclopedia.md @@ -226,7 +226,7 @@ to run - for example, using a round-robin strategy. Not all test runners support sharding. If a runner supports sharding, it must create or update the last modified date of the file specified by [`TEST_SHARD_STATUS_FILE`](#initial-conditions). Otherwise, if -[`--incompatible_check_sharding_support`]((/reference/command-line-reference#flag--incompatible_check_sharding_support)) +[`--incompatible_check_sharding_support`](/reference/command-line-reference#flag--incompatible_check_sharding_support) is enabled, Bazel will fail the test if it is sharded. ## Initial conditions {:#initial-conditions}