Add the function of outputting rdcd version information

Change-Id: I0572fd4b98f697660ab9099deabfd4f0fce802f3
Signed-off-by: Chen Gong <curry.gong@amd.com>


[ROCm/rdc commit: 9f8d447e75]
This commit is contained in:
Chen Gong
2024-08-21 12:46:35 +08:00
کامیت شده توسط Galantsev, Dmitrii
والد 5db56b48eb
کامیت c495b7d086
2فایلهای تغییر یافته به همراه22 افزوده شده و 1 حذف شده
@@ -30,6 +30,17 @@ THE SOFTWARE.
#include "rdc/rdc_admin_service.h"
#include "rdc/rdc_api_service.h"
#define RDC_SERVER_VERSION_MAJOR 1
#define RDC_SERVER_VERSION_MINOR 0
#define RDC_SERVER_VERSION_RELEASE 0
#define RDC_SERVER_VERSION_CREATE_STRING(MAJOR, MINOR, RELEASE) (#MAJOR "." #MINOR "." #RELEASE)
#define RDC_SERVER_VERSION_EXPAND_PARTS(MAJOR_STR, MINOR_STR, RELEASE_STR) RDC_SERVER_VERSION_CREATE_STRING(MAJOR_STR, MINOR_STR, RELEASE_STR)
#define RDC_SERVER_VERSION_STRING RDC_SERVER_VERSION_EXPAND_PARTS(RDC_SERVER_VERSION_MAJOR, RDC_SERVER_VERSION_MINOR, RDC_SERVER_VERSION_RELEASE)
#define Q(x) #x
#define QUOTE(x) Q(x)
typedef struct {
std::string listen_address;
std::string listen_port;
@@ -476,10 +476,11 @@ static const struct option long_options[] = {{"address", required_argument, null
{"unauth_comm", no_argument, nullptr, 'u'},
{"pinned_cert", no_argument, nullptr, 'i'},
{"debug", no_argument, nullptr, 'd'},
{"version", no_argument, nullptr, 'v'},
{"help", no_argument, nullptr, 'h'},
{nullptr, 0, nullptr, 0}};
static const char* short_options = "a:p:uidh";
static const char* short_options = "a:p:uidvh";
static void PrintHelp(void) {
std::cout << "Optional rdctst Arguments:\n"
@@ -493,6 +494,7 @@ static void PrintHelp(void) {
"--pinned_cert, -i used \"pinned\" certificates instead of PKI "
"authentication. This is for test purposes.\n"
"--debug, -d output debug messages\n"
"--version, -v Output version information\n"
"--help, -h print this message\n";
}
@@ -538,6 +540,14 @@ uint32_t ProcessCmdline(RdcdCmdLineOpts* cmdl_opts, int arg_cnt, char** arg_list
cmdl_opts->log_dbg = true;
break;
case 'v':
#ifdef CURRENT_GIT_HASH
std::cout << "RDCD : " << RDC_SERVER_VERSION_STRING << "+" << QUOTE(CURRENT_GIT_HASH) << std::endl;
#else
std::cout << "RDCD : " << RDC_SERVER_VERSION_STRING << std::endl;
#endif
exit(0);
case 'h':
PrintHelp();
exit(0);