summaryrefslogtreecommitdiffstats
path: root/base/process_util_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Linux: reenable malloc overrides.agl@chromium.org2010-01-081-41/+11
| | | | | | | | | | | | | | | | | (These were disabled in r35804 and r35810.) This time we are using the __libc_* names to get at the real glibc functions rather than dlsym. This now means that code that calls __libc_* gets the raw functions, not 'safe' ones. Also, this sets the visibility correctly. Previously we were not overriding malloc calls made in shared libraries. BUG=31809 TEST=Covered by unittests. http://codereview.chromium.org/533001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35823 0039d316-1c4b-4281-b951-d872f2087c98
* Also disable tests for code removed in r35804.agl@chromium.org2010-01-081-0/+6
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35810 0039d316-1c4b-4281-b951-d872f2087c98
* Mac: stop zombie ps processes from being created.viettrungluu@chromium.org2010-01-041-0/+22
| | | | | | | | | | | | | | | This fixes two bugs: - the output buffer for the ps command being run could be too small (fix: buffer enlargened); and - if the output buffer was too small, waitpid() wouldn't be called (fix: always call waitpid(), obviously). BUG=31378 TEST=On a big, long-running Chrome/Chromium (with many processes, e.g., renderers), check that there are no zombie ps processes (with PPID the browser process); looking at about:memory may help speed up the creation of such zombies. Also, run the new test, ProcessUtilTest.GetAppOutputRestrictedNoZombies. Review URL: http://codereview.chromium.org/523033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35456 0039d316-1c4b-4281-b951-d872f2087c98
* Changes to base/ from a combination of FreeBSD and OpenBSD patches.evan@chromium.org2009-12-291-0/+1
| | | | | | Review URL: http://codereview.chromium.org/495002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35321 0039d316-1c4b-4281-b951-d872f2087c98
* Enable TCMalloc on Linux by default.willchan@chromium.org2009-11-251-1/+14
| | | | | | | | | | This change also reworks the tcmalloc dependency to be added only to chrome and test_shell, instead of base. This is necessary since otherwise tcmalloc will be double initialized (by both the main executable and dlopen'd shared objects like the npapitestplugin.so). Add valgrind suppressions. This are invalid reads on static initialization in the VDSOSupport module. I haven't investigated it yet, but I suspect they're benign. BUG=http://crbug.com/28149, http://crbug.com/28385 Review URL: http://codereview.chromium.org/399081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33010 0039d316-1c4b-4281-b951-d872f2087c98
* linux: fix a warning in the process_util unittestvandebo@chromium.org2009-11-241-4/+5
| | | | | | | | | | | Original review: http://codereview.chromium.org/422003 BUG=none TEST=compiles on gcc 4.4 Review URL: http://codereview.chromium.org/431034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32972 0039d316-1c4b-4281-b951-d872f2087c98
* linux: fix a warning in the process_util unittestevan@chromium.org2009-11-201-1/+4
| | | | | | Review URL: http://codereview.chromium.org/422003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32648 0039d316-1c4b-4281-b951-d872f2087c98
* For Linux, override malloc and friends so that we can detect and then stop ↵vandebo@chromium.org2009-11-181-0/+94
| | | | | | | | | | | on out of memory. BUG=27222 TEST=new base unittests Review URL: http://codereview.chromium.org/391044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32395 0039d316-1c4b-4281-b951-d872f2087c98
* Mac: Implement about:memory.viettrungluu@chromium.org2009-11-051-0/+45
| | | | | | | | | | | | | | | This implements about:memory on Mac. It calls /bin/ps to obtain information about processes (this is Apple's officially supported "API"). Unfortunately, ps provides fairly minimal information (rss and vsize); top is better, but not a stable API -- it has changed greatly between Mac OS 10.5 and 10.6, and moreover the 10.6 version is more limited in its output formatting. BUG=9653 TEST=Go to about:memory under a variety of conditions (with a variety of browsers loaded). Review URL: http://codereview.chromium.org/333008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31168 0039d316-1c4b-4281-b951-d872f2087c98
* Lower priorities of background tabs on linux.davemoore@chromium.org2009-10-291-0/+14
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/345009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30470 0039d316-1c4b-4281-b951-d872f2087c98
* Remove deprecated CommandLine(std::wstring) ctor.evan@chromium.org2009-10-261-4/+4
| | | | | | | | | | | Add a ctor for creating a CommandLine for carrying arguments; convert all the users to either that or the FilePath version. BUG=24672 Review URL: http://codereview.chromium.org/329017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30117 0039d316-1c4b-4281-b951-d872f2087c98
* Fix ProcessUtilTest.FDRemapping hang on x86_64 by counting open fds in child ↵dkegel@google.com2009-10-201-1/+3
| | | | | | | | | | | process nondestructively BUG=25270 TEST=base_unittests --gtest_filter=ProcessUtilTest.FDRemapping on x86_64 linux Review URL: http://codereview.chromium.org/293018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29570 0039d316-1c4b-4281-b951-d872f2087c98
* Turn NULL used as int to 0.phajdan.jr@chromium.org2009-10-131-2/+2
| | | | | | | | | | | | | (Excluding chrome/browser/...) Landing patch for Jacob Mandelson. Original review: http://codereview.chromium.org/195067 BUG=none TEST=base_unittests & app_unittests Review URL: http://codereview.chromium.org/267076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28810 0039d316-1c4b-4281-b951-d872f2087c98
* linux: implement GetCPUUsage() so the task manager shows CPUevan@chromium.org2009-09-191-0/+20
| | | | | | | | | | | | | Discussed in part here: http://groups.google.com/group/chromium-dev/browse_thread/thread/8e91f66f9af6ccec This implements option 3, which turned out to be pretty simple. BUG=19864 Review URL: http://codereview.chromium.org/215020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26647 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Fix a ton of compiler warnings."tony@chromium.org2009-08-281-2/+2
| | | | | | | | | | | This reverts commit r24792. TBR=estade Review URL: http://codereview.chromium.org/179028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24796 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a ton of compiler warnings.estade@chromium.org2009-08-281-2/+2
| | | | | | | | | | | | | | | Most of these are classes with virtual methods lacking virtual destructors or NULL used in non-pointer context. BUG=none TEST=app_unittests && base_unittests --gtest_filter=-ConditionVariableTest.LargeFastTaskTest patch by Jacob Mandelson <jlmjlm [at] gmail> http://codereview.chromium.org/171028/show git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24792 0039d316-1c4b-4281-b951-d872f2087c98
* linux: call g_thread_init() at relevant startup pointsevan@chromium.org2009-08-251-28/+29
| | | | | | | | | | | | | | | | | | According to glib docs, we need to do this if it's at all possible for us to hit glib on multiple threads. This may be happening when we grab plugin metadata from the file thread. Rather than explicitly depending on gthread all over the place, just put it in with the GTK dep (since anywhere we're using GTK we ought to init gthread). (Note that this is *not* initializing the GDK locking system.) BUG=18957 Review URL: http://codereview.chromium.org/174264 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24207 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "linux: call g_thread_init() at relevant startup points"evan@chromium.org2009-08-251-29/+27
| | | | | | This reverts commit r24203, Mac breakage. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24204 0039d316-1c4b-4281-b951-d872f2087c98
* linux: call g_thread_init() at relevant startup pointsevan@chromium.org2009-08-251-27/+29
| | | | | | | | | | | | | | | | | | According to glib docs, we need to do this if it's at all possible for us to hit glib on multiple threads. This may be happening when we grab plugin metadata from the file thread. Rather than explicitly depending on gthread all over the place, just put it in with the GTK dep (since anywhere we're using GTK we ought to init gthread). (Note that this is *not* initializing the GDK locking system.) BUG=18957 Review URL: http://codereview.chromium.org/174264 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24203 0039d316-1c4b-4281-b951-d872f2087c98
* Enable zygote manager by default.dkegel@google.com2009-06-081-0/+7
| | | | | | | | | | | | | | Fix broken recursion check. Make OpenFile warning less scary, indicate it's normal at start of ui tests. Make ui tests pass. Avoid generating extra code on Mac. BUG=11841 TEST=start the browser, then make chrome and all .pak files unreadable; or alternately, start an installed browser, and uninstall the browser while it's running. Then create a new tab and browse to two new sites. Review URL: http://codereview.chromium.org/119289 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17909 0039d316-1c4b-4281-b951-d872f2087c98
* Harmonizing ProcessUtil::GetAppOutput on Win/Unixjcampan@chromium.org2009-06-041-8/+9
| | | | | | | | BUG=None TEST=Run the base unit-tests Review URL: http://codereview.chromium.org/119190 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17660 0039d316-1c4b-4281-b951-d872f2087c98
* POSIX: Add a macro for handling EINTR.agl@chromium.org2009-05-011-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On POSIX systems, system calls can be interrupted by signals. In this case, they'll return EINTR, indicating that the system call needs to be restarted. (The situation is a little more complicated than this with SA_RESTART, but you can read man 7 signal if you like.) The short of it is that you need to catch EINTR and restart the call for these system calls: * read, readv, write, writev, ioctl * open() when dealing with a fifo * wait* * Anything socket based (send*, recv*, connect, accept etc) * flock and lock control with fcntl * mq_ functions which can block * futex * sem_wait (and timed wait) * pause, sigsuspend, sigtimedwait, sigwaitinfo * poll, epoll_wait, select and 'p' versions of the same * msgrcv, msgsnd, semop, semtimedop * close (although, on Linux, EINTR won't happen here) * any sleep functions (careful, you need to handle this are restart with different arguments) We've been a little sloppy with this until now. This patch adds a macro for dealing with this and corrects every case of these system calls (that I found). The macro is HANDLE_EINTR in base/eintr_wrapper.h. It's safe to include on Windows and is a no-op there. On POSIX, it uses GCC magic to return the correct type based on the expression and restarts the system call if it throws EINTR. And you can use it like: HANDLE_EINTR(close(fd)); Or: ssize_t bytes_read = HANDLE_EINTR(read(fd, buffer, len)); *BEWARE* that it will evaluate the argument multiple times, so this is not safe: HANDLE_EINTR(close(FireMissiles())); http://groups.google.com/group/chromium-dev/browse_thread/thread/41a35b2a457d73a0 http://codereview.chromium.org/100225 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15102 0039d316-1c4b-4281-b951-d872f2087c98
* This CL adds a utility method that lets you start a process and block until ↵jcampan@chromium.org2009-04-211-1/+34
| | | | | | | | | | | | | the process terminates, and retrieve what the process printed to the standard output. That util function is needed for the new in-process test framework. It is Windows only for now. BUG=None TEST=Covered by new unit test. Review URL: http://codereview.chromium.org/87008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14135 0039d316-1c4b-4281-b951-d872f2087c98
* Add GetAppOutput function, a better replacement for popen.phajdan.jr@chromium.org2009-04-171-0/+16
| | | | | | | | | | | | It will replace popen call in chrome_process_util_linux. I don't see much benefit in having a Windows implementation (not many useful programs you can launch and get output), so POSIX-only. Review URL: http://codereview.chromium.org/67226 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13920 0039d316-1c4b-4281-b951-d872f2087c98
* This should make ProcessUtilTest.KillSlowChild not-flaky.phajdan.jr@chromium.org2009-03-161-9/+0
| | | | | | | | | | | | | | | | | There is no need to check process count (which tends to induce flakiness). In fact, we are already checking all important facts: - after checking that process handle is a not-null handle we know that the process started successfully - after WaitForSingleProcess returns true we know that the process finished successfully BUG=8811 Review URL: http://codereview.chromium.org/42224 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11728 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes a build break caused by r10178.hbono@chromium.org2009-02-231-1/+1
| | | | | | | | | | r10178 compares an int value 'written' with a size_t value 'sizeof(num_open_files)' in "base/process_util_unittest.cc" and it caused a compilation error on Mac and Linux. As a quick fix, this change casts the int value 'written' to size_t. TBR=xji Review URL: http://codereview.chromium.org/28019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10179 0039d316-1c4b-4281-b951-d872f2087c98
* Try to fix the tree.evan@chromium.org2009-02-231-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10177 0039d316-1c4b-4281-b951-d872f2087c98
* Fix more GCC 4.3 warnings.evan@chromium.org2009-02-231-2/+4
| | | | | | Review URL: http://codereview.chromium.org/27038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10170 0039d316-1c4b-4281-b951-d872f2087c98
* Fix the windows implementation of KillProcess and WaitForSingleProcess to ↵stoyan@chromium.org2009-02-091-0/+3
| | | | | | | | not close the process handle that they do not own. Review URL: http://codereview.chromium.org/24004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9400 0039d316-1c4b-4281-b951-d872f2087c98
* Rewrite the mac named process iterator:thomasvl@chromium.org2009-02-061-7/+0
| | | | | | | | | | - walk thru only processes for this user. - properly handle walking the data collect. - handle the number of processes increasing between count and data collection. Enable the one unittest the uses the named process iterator. Review URL: http://codereview.chromium.org/20122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9305 0039d316-1c4b-4281-b951-d872f2087c98
* Implement NamedProcessIterator in base/process_util_mac.mm. Patch by Naokimark@chromium.org2009-02-051-2/+4
| | | | | | | | | Takano <takano.naoki@gmail.com> Review URL: http://codereview.chromium.org/18192 Review URL: http://codereview.chromium.org/21097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9263 0039d316-1c4b-4281-b951-d872f2087c98
* Add routine to close file descriptors on execjeremy@chromium.org2009-01-291-0/+18
| | | | | | | | for linux and mac. See BUG 6598. Review URL: http://codereview.chromium.org/18801 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8892 0039d316-1c4b-4281-b951-d872f2087c98
* Call logging::InitLogging. The lack of this was causing some hangs (and ↵erikkay@google.com2009-01-131-2/+4
| | | | | | | | | | | possibly crashes) in ObserverListTest.BUG=6286 This CL has expanded to include some cleanup and refactoring of test_suite and related files, so that this logging change (and other improvements) are applied to all unit tests. Review URL: http://codereview.chromium.org/18003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7977 0039d316-1c4b-4281-b951-d872f2087c98
* Fix TODOs in base/ :phajdan.jr@chromium.org2009-01-131-2/+1
| | | | | | | | | | - switch to FilePath inside CopyDirectory - be less racy in ProcessUtilTest.KillSlowChild Review URL: http://codereview.chromium.org/17013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7948 0039d316-1c4b-4281-b951-d872f2087c98
* Processes take a long time to start if started via ssh,dkegel@google.com2008-12-301-1/+1
| | | | | | | | | | | | | as they now have to connect to the X server (not sure when we added that, or where, but it's happening). In my case, when running ProcessUtilTest.SpawnChild, it takes 1.7 seconds after the main process starts waiting for the child before the child finishes reading from the X server and exits. So raise timeout from one second to five seconds. Review URL: http://codereview.chromium.org/17022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7506 0039d316-1c4b-4281-b951-d872f2087c98
* * On POSIX, make sure we don't leak FDs when launching child Processes.jeremy@chromium.org2008-12-171-2/+75
| | | | | | | | | | | | * Add a facility to LaunchProcess() to remap a given FD into a child process. This change is needed for 2 reasons: 1)We want to use a socketpair() for IPC, the child process needs a known FD # for it's side of the socket. 2)The OS X Sandbox doesn't close FDs. Review URL: http://codereview.chromium.org/14497 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7175 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 7156.ojan@google.com2008-12-171-75/+2
| | | | | | | Broke the build. Review URL: http://codereview.chromium.org/15402 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7159 0039d316-1c4b-4281-b951-d872f2087c98
* * On POSIX, make sure we don't leak FDs when launching child Processes.jeremy@chromium.org2008-12-171-2/+75
| | | | | | | | | | | | * Add a facility to LaunchProcess() to remap a given FD into a child process. This change is needed for 2 reasons: 1)We want to use a socketpair() for IPC, the child process needs a known FD # for it's side of the socket. 2)The OS X Sandbox doesn't close FDs. Review URL: http://codereview.chromium.org/14497 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7156 0039d316-1c4b-4281-b951-d872f2087c98
* Add Terminate() to the Process object, have RenderProcessHost use this to ↵brettw@google.com2008-11-141-11/+12
| | | | | | | | | | avoid some more Windows specific code. Move Process and SharedMemory into the base namespace (most changes). Review URL: http://codereview.chromium.org/10895 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
* Fix compilation error on Windows and link error on Macdkegel@google.com2008-10-311-8/+5
| | | | | | Review URL: http://codereview.chromium.org/8781 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4320 0039d316-1c4b-4281-b951-d872f2087c98
* Port GetProcessCount(), KillProcesses(), and CleanupProcesses().dkegel@google.com2008-10-311-0/+41
| | | | | | | | | Also switch to fork() from vfork(), since strace on my box doesn't support vfork! It's deprecated, anyway. Review URL: http://codereview.chromium.org/8880 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4315 0039d316-1c4b-4281-b951-d872f2087c98
* 1) Add a new MULTIPROCESS_TEST_MAIN macro to store child process namesjeremy@chromium.org2008-10-291-2/+2
| | | | | | | | | | | | | | in a lookup table. Previously we were using different mechanisms on each platform to look up child process names at runtime. This broke on OS X where we strip the symbol table on release executables. 2) Enable process_util_unittest on OS X. Review URL: http://codereview.chromium.org/8864 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4165 0039d316-1c4b-4281-b951-d872f2087c98
* Added linux process utilities and tests.estade@chromium.org2008-10-221-3/+29
| | | | | | Review URL: http://codereview.chromium.org/7202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3715 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Add base to the repository.initial.commit2008-07-261-0/+99
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8 0039d316-1c4b-4281-b951-d872f2087c98