Port 'send_etc.test' from 'zemu' to 'ragger'

- Port test config from 'zemu'
- Copy snapshots from 'zemu'
- Adapt conftest.py to support library mode
- Add a new test step in the workflow
This commit is contained in:
Charles-Edouard de la Vergne
2024-04-04 17:19:47 +02:00
parent e6b2cf30c5
commit d4b6e5ca35
67 changed files with 101 additions and 2 deletions

View File

@@ -1,4 +1,49 @@
#from ragger.conftest import configuration
import sys
from pathlib import Path
import warnings
import glob
from ragger.conftest import configuration
#######################
# CONFIGURATION START #
#######################
# You can configure optional parameters by overriding the value of
# ragger.configuration.OPTIONAL_CONFIGURATION
# Please refer to ragger/conftest/configuration.py for their descriptions and accepted values
def pytest_addoption(parser):
parser.addoption("--with_lib_mode", action="store_true", help="Run the test with Library Mode")
parent: Path = Path(__file__).parent
testFiles = glob.glob("test_*.py", root_dir=f"{parent}")
collect_ignore = []
if "--with_lib_mode" in sys.argv:
# ==============================================================================
# /!\ Tests are started in Library mode: unselect (ignore) unrelated modules /!\
# ==============================================================================
warnings.warn("Main app is started in library mode")
configuration.OPTIONAL.MAIN_APP_DIR = "tests/ragger/.test_dependencies/"
collect_ignore += [f for f in testFiles if "test_clone" not in f]
else:
# ===========================================================================
# /!\ Standards tests without Library mode: unselect (ignore) clone tests /!\
# ===========================================================================
collect_ignore += [f for f in testFiles if "test_clone" in f]
#####################
# CONFIGURATION END #
#####################
# Pull all features from the base ragger conftest using the overridden configuration
pytest_plugins = ("ragger.conftest.base_conftest", )

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

View File

@@ -0,0 +1 @@
00008.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
../nanox/test_clone_thundercore

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 B

View File

@@ -0,0 +1 @@
00004.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -0,0 +1,32 @@
from web3 import Web3
from ragger.backend import BackendInterface
from ragger.firmware import Firmware
from ragger.navigator import Navigator
from test_sign import common
# Values used across all tests
ADDR = bytes.fromhex("5a321744667052affa8386ed49e00ef223cbffc3")
BIP32_PATH = "m/44'/1001'/0'/0/0"
NONCE = 68
GAS_PRICE = 13
GAS_LIMIT = 21000
VALUE = 0.31415
# Transfer on Clone app
def test_clone_thundercore(firmware: Firmware,
backend: BackendInterface,
navigator: Navigator,
test_name: str):
tx_params: dict = {
"nonce": NONCE,
"gasPrice": Web3.to_wei(GAS_PRICE, 'gwei'),
"gas": GAS_LIMIT,
"to": ADDR,
"value": Web3.to_wei(VALUE, "ether"),
"chainId": 108
}
common(firmware, backend, navigator, tx_params, test_name, BIP32_PATH)