tests: add short wait before ping command to ensure jade has returned to idle status
What changed, and why it matters
This change only adjusts the project's automated test suite. It adds a one-second wait before sending a 'ping' check so the test hardware has time to finish background tasks before the test asserts it is idle. There is no change to the actual Jade firmware or wallet software that users rely on, and no security fix or vulnerability is present in the diff.
No security action needed. Treat as a normal test reliability improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors test_jade.py to introduce an assert_idle() helper that sleeps one second and then pings the device to confirm an idle state. It replaces several direct ping/assert pairs in run_api_tests() and run_interface_tests(), and adds a wait in test_ping_protocol(). The diff is purely test-harness timing/robustness; no firmware, protocol, or cryptographic code is modified.
Changed components
test_jade.pyInspect captured patch +11 / −10
diff --git a/test_jade.py b/test_jade.py
index cc9b27b..2a024ed 100644
--- a/test_jade.py
+++ b/test_jade.py
@@ -712,6 +712,12 @@ b2e95dc777c4d7df504ced12fd668f81a11d14d30033831df1434b59d7',
# The tests
+def assert_idle(jade):
+ wait(1) # Short delay to ensure return to idle status
+ rslt = jade.ping()
+ assert rslt == 0 # idle
+
+
def test_bad_message(jade):
bad_requests = [{'method': 'get_version_info'}, # no-id
{'id': '2'}, # no method
@@ -3764,6 +3770,7 @@ def test_ping_protocol(jade):
sigABC2 = jade.make_rpc_call(getsig)['result']
assert sigABC2 == sigABC1
+ wait(1) # short delay to ensure return to idle status
jade_is_busy = jade.make_rpc_call(jade.build_request('pingAGAIN', 'ping'))['result']
assert jade_is_busy == 0 # idle
@@ -3773,8 +3780,7 @@ def run_api_tests(jadeapi, isble, qemu, authuser=False):
rslt = jadeapi.clean_reset()
assert rslt is True
- rslt = jadeapi.ping()
- assert rslt == 0 # idle
+ assert_idle(jadeapi)
# On connection, a companion app should:
# a) get the version info and check is compatible, needs update, etc.
@@ -3811,8 +3817,7 @@ def run_api_tests(jadeapi, isble, qemu, authuser=False):
rslt = jadeapi.set_mnemonic(TEST_MNEMONIC)
assert jadeapi.get_version_info()['JADE_STATE'] == 'READY'
- rslt = jadeapi.ping()
- assert rslt == 0 # idle
+ assert_idle(jadeapi)
wait(5) # Lets idle tasks clean up
startinfo = jadeapi.get_version_info()
@@ -3952,14 +3957,10 @@ def run_interface_tests(jadeapi,
assert rslt['JADE_VERSION'] == startinfo['JADE_VERSION']
assert rslt['JADE_STATE'] == startinfo['JADE_STATE']
- rslt = jadeapi.ping()
- assert rslt == 0 # idle
-
+ assert_idle(jadeapi)
rslt = jadeapi.set_mnemonic(TEST_MNEMONIC)
assert rslt is True
-
- rslt = jadeapi.ping()
- assert rslt == 0 # idle
+ assert_idle(jadeapi)
# Smoke tests
if smoke:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.