mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1845146 - Check numberOfBytes{Read,Written} in TestManyHandles, r=ipc-reviewers,handyman
When running GTests on Windows 7, the TestManyHandles test crashes due to the lpNumberOfBytesWritten argument to WriteFile not being passed. This argument is required on earlier versions of Windows like Windows 7. While we no longer support Windows 7 on Nightly, we still support it on ESR, and are trying to run GTests on Windows 7 there. It also doesn't hurt to add extra assertions that the full amount of data is read/written, so checking this could be valuable on m-c as well. Differential Revision: https://phabricator.services.mozilla.com/D184393
This commit is contained in:
parent
a977528435
commit
e21e43e089
@ -25,7 +25,10 @@ class TestManyHandlesChild : public PTestManyHandlesChild {
|
||||
int value;
|
||||
const int size = sizeof(value);
|
||||
#ifdef XP_WIN
|
||||
EXPECT_TRUE(::ReadFile(handle.get(), &value, size, nullptr, nullptr));
|
||||
DWORD numberOfBytesRead;
|
||||
EXPECT_TRUE(
|
||||
::ReadFile(handle.get(), &value, size, &numberOfBytesRead, nullptr));
|
||||
EXPECT_EQ(numberOfBytesRead, (DWORD)size);
|
||||
#else
|
||||
EXPECT_EQ(read(handle.get(), &value, size), size);
|
||||
#endif
|
||||
@ -55,7 +58,10 @@ IPDL_TEST(TestManyHandles) {
|
||||
#ifdef XP_WIN
|
||||
ASSERT_TRUE(::CreatePipe(getter_Transfers(readPipe),
|
||||
getter_Transfers(writePipe), nullptr, size));
|
||||
ASSERT_TRUE(::WriteFile(writePipe.get(), &i, size, nullptr, nullptr));
|
||||
DWORD numberOfBytesWritten;
|
||||
ASSERT_TRUE(
|
||||
::WriteFile(writePipe.get(), &i, size, &numberOfBytesWritten, nullptr));
|
||||
ASSERT_EQ(numberOfBytesWritten, (DWORD)size);
|
||||
#else
|
||||
int fds[2];
|
||||
ASSERT_EQ(pipe(fds), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user