Merge pull request #10625

d1eaf54 tests: replace monotonic (tobtoht)
This commit is contained in:
tobtoht
2026-05-26 20:19:00 +00:00
3 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ Functional tests are located under the `tests/functional_tests` directory.
Building all the tests requires installing the following dependencies:
```bash
pip install requests psutil monotonic zmq deepdiff
pip install requests psutil zmq deepdiff
```
First, run a regtest daemon in the offline mode and with a fixed difficulty:
+2 -2
View File
@@ -68,7 +68,7 @@ monero_add_minimal_executable(cpu_power_test cpu_power_test.cpp)
find_package(Python3 REQUIRED)
execute_process(COMMAND ${Python3_EXECUTABLE} "-c" "import requests; import psutil; import monotonic; import zmq; import deepdiff; print('OK')" OUTPUT_VARIABLE REQUESTS_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${Python3_EXECUTABLE} "-c" "import requests; import psutil; import zmq; import deepdiff; print('OK')" OUTPUT_VARIABLE REQUESTS_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE)
if (REQUESTS_OUTPUT STREQUAL "OK")
add_test(
NAME functional_tests_rpc
@@ -77,7 +77,7 @@ if (REQUESTS_OUTPUT STREQUAL "OK")
NAME check_missing_rpc_methods
COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/check_missing_rpc_methods.py" "${CMAKE_SOURCE_DIR}")
else()
message(WARNING "functional_tests_rpc and check_missing_rpc_methods skipped, needs the 'requests', 'psutil', 'monotonic', 'zmq', and 'deepdiff' python modules")
message(WARNING "functional_tests_rpc and check_missing_rpc_methods skipped, needs the 'requests', 'psutil', 'zmq', and 'deepdiff' python modules")
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} functional_tests_rpc check_missing_rpc_methods)
if (EXPECT_FUNCTIONAL_TESTS)
message(FATAL_ERROR "Functional tests are expected")
+3 -4
View File
@@ -32,7 +32,6 @@
import time
import os
import math
import monotonic
import util_resources
import multiprocessing
import string
@@ -95,7 +94,7 @@ class MiningTest():
# This is the last measurement, since it takes very little time and can be placed timewise-closer to the mining itself.
available_ram = self.get_available_ram() # So far no ideas how to use this var, other than printing it
start = monotonic.monotonic()
start = time.monotonic()
daemon = Daemon()
wallet = Wallet()
@@ -165,7 +164,7 @@ class MiningTest():
seen_height = height
for _ in range(int(math.ceil(timeout))):
time.sleep(1)
seconds_passed = monotonic.monotonic() - start
seconds_passed = time.monotonic() - start
height = daemon.get_info().height
if height > seen_height:
break
@@ -272,7 +271,7 @@ class MiningTest():
def print_time_taken(self, start, msg_context):
if self.is_mining_silent():
return
seconds_passed = monotonic.monotonic() - start
seconds_passed = time.monotonic() - start
print("Time taken for", msg_context, "=", round(seconds_passed, 1), "s.")
def test_randomx(self):