Change socket path appending
This commit changes socketPath back to "\0obmc-console" and will append
configured socket ID to it if exists or append "default" as the default
socket ID. This help SOCKET_ID configured in configuration files can be
compatible with obmc-console.
Change-Id: I8539740030b3f9f28a049a4f6c721dd0419ec32f
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
diff --git a/test/host_console_test.cpp b/test/host_console_test.cpp
index 6334e24..6a16148 100644
--- a/test/host_console_test.cpp
+++ b/test/host_console_test.cpp
@@ -8,7 +8,8 @@
#include <gtest/gtest.h>
-static constexpr char socketPath[] = "\0obmc-console.default";
+static constexpr char socketPath[] = "\0obmc-console";
+static constexpr std::string defaultSocketId = "default";
/**
* @class HostConsoleTest
@@ -23,11 +24,15 @@
serverSocket = socket(AF_UNIX, SOCK_STREAM, 0);
ASSERT_NE(serverSocket, -1);
std::string path(socketPath, socketPath + sizeof(socketPath) - 1);
+ path += '.';
if (*socketId)
{
- path += '.';
path += socketId;
}
+ else
+ {
+ path += defaultSocketId;
+ }
sockaddr_un sa;
sa.sun_family = AF_UNIX;
memcpy(&sa.sun_path, path.c_str(), path.length());