fix recallhis in pingtest

This commit is contained in:
lnk
2025-03-06 18:41:48 +08:00
parent 5c61b6cd2d
commit 8a5087f1b7
2 changed files with 120 additions and 66 deletions

View File

@@ -52,7 +52,12 @@ extern int G_TEST_NUM;
extern void ledger(const char* terminal_id = NULL,QIODevice* outputDevice = NULL);
extern void value_print(const char *variableName, QTcpSocket *clientSocket);
extern int TEST_PORT;
extern void telnetetst(QTcpSocket* clientSocket);
extern void redirectErrorOutput(bool enable);
extern void redirectWarnOutput(bool enable);
extern void redirectNormalOutput(bool enable);
extern void redirectDebugOutput(bool enable);
//////////////////////////////////////////////////////////////////////////////
@@ -150,6 +155,7 @@ public:
timer(NULL),
historyIndex(-1),
stopViewLog(false),
g_stopTelnetTest(false),
activeClient(NULL)
{
}
@@ -231,6 +237,13 @@ public slots:
TEST_NUM = num;
}
void setTestlog(bool flag) {
redirectErrorOutput(flag);
redirectWarnOutput(flag);
redirectNormalOutput(flag);
redirectDebugOutput(flag);
}
private slots:
/**
* @brief <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
@@ -309,11 +322,12 @@ private slots:
continue;
}
// 1) <20><><EFBFBD><EFBFBD> '`' <20>˳<EFBFBD> viewlog
// 1) <20><><EFBFBD><EFBFBD> '`' <20>˳<EFBFBD> viewlog <20><>ping
if (c == '`') {
std::cout << "Received '`' from shell socket! Exiting viewlog...\n";
if (activeClient == clientSocket) {
stopViewLog = true;
g_stopTelnetTest = true;
clientSocket->write("\r\x1B[K");
clientSocket->write("\r\nLog view stopped. Returning to shell.\r\n");
printPrompt(clientSocket);
@@ -417,6 +431,8 @@ private:
if (cmd == "help") {
QString helpText = "Available commands:\r\n";
helpText += "TEST_NUM=<num> - Set the TEST_NUM\r\n";
helpText += "LOG=<bool> - Set the LOG\r\n";
helpText += "telnettest - Set the telnettest\r\n";
helpText += "rc - Execute rocketmq_test_rc\r\n";
helpText += "rt - Execute rocketmq_test_rt\r\n";
helpText += "ud - Execute rocketmq_test_ud\r\n";
@@ -450,6 +466,23 @@ private:
clientSocket->write("Invalid number\r\n");
}
}
else if (cmd.startsWith("LOG=")) {
bool ok;
bool flag = cmd.mid(4).toInt(&ok);
if (ok) {
setTestlog(flag);
clientSocket->write("\r\x1B[K");
clientSocket->write("TEST_NUM updated\r\n");
} else {
clientSocket->write("\r\x1B[K");
clientSocket->write("Invalid number\r\n");
}
}
else if (cmd.startsWith("telnettest")) {
telnetetst(clientSocket);
clientSocket->write("\r\x1B[K");
clientSocket->write("Executed telnettest warning!!! it woont stop until finish!!!\r\n");
}
else if (cmd.startsWith("rc")) {
rocketmq_test_rc();
clientSocket->write("\r\x1B[K");
@@ -586,7 +619,9 @@ private:
QString currentCommand; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// viewlog <20><><EFBFBD><EFBFBD>
bool stopViewLog;
bool stopViewLog;
//ping<6E><67><EFBFBD><EFBFBD>
bool g_stopTelnetTest;
QTcpSocket* activeClient;
};