diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 23:41:28 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-01 23:41:28 +0000 |
commit | a886016f3832c865d88c120203840c573adb3e3f (patch) | |
tree | f35070c68a26843cbc232b8a343d23a102a4a7e6 /chrome/test/startup | |
parent | 74ac3f6ae67edb83637ee89164f355b3824e0726 (diff) | |
download | chromium_src-a886016f3832c865d88c120203840c573adb3e3f.zip chromium_src-a886016f3832c865d88c120203840c573adb3e3f.tar.gz chromium_src-a886016f3832c865d88c120203840c573adb3e3f.tar.bz2 |
this move file is failing really often on some buildbots, I added some
code to retry on failure.
Review URL: http://codereview.chromium.org/6052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/startup')
-rw-r--r-- | chrome/test/startup/startup_test.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index ae98a87..d6b8c3b 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -11,6 +11,18 @@ namespace { +// Wrapper around CopyFile to retry 10 times if there is an error. +// For some reasons on buildbot it happens quite often that +// the test fails because the dll is still in use. +bool CopyFileWrapper(const std::wstring &src, const std::wstring &dest) { + for (int i = 0; i < 10; ++i) { + if (file_util::CopyFile(src, dest)) + return true; + Sleep(1000); + } + return false; +} + class StartupTest : public UITest { public: StartupTest() { @@ -29,18 +41,18 @@ class StartupTest : public UITest { ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &chrome_dll)); file_util::AppendToPath(&chrome_dll, L"chrome.dll"); chrome_dll_copy = chrome_dll + L".copy"; - ASSERT_TRUE(file_util::CopyFile(chrome_dll, chrome_dll_copy)); + ASSERT_TRUE(CopyFileWrapper(chrome_dll, chrome_dll_copy)); std::wstring gears_dll, gears_dll_copy; ASSERT_TRUE(PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_dll)); gears_dll_copy = gears_dll + L".copy"; - ASSERT_TRUE(file_util::CopyFile(gears_dll, gears_dll_copy)); + ASSERT_TRUE(CopyFileWrapper(gears_dll, gears_dll_copy)); TimeDelta timings[kNumCycles]; for (int i = 0; i < kNumCycles; ++i) { if (test_cold) { - ASSERT_TRUE(file_util::CopyFile(chrome_dll_copy, chrome_dll)); - ASSERT_TRUE(file_util::CopyFile(gears_dll_copy, gears_dll)); + ASSERT_TRUE(CopyFileWrapper(chrome_dll_copy, chrome_dll)); + ASSERT_TRUE(CopyFileWrapper(gears_dll_copy, gears_dll)); } UITest::SetUp(); |