diff options
| author | 2017-06-22 21:59:25 -0400 | |
|---|---|---|
| committer | 2017-06-22 21:59:25 -0400 | |
| commit | 8223d180881aa997f13819507bef8941fdfce4cf (patch) | |
| tree | a65e3e38c77d7bd65154cbe752746e73a77faf8a /src/tests | |
| parent | Merge pull request #2792 from wwylele/lutlutlut (diff) | |
| parent | Kernel: Fix typo in test name (diff) | |
| download | yuzu-8223d180881aa997f13819507bef8941fdfce4cf.tar.gz yuzu-8223d180881aa997f13819507bef8941fdfce4cf.tar.xz yuzu-8223d180881aa997f13819507bef8941fdfce4cf.zip | |
Merge pull request #2796 from yuriks/hle-null-handles
Kernel/IPC: Support translation of null handles
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/core/hle/kernel/hle_ipc.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/tests/core/hle/kernel/hle_ipc.cpp b/src/tests/core/hle/kernel/hle_ipc.cpp index e07a28c5b..52336d027 100644 --- a/src/tests/core/hle/kernel/hle_ipc.cpp +++ b/src/tests/core/hle/kernel/hle_ipc.cpp | |||
| @@ -18,7 +18,7 @@ static SharedPtr<Object> MakeObject() { | |||
| 18 | return Event::Create(ResetType::OneShot); | 18 | return Event::Create(ResetType::OneShot); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | TEST_CASE("HLERequestContext::PopoulateFromIncomingCommandBuffer", "[core][kernel]") { | 21 | TEST_CASE("HLERequestContext::PopulateFromIncomingCommandBuffer", "[core][kernel]") { |
| 22 | auto session = std::get<SharedPtr<ServerSession>>(ServerSession::CreateSessionPair()); | 22 | auto session = std::get<SharedPtr<ServerSession>>(ServerSession::CreateSessionPair()); |
| 23 | HLERequestContext context(std::move(session)); | 23 | HLERequestContext context(std::move(session)); |
| 24 | 24 | ||
| @@ -94,6 +94,18 @@ TEST_CASE("HLERequestContext::PopoulateFromIncomingCommandBuffer", "[core][kerne | |||
| 94 | REQUIRE(context.GetIncomingHandle(output[5]) == c); | 94 | REQUIRE(context.GetIncomingHandle(output[5]) == c); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | SECTION("translates null handles") { | ||
| 98 | const u32_le input[]{ | ||
| 99 | IPC::MakeHeader(0, 0, 2), IPC::MoveHandleDesc(1), 0, | ||
| 100 | }; | ||
| 101 | |||
| 102 | auto result = context.PopulateFromIncomingCommandBuffer(input, *process, handle_table); | ||
| 103 | |||
| 104 | REQUIRE(result == RESULT_SUCCESS); | ||
| 105 | auto* output = context.CommandBuffer(); | ||
| 106 | REQUIRE(context.GetIncomingHandle(output[2]) == nullptr); | ||
| 107 | } | ||
| 108 | |||
| 97 | SECTION("translates CallingPid descriptors") { | 109 | SECTION("translates CallingPid descriptors") { |
| 98 | const u32_le input[]{ | 110 | const u32_le input[]{ |
| 99 | IPC::MakeHeader(0, 0, 2), IPC::CallingPidDesc(), 0x98989898, | 111 | IPC::MakeHeader(0, 0, 2), IPC::CallingPidDesc(), 0x98989898, |
| @@ -171,6 +183,17 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") { | |||
| 171 | REQUIRE(handle_table.GetGeneric(output[4]) == b); | 183 | REQUIRE(handle_table.GetGeneric(output[4]) == b); |
| 172 | } | 184 | } |
| 173 | 185 | ||
| 186 | SECTION("translates null handles") { | ||
| 187 | input[0] = IPC::MakeHeader(0, 0, 2); | ||
| 188 | input[1] = IPC::MoveHandleDesc(1); | ||
| 189 | input[2] = context.AddOutgoingHandle(nullptr); | ||
| 190 | |||
| 191 | auto result = context.WriteToOutgoingCommandBuffer(output, *process, handle_table); | ||
| 192 | |||
| 193 | REQUIRE(result == RESULT_SUCCESS); | ||
| 194 | REQUIRE(output[2] == 0); | ||
| 195 | } | ||
| 196 | |||
| 174 | SECTION("translates multi-handle descriptors") { | 197 | SECTION("translates multi-handle descriptors") { |
| 175 | auto a = MakeObject(); | 198 | auto a = MakeObject(); |
| 176 | auto b = MakeObject(); | 199 | auto b = MakeObject(); |