From ac6db928c23310c7472fea540e6d54478c7981c8 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 21 Jul 2022 11:35:35 +0000 Subject: [PATCH 1/2] functional_tests: silence the cpu power test program it's very spammy and drowns the test output --- tests/functional_tests/functional_tests_rpc.py | 2 ++ tests/functional_tests/mining.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py index 450552cf8..322e74e95 100755 --- a/tests/functional_tests/functional_tests_rpc.py +++ b/tests/functional_tests/functional_tests_rpc.py @@ -97,6 +97,8 @@ try: os.environ['MAKE_TEST_SIGNATURE'] = FUNCTIONAL_TESTS_DIRECTORY + '/make_test_signature' os.environ['SEEDHASH_EPOCH_BLOCKS'] = "8" os.environ['SEEDHASH_EPOCH_LAG'] = "4" + if not 'MINING_SILENT' in os.environ: + os.environ['MINING_SILENT'] = "1" for i in range(len(command_lines)): #print('Running: ' + str(command_lines[i])) diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py index f1aa15c14..a315ae97f 100755 --- a/tests/functional_tests/mining.py +++ b/tests/functional_tests/mining.py @@ -221,7 +221,7 @@ class MiningTest(): available_ram = util_resources.available_ram_gb() threshold_ram = 3 self.print_mining_info("Available RAM = " + str(round(available_ram, 1)) + " GB") - if available_ram < threshold_ram: + if available_ram < threshold_ram and not self.is_mining_silent(): print("Warning! Available RAM =", round(available_ram, 1), "GB is less than the reasonable threshold =", threshold_ram, ". The RX init might exceed the calculated timeout.") @@ -255,7 +255,7 @@ class MiningTest(): assert res.hash == block_hash def is_mining_silent(self): - return 'MINING_SILENT' in os.environ + return 'MINING_SILENT' in os.environ and os.environ['MINING_SILENT'] != "0" def print_mining_info(self, msg): if self.is_mining_silent(): From 600de07bcfecc5e31b52257849fa42589167ee51 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 21 Jul 2022 11:36:55 +0000 Subject: [PATCH 2/2] wallet_rpc_server: longer timeout for stop_mining That RPC will wait for mining to actually stop, which can be a while if randomx has just started on randomx_init_dataset. This fixes occasional failures in the mining functional test --- src/wallet/wallet_rpc_server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index 7ec5fc7a1..7a6d39a43 100644 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -3254,7 +3254,7 @@ namespace tools if (!m_wallet) return not_open(er); cryptonote::COMMAND_RPC_STOP_MINING::request daemon_req; cryptonote::COMMAND_RPC_STOP_MINING::response daemon_res; - bool r = m_wallet->invoke_http_json("/stop_mining", daemon_req, daemon_res); + bool r = m_wallet->invoke_http_json("/stop_mining", daemon_req, daemon_res, std::chrono::seconds(60)); // this waits till stopped, and if randomx has just started initializing its dataset, it might be a while if (!r || daemon_res.status != CORE_RPC_STATUS_OK) { er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;