Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: version output of taos/taosd/udfd #25912

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/util/tdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ extern const int32_t TYPE_BYTES[21];
#define TSDB_DEFAULT_PASS "taosdata"
#endif

#ifndef TD_PRODUCT_NAME
#ifdef TD_ENTERPRISE
#define TD_PRODUCT_NAME "TDengine Enterprise Edition"
#else
#define TD_PRODUCT_NAME "TDengine Community Edition"
#endif
#endif

#define TSDB_TRUE 1
#define TSDB_FALSE 0
#define TSDB_OK 0
Expand Down
13 changes: 4 additions & 9 deletions source/dnode/mgmt/exe/dmMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,12 @@ static void dmPrintArgs(int32_t argc, char const *argv[]) {
static void dmGenerateGrant() { mndGenerateMachineCode(); }

static void dmPrintVersion() {
printf("%s\ntaosd version: %s compatible_version: %s\n", TD_PRODUCT_NAME, version, compatible_version);
printf("git: %s\n", gitinfo);
#ifdef TD_ENTERPRISE
char *releaseName = "enterprise";
#else
char *releaseName = "community";
#endif
printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version);
printf("gitinfo: %s\n", gitinfo);
#ifdef TD_ENTERPRISE
printf("gitinfoOfInternal: %s\n", gitinfoOfInternal);
printf("git: %s\n", gitinfoOfInternal);
#endif
printf("buildInfo: %s\n", buildinfo);
printf("build: %s\n", buildinfo);
}

static void dmPrintHelp() {
Expand Down
11 changes: 3 additions & 8 deletions source/libs/function/src/udfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,14 +1242,9 @@ static int32_t udfdParseArgs(int32_t argc, char *argv[]) {
}

static void udfdPrintVersion() {
#ifdef TD_ENTERPRISE
char *releaseName = "enterprise";
#else
char *releaseName = "community";
#endif
printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version);
printf("gitinfo: %s\n", gitinfo);
printf("buildInfo: %s\n", buildinfo);
printf("udfd version: %s compatible_version: %s\n", version, compatible_version);
printf("git: %s\n", gitinfo);
printf("build: %s\n", buildinfo);
}

static int32_t udfdInitLog() {
Expand Down
2 changes: 1 addition & 1 deletion source/util/src/version.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ char version[64] = "${TD_VER_NUMBER}";
char compatible_version[12] = "${TD_VER_COMPATIBLE}";
char gitinfo[48] = "${TD_VER_GIT}";
char gitinfoOfInternal[48] = "${TD_VER_GIT_INTERNAL}";
char buildinfo[64] = "Built ${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} at ${TD_VER_DATE}";
char buildinfo[64] = "${TD_VER_OSTYPE}-${TD_VER_CPUTYPE} ${TD_VER_DATE}";

void libtaos_${TD_LIB_VER_NUMBER}_${TD_VER_OSTYPE}_${TD_VER_CPUTYPE}_${TD_VER_VERTYPE}() {};
8 changes: 4 additions & 4 deletions tests/system-test/0-others/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,17 @@ def check_gitinfo(self):
tdSql.query('show dnode 1 variables')
for i in tdSql.queryResult:
if i[1].lower() == "gitinfo":
taosd_gitinfo_sql = f"gitinfo: {i[2]}"
taosd_gitinfo_sql = f"git: {i[2]}"
taos_gitinfo_sql = ''
tdSql.query('show local variables')
for i in tdSql.queryResult:
if i[0].lower() == "gitinfo":
taos_gitinfo_sql = f"gitinfo: {i[1]}"
taos_gitinfo_sql = f"git: {i[1]}"
taos_info = os.popen('taos -V').read()
taos_gitinfo = re.findall("^gitinfo.*",taos_info,re.M)
taos_gitinfo = re.findall("^git: .*",taos_info,re.M)
tdSql.checkEqual(taos_gitinfo_sql,taos_gitinfo[0])
taosd_info = os.popen('taosd -V').read()
taosd_gitinfo = re.findall("^gitinfo.*",taosd_info,re.M)
taosd_gitinfo = re.findall("^git: .*",taosd_info,re.M)
tdSql.checkEqual(taosd_gitinfo_sql,taosd_gitinfo[0])

def show_base(self):
Expand Down
10 changes: 6 additions & 4 deletions tests/system-test/0-others/taosShell.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import socket
import os
import platform
import re
if platform.system().lower() == 'windows':
import wexpect as taosExpect
else:
Expand Down Expand Up @@ -370,10 +371,11 @@ def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstr
if retCode != "TAOS_OK":
tdLog.exit("taos -V fail")

version = 'version: ' + version
retVal = retVal.replace("\n", "")
retVal = retVal.replace("\r", "")
if retVal.startswith(version) == False:
version = 'taos version: ' + version
# retVal = retVal.replace("\n", "")
# retVal = retVal.replace("\r", "")
taosVersion = re.findall((f'^%s'%(version)), retVal,re.M)
if len(taosVersion) == 0:
print ("return version: [%s]"%retVal)
print ("dict version: [%s]"%version)
tdLog.exit("taos -V version not match")
Expand Down
6 changes: 3 additions & 3 deletions tools/shell/src/shellArguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,12 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
shell.info.promptSize = strlen(shell.info.promptHeader);
#ifdef TD_ENTERPRISE
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion),
"version: %s compatible_version: %s\ngitinfo: %s\ngitinfoOfInternal: %s\nbuildInfo: %s", version,
"%s\ntaos version: %s compatible_version: %s\ngit: %s\ngit: %s\nbuild: %s", TD_PRODUCT_NAME, version,
compatible_version, gitinfo, gitinfoOfInternal, buildinfo);
#else
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion),
"version: %s compatible_version: %s\ngitinfo: %s\nbuildInfo: %s", version, compatible_version, gitinfo,
buildinfo);
"%s\ntaos version: %s compatible_version: %s\ngit: %s\nbuild: %s", TD_PRODUCT_NAME, version,
compatible_version, gitinfo, buildinfo);
#endif

#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
Expand Down