[libc-commits] [libc] 08ed199 - [libc] Fix incorrect RPC usage in tests

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Tue Oct 15 16:02:38 PDT 2024


Author: Joseph Huber
Date: 2024-10-15T18:02:26-05:00
New Revision: 08ed19994b2688a9643430b48669a3aef3dd3216

URL: https://github.com/llvm/llvm-project/commit/08ed19994b2688a9643430b48669a3aef3dd3216
DIFF: https://github.com/llvm/llvm-project/commit/08ed19994b2688a9643430b48669a3aef3dd3216.diff

LOG: [libc] Fix incorrect RPC usage in tests

Added: 
    

Modified: 
    libc/test/integration/startup/gpu/rpc_interface_test.cpp
    libc/test/integration/startup/gpu/rpc_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/integration/startup/gpu/rpc_interface_test.cpp b/libc/test/integration/startup/gpu/rpc_interface_test.cpp
index 674e2cc1ed7499..2dafa911783ffc 100644
--- a/libc/test/integration/startup/gpu/rpc_interface_test.cpp
+++ b/libc/test/integration/startup/gpu/rpc_interface_test.cpp
@@ -18,19 +18,26 @@ using namespace LIBC_NAMESPACE;
 static void test_interface(bool end_with_send) {
   uint64_t cnt = 0;
   rpc::Client::Port port = rpc::client.open<RPC_TEST_INTERFACE>();
-  port.send([&](rpc::Buffer *buffer) { buffer->data[0] = end_with_send; });
-  port.send([&](rpc::Buffer *buffer) { buffer->data[0] = cnt = cnt + 1; });
-  port.recv([&](rpc::Buffer *buffer) { cnt = buffer->data[0]; });
-  port.send([&](rpc::Buffer *buffer) { buffer->data[0] = cnt = cnt + 1; });
-  port.recv([&](rpc::Buffer *buffer) { cnt = buffer->data[0]; });
-  port.send([&](rpc::Buffer *buffer) { buffer->data[0] = cnt = cnt + 1; });
-  port.send([&](rpc::Buffer *buffer) { buffer->data[0] = cnt = cnt + 1; });
-  port.recv([&](rpc::Buffer *buffer) { cnt = buffer->data[0]; });
-  port.recv([&](rpc::Buffer *buffer) { cnt = buffer->data[0]; });
+  port.send(
+      [&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = end_with_send; });
+  port.send(
+      [&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = cnt = cnt + 1; });
+  port.recv([&](rpc::Buffer *buffer, uint32_t) { cnt = buffer->data[0]; });
+  port.send(
+      [&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = cnt = cnt + 1; });
+  port.recv([&](rpc::Buffer *buffer, uint32_t) { cnt = buffer->data[0]; });
+  port.send(
+      [&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = cnt = cnt + 1; });
+  port.send(
+      [&](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = cnt = cnt + 1; });
+  port.recv([&](rpc::Buffer *buffer, uint32_t) { cnt = buffer->data[0]; });
+  port.recv([&](rpc::Buffer *buffer, uint32_t) { cnt = buffer->data[0]; });
   if (end_with_send)
-    port.send([&](rpc::Buffer *buffer) { buffer->data[0] = cnt = cnt + 1; });
+    port.send([&](rpc::Buffer *buffer, uint32_t) {
+      buffer->data[0] = cnt = cnt + 1;
+    });
   else
-    port.recv([&](rpc::Buffer *buffer) { cnt = buffer->data[0]; });
+    port.recv([&](rpc::Buffer *buffer, uint32_t) { cnt = buffer->data[0]; });
   port.close();
 
   ASSERT_TRUE(cnt == 9 && "Invalid number of increments");

diff  --git a/libc/test/integration/startup/gpu/rpc_test.cpp b/libc/test/integration/startup/gpu/rpc_test.cpp
index 4032d890c53ec8..bec8171180a055 100644
--- a/libc/test/integration/startup/gpu/rpc_test.cpp
+++ b/libc/test/integration/startup/gpu/rpc_test.cpp
@@ -20,10 +20,10 @@ static void test_add_simple() {
   for (uint32_t i = 0; i < num_additions; ++i) {
     rpc::Client::Port port = rpc::client.open<RPC_TEST_INCREMENT>();
     port.send_and_recv(
-        [=](rpc::Buffer *buffer) {
+        [=](rpc::Buffer *buffer, uint32_t) {
           reinterpret_cast<uint64_t *>(buffer->data)[0] = cnt;
         },
-        [&](rpc::Buffer *buffer) {
+        [&](rpc::Buffer *buffer, uint32_t) {
           cnt = reinterpret_cast<uint64_t *>(buffer->data)[0];
         });
     port.close();
@@ -34,7 +34,7 @@ static void test_add_simple() {
 // Test to ensure that the RPC mechanism doesn't hang on divergence.
 static void test_noop(uint8_t data) {
   rpc::Client::Port port = rpc::client.open<RPC_NOOP>();
-  port.send([=](rpc::Buffer *buffer) { buffer->data[0] = data; });
+  port.send([=](rpc::Buffer *buffer, uint32_t) { buffer->data[0] = data; });
   port.close();
 }
 


        


More information about the libc-commits mailing list