diff options
author | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 20:17:43 +0000 |
---|---|---|
committer | glotov@chromium.org <glotov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 20:17:43 +0000 |
commit | 8f732995213942d1e70a08a11333c6830e527782 (patch) | |
tree | 5f1c05808c3015013e01fc93db1e5f4f9425e61e /chrome/test/base/chrome_test_suite.cc | |
parent | b2deb2f66b17f7e7ae036287d2773b9e82593089 (diff) | |
download | chromium_src-8f732995213942d1e70a08a11333c6830e527782.zip chromium_src-8f732995213942d1e70a08a11333c6830e527782.tar.gz chromium_src-8f732995213942d1e70a08a11333c6830e527782.tar.bz2 |
Prevent loading libffmpegsumo.so to python (autotests) process.
This is needed for ASAN environment because libffmpegsumo.so, being
built with ASAN support, fails to load to python process (which is not
ASAN-ed currently). At the same time it loads file to chrome or to
gtest processes (like content_unittests) because they do have ASAN
runtime.
FYI: Alternative approach (https://chromiumcodereview.appspot.com/10692190/)
was skipped because it disallowed ASAN to test libffmpegsumo.so.
BUG=chromium-os:32259
TESTS=unit
Review URL: https://chromiumcodereview.appspot.com/10786038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/base/chrome_test_suite.cc')
-rw-r--r-- | chrome/test/base/chrome_test_suite.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc index 5ef7802..72b1fba 100644 --- a/chrome/test/base/chrome_test_suite.cc +++ b/chrome/test/base/chrome_test_suite.cc @@ -4,6 +4,11 @@ #include "chrome/test/base/chrome_test_suite.h" +#if defined(OS_CHROMEOS) +#include <stdio.h> +#include <unistd.h> +#endif + #include "base/command_line.h" #include "base/file_util.h" #include "base/memory/ref_counted.h" @@ -48,6 +53,19 @@ void RemoveSharedMemoryFile(const std::string& filename) { #endif } +bool IsCrosPythonProcess() { +#if defined(OS_CHROMEOS) + char buf[80]; + int num_read = readlink("/proc/self/exe", buf, sizeof(buf) - 1); + if (num_read == -1) + return false; + buf[num_read] = 0; + const char kPythonPrefix[] = "/python"; + return !strncmp(strrchr(buf, '/'), kPythonPrefix, sizeof(kPythonPrefix) - 1); +#endif // defined(OS_CHROMEOS) + return false; +} + // In many cases it may be not obvious that a test makes a real DNS lookup. // We generally don't want to rely on external DNS servers for our tests, // so this host resolver procedure catches external queries and returns a failed @@ -171,6 +189,12 @@ void ChromeTestSuite::Initialize() { PathService::Override(base::DIR_MODULE, browser_dir_); } + // Disable external libraries load if we are under python process in + // ChromeOS. That means we are autotest and, if ASAN is used, + // external libraries load crashes. + content::ContentTestSuiteBase::set_external_libraries_enabled( + !IsCrosPythonProcess()); + // Initialize after overriding paths as some content paths depend on correct // values for DIR_EXE and DIR_MODULE. content::ContentTestSuiteBase::Initialize(); |