aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer/linux_dumper_unittest.cc
diff options
context:
space:
mode:
authorted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-10-20 15:51:38 +0000
committerted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-10-20 15:51:38 +0000
commitcfc8628092e17069d8d6c7068d4f21d9baabe077 (patch)
tree43e9d016602ec4944511a3f02981a004a6225ef5 /src/client/linux/minidump_writer/linux_dumper_unittest.cc
parentDouble stack scanning length in stackwalker (diff)
downloadbreakpad-cfc8628092e17069d8d6c7068d4f21d9baabe077.tar.xz
Add support for building the Linux client code using the Android NDK
r=mwu at http://breakpad.appspot.com/212001/show git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@716 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/minidump_writer/linux_dumper_unittest.cc')
-rw-r--r--src/client/linux/minidump_writer/linux_dumper_unittest.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_dumper_unittest.cc
index 8cfb6004..b81291b6 100644
--- a/src/client/linux/minidump_writer/linux_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_dumper_unittest.cc
@@ -27,6 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#include <string>
+
#include <limits.h>
#include <unistd.h>
#include <signal.h>
@@ -37,6 +39,7 @@
#include "common/linux/file_id.h"
#include "common/memory.h"
+using std::string;
using namespace google_breakpad;
// This provides a wrapper around system calls which may be
@@ -87,21 +90,36 @@ TEST(LinuxDumperTest, VerifyStackReadWithMultipleThreads) {
pid_t child_pid = fork();
if (child_pid == 0) {
+ // Locate helper binary next to the current binary.
+ char self_path[PATH_MAX];
+ if (readlink("/proc/self/exe", self_path, sizeof(self_path) - 1) == -1) {
+ FAIL() << "readlink failed: " << strerror(errno);
+ exit(1);
+ }
+ string helper_path(self_path);
+ size_t pos = helper_path.rfind('/');
+ if (pos == string::npos) {
+ FAIL() << "no trailing slash in path: " << helper_path;
+ exit(1);
+ }
+ helper_path.erase(pos + 1);
+ helper_path += "linux_dumper_unittest_helper";
+
// Set the number of threads
- execl("src/client/linux/linux_dumper_unittest_helper",
+ execl(helper_path.c_str(),
"linux_dumper_unittest_helper",
kNumberOfThreadsArgument,
NULL);
// Kill if we get here.
printf("Errno from exec: %d", errno);
- FAIL() << "Exec failed: " << strerror(errno);
+ FAIL() << "Exec of " << helper_path << " failed: " << strerror(errno);
exit(0);
}
// The sleep is flaky, but prevents us from reading
// the child process before all threads have been created.
sleep(1);
LinuxDumper dumper(child_pid);
- EXPECT_TRUE(dumper.Init());
+ ASSERT_TRUE(dumper.Init());
EXPECT_EQ((size_t)kNumberOfThreadsInHelperProgram, dumper.threads().size());
EXPECT_TRUE(dumper.ThreadsSuspend());