Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Issue 2854323002: Make TestingProfile delete failures explicitly CHECK-fail.

Created:
3 years, 7 months ago by Matt Giuca
Modified:
3 years, 7 months ago
Reviewers:
jam
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make TestingProfile delete failures explicitly CHECK-fail. TestingProfile currently crashes due to an IO-allowed assert failure if the clean-up call to base::DeleteFile fails for some reason. This CL explicitly CHECKs the result of Delete, rather than ignoring the result and proceeding through to a difficult-to-debug assert later on. BUG=717648

Patch Set 1 #

Patch Set 2 : Only call delete if valid (i.e., path not empty). #

Patch Set 3 : Still need to call Delete when the directory has already been deleted. #

Patch Set 4 : TEMP: Added logging for TestingProfile::Delete and base::DeleteFile on Windows. #

Patch Set 5 : TEMP: Deliberately crash tests on ~ScopedTempDir, to see logs. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+68 lines, -14 lines) Patch
M base/files/file_util_win.cc View 1 2 3 1 chunk +30 lines, -9 lines 0 comments Download
M base/files/scoped_temp_dir.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M base/files/scoped_temp_dir.cc View 1 2 3 4 3 chunks +22 lines, -4 lines 0 comments Download
M chrome/test/base/testing_profile.cc View 1 2 3 1 chunk +13 lines, -1 line 0 comments Download

Messages

Total messages: 20 (10 generated)
Matt Giuca
Hi John, See bug for description. Note that there's an alternative CL: https://codereview.chromium.org/2855123002. You should ...
3 years, 7 months ago (2017-05-03 05:11:25 UTC) #2
jam
lgtm Thanks for investigating this which is a side effect of my change to turn ...
3 years, 7 months ago (2017-05-03 16:02:12 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2854323002/1
3 years, 7 months ago (2017-05-04 03:16:44 UTC) #5
Matt Giuca
Great. Thanks for playing "Choose Your Own CL".
3 years, 7 months ago (2017-05-04 03:17:26 UTC) #6
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/445105)
3 years, 7 months ago (2017-05-04 03:38:57 UTC) #8
Matt Giuca
On 2017/05/04 03:38:57, commit-bot: I haz the power wrote: > Try jobs failed on following ...
3 years, 7 months ago (2017-05-05 00:19:33 UTC) #9
Matt Giuca
Had do add a check for IsValid(); otherwise Delete() returns false in the legitimate case ...
3 years, 7 months ago (2017-05-05 03:25:26 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2854323002/20001
3 years, 7 months ago (2017-05-05 03:25:48 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/419197)
3 years, 7 months ago (2017-05-05 04:20:27 UTC) #15
Matt Giuca
3 years, 7 months ago (2017-05-05 07:07:14 UTC) #18
I think I know why those win and mac bots failed on Patch Set 2 (though I
haven't been able to test on those platforms).

If the ScopedTempDir directory has already been deleted, in PS2 it would've
returned false for IsValid which means we won't call Delete(), then the later
call to Delete() will explode. It's inconvenient that ScopedTempDir doesn't let
me directly check whether the path is empty (forcing me to also check if the
directory exists), so I've added IsEmpty.

Running the try jobs now (and going home)... PTAL. Unless you see a bunch of red
test results, in which case feel free to ignore this and I'll think harder about
what's going wrong.

Here's my full logic table for posterity:

There are four possibilities:
1. temp_dir_.path_.empty(): IsValid is false; Delete will fail in
   ~ScopedTempDir but silently (no thread error). This is fine.
2. !DirectoryExists(temp_dir_.path_): IsValid is false; Delete would
   succeed here (but we don't run it). It will check-fail-explode in
   ~ScopedTempDir. THIS IS BAD: we actually want to allow this case because
   it's harmless.
3. Delete() fails for some other reason. IsValid is true; Delete will
   CHECK-fail here. This is fine (we want to catch this case early).
4. Delete() succeeds here. This is fine; it will fail in ~ScopedTempDir but
   silently (no thread error).
CONCLUSION: We need to still call Delete() even if IsValid() returns false,
to correct case #2.

Powered by Google App Engine
This is Rietveld 408576698