diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 23:27:58 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 23:27:58 +0000 |
commit | 80cca3168e3f6d924cbb802e1a5aa3d0fd3c9b00 (patch) | |
tree | 62b17280a3907934cb7d010d2be7f7442094d1b1 /chrome/test/page_cycler | |
parent | c05da6c33a38d32913d3f0886d8cb5dfef514744 (diff) | |
download | chromium_src-80cca3168e3f6d924cbb802e1a5aa3d0fd3c9b00.zip chromium_src-80cca3168e3f6d924cbb802e1a5aa3d0fd3c9b00.tar.gz chromium_src-80cca3168e3f6d924cbb802e1a5aa3d0fd3c9b00.tar.bz2 |
Raise the rlimit in the page cycler so we don't have to adapt a new reference build which would change the baseline on lot of tests and not just the page cycler.
Enable the intl* tests on mac.
TEST=the intl page cycler tests will run and also the reference version will.
BUG=8390
Review URL: http://codereview.chromium.org/125210
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/page_cycler')
-rw-r--r-- | chrome/test/page_cycler/page_cycler_test.cc | 66 |
1 files changed, 59 insertions, 7 deletions
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc index 9d2f01e..04d563c 100644 --- a/chrome/test/page_cycler/page_cycler_test.cc +++ b/chrome/test/page_cycler/page_cycler_test.cc @@ -20,6 +20,12 @@ #include "googleurl/src/gurl.h" #include "net/base/net_util.h" +#if defined(OS_MACOSX) +#include <errno.h> +#include <string.h> +#include <sys/resource.h> +#endif + #ifndef NDEBUG #define TEST_ITERATIONS "2" #else @@ -32,7 +38,44 @@ static const char kBaseUrl[] = "http://localhost:8000/"; namespace { +#if defined(OS_MACOSX) +// TODO(tvl/stuart): remove all this fd limit setting on the Mac when/if we +// replace the Mac reference build. The trunk raises the limit within the +// browser app, but we do this here also so the current reference build without +// that code will pass the intl[12] tests. This keeps us on an older +// reference build for all the other reference tests (javascript benchmarks, +// tab switch, etc.). +rlim_t GetFileDescriptorLimit(void) { + struct rlimit limits; + if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { + return limits.rlim_cur; + } + LOG(ERROR) << "Failed to get file descriptor limit: " << strerror(errno); + return 0; +} + +void SetFileDescriptorLimit(rlim_t max_descriptors) { + struct rlimit limits; + if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { + if (limits.rlim_max == 0) { + limits.rlim_cur = max_descriptors; + } else { + limits.rlim_cur = std::min(max_descriptors, limits.rlim_max); + } + if (setrlimit(RLIMIT_NOFILE, &limits) != 0) { + LOG(ERROR) << "Failed to set file descriptor limit: " << strerror(errno); + } + } else { + LOG(ERROR) << "Failed to get file descriptor limit: " << strerror(errno); + } +} +#endif + class PageCyclerTest : public UITest { +#if defined(OS_MACOSX) + protected: + rlim_t fd_limit_; +#endif public: PageCyclerTest() { show_window_ = true; @@ -40,6 +83,17 @@ class PageCyclerTest : public UITest { // Expose garbage collection for the page cycler tests. launch_arguments_.AppendSwitchWithValue(switches::kJavaScriptFlags, L"--expose_gc"); +#if defined(OS_MACOSX) + static rlim_t initial_fd_limit = GetFileDescriptorLimit(); + fd_limit_ = initial_fd_limit; +#endif + } + + void SetUp() { +#if defined(OS_MACOSX) + SetFileDescriptorLimit(fd_limit_); +#endif + UITest::SetUp(); } // For HTTP tests, the name must be safe for use in a URL without escaping. @@ -232,6 +286,10 @@ class PageCyclerReferenceTest : public PageCyclerTest { // override the browser directory that is used by UITest::SetUp to cause it // to use the reference build instead. void SetUp() { +#if defined(OS_MACOSX) + fd_limit_ = 1024; +#endif + FilePath dir; PathService::Get(chrome::DIR_TEST_TOOLS, &dir); dir = dir.AppendASCII("reference_build"); @@ -243,7 +301,7 @@ class PageCyclerReferenceTest : public PageCyclerTest { dir = dir.AppendASCII("chrome_mac"); #endif browser_directory_ = dir; - UITest::SetUp(); + PageCyclerTest::SetUp(); } void RunTest(const char* name, bool use_http) { @@ -270,9 +328,6 @@ TEST_F(PageCyclerReferenceTest, MozFile) { RunTest("moz", false); } -#if !defined(OS_MACOSX) -// TODO(nirnimesh): Intl1File, Intl2File, Intl1Http, Intl2Http crash Chromium -// on Mac. Revisit later. TEST_F(PageCyclerTest, Intl1File) { RunTest("intl1", false); } @@ -288,7 +343,6 @@ TEST_F(PageCyclerTest, Intl2File) { TEST_F(PageCyclerReferenceTest, Intl2File) { RunTest("intl2", false); } -#endif // !defined(OS_MACOSX) TEST_F(PageCyclerTest, DomFile) { RunTest("dom", false); @@ -315,7 +369,6 @@ TEST_F(PageCyclerReferenceTest, MozHttp) { RunTest("moz", true); } -#if !defined(OS_MACOSX) TEST_F(PageCyclerTest, Intl1Http) { RunTest("intl1", true); } @@ -331,7 +384,6 @@ TEST_F(PageCyclerTest, Intl2Http) { TEST_F(PageCyclerReferenceTest, Intl2Http) { RunTest("intl2", true); } -#endif // !defined(OS_MACOSX) TEST_F(PageCyclerTest, DomHttp) { RunTest("dom", true); |