Commit c5404921 authored by Maks Orlovich's avatar Maks Orlovich Committed by Commit Bot

SimpleFdLimit test: serialize Close ops at the end.

If the closes run in parallel, there is some non-determinism in timing of
when they re-acquire FDs to finalize writes to disk and release FDs
afterwards, making exact behavior of FD limiter dependent on execution
schedule, especially on number of threads ScopedTaskEnvironment uses.

Change-Id: Id0da08ba64d24816835b155440cb7327dfcdf889
Reviewed-on: https://chromium-review.googlesource.com/c/1459519Reviewed-by: default avatarAsanka Herath <asanka@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630116}
parent ffd2a12f
...@@ -4653,20 +4653,21 @@ TEST_F(DiskCacheBackendTest, SimpleFdLimit) { ...@@ -4653,20 +4653,21 @@ TEST_F(DiskCacheBackendTest, SimpleFdLimit) {
for (int i = 0; i < kLargeNumEntries; ++i) { for (int i = 0; i < kLargeNumEntries; ++i) {
entries[i]->Close(); entries[i]->Close();
RunUntilIdle();
} }
alt_entry->Close(); alt_entry->Close();
RunUntilIdle(); RunUntilIdle();
// Closes have to pull things in to write out the footer, but they also // Closes have to pull things in to write out the footer, but they also
// free up FDs, so we will only need to kick one more thing out. // free up FDs.
histogram_tester.ExpectBucketCount( histogram_tester.ExpectBucketCount(
"SimpleCache.FileDescriptorLimiterAction", "SimpleCache.FileDescriptorLimiterAction",
disk_cache::FD_LIMIT_CLOSE_FILE, disk_cache::FD_LIMIT_CLOSE_FILE,
kLargeNumEntries - 64 + 1 + kLargeNumEntries - 1 + 2 + 1); kLargeNumEntries - 64 + 1 + kLargeNumEntries - 1 + 2);
histogram_tester.ExpectBucketCount( histogram_tester.ExpectBucketCount(
"SimpleCache.FileDescriptorLimiterAction", "SimpleCache.FileDescriptorLimiterAction",
disk_cache::FD_LIMIT_REOPEN_FILE, disk_cache::FD_LIMIT_REOPEN_FILE,
kLargeNumEntries - 64 + 1 + kLargeNumEntries - 1 + 2 + 1); kLargeNumEntries - 64 + 1 + kLargeNumEntries - 1 + 2);
histogram_tester.ExpectBucketCount("SimpleCache.FileDescriptorLimiterAction", histogram_tester.ExpectBucketCount("SimpleCache.FileDescriptorLimiterAction",
disk_cache::FD_LIMIT_FAIL_REOPEN_FILE, 0); disk_cache::FD_LIMIT_FAIL_REOPEN_FILE, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment