linux: Get exe name from main arguments

When building in chromium, the test is linked into the crashpad_tests
target instead of crashpad_util_test.

Change-Id: I4e0f6b9956f191ebac10f0aaa3812e30885a4e0a
Reviewed-on: https://chromium-review.googlesource.com/1131688
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Joshua Peraza 2018-07-10 09:29:51 -07:00 committed by Commit Bot
parent cb41ba7471
commit 1e504474a0

View File

@ -26,6 +26,7 @@
#include "gtest/gtest.h"
#include "test/errors.h"
#include "test/linux/fake_ptrace_connection.h"
#include "test/main_arguments.h"
#include "test/multiprocess.h"
#include "util/linux/address_types.h"
#include "util/linux/memory_map.h"
@ -128,7 +129,7 @@ void TestAgainstCloneOrSelf(pid_t pid) {
ASSERT_TRUE(aux.GetValue(AT_EXECFN, &filename_addr));
std::string filename;
ASSERT_TRUE(memory.ReadCStringSizeLimited(filename_addr, 4096, &filename));
EXPECT_TRUE(filename.find("crashpad_util_test") != std::string::npos);
EXPECT_TRUE(filename.find(GetMainArguments()[0]) != std::string::npos);
#endif // AT_EXECFN
int ignore;