mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
fuchsia: Fix child process reader test to do what it should be doing
This "child" test was actually reading itself (whoops!). Instead, pass the address of the string to be read back from the child and read that. Bug: crashpad:196 Change-Id: I27aa4cd06c69cd492cb3387a5a773a56e9cb02a3 Reviewed-on: https://chromium-review.googlesource.com/1033712 Reviewed-by: Joshua Peraza <jperaza@chromium.org> Commit-Queue: Scott Graham <scottmg@chromium.org>
This commit is contained in:
parent
d4533dc92b
commit
63d331e57a
@ -60,6 +60,9 @@ TEST(ProcessReaderFuchsia, SelfBasic) {
|
||||
constexpr char kTestMemory[] = "Read me from another process";
|
||||
|
||||
CRASHPAD_CHILD_TEST_MAIN(ProcessReaderBasicChildTestMain) {
|
||||
zx_vaddr_t addr = reinterpret_cast<zx_vaddr_t>(kTestMemory);
|
||||
CheckedWriteFile(
|
||||
StdioFileHandle(StdioStream::kStandardOutput), &addr, sizeof(addr));
|
||||
CheckedReadFileAtEOF(StdioFileHandle(StdioStream::kStandardInput));
|
||||
return 0;
|
||||
}
|
||||
@ -74,11 +77,13 @@ class BasicChildTest : public MultiprocessExec {
|
||||
private:
|
||||
void MultiprocessParent() override {
|
||||
ProcessReaderFuchsia process_reader;
|
||||
ASSERT_TRUE(process_reader.Initialize(zx_process_self()));
|
||||
ASSERT_TRUE(process_reader.Initialize(ChildProcess()));
|
||||
|
||||
zx_vaddr_t addr;
|
||||
ASSERT_TRUE(ReadFileExactly(ReadPipeHandle(), &addr, sizeof(addr)));
|
||||
|
||||
std::string read_string;
|
||||
ASSERT_TRUE(process_reader.Memory()->ReadCString(
|
||||
reinterpret_cast<zx_vaddr_t>(kTestMemory), &read_string));
|
||||
ASSERT_TRUE(process_reader.Memory()->ReadCString(addr, &read_string));
|
||||
EXPECT_EQ(read_string, kTestMemory);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user