Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show ragger/speculos version #277

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ jobs:
- name: Run test
run: |
if [ "${{ matrix.device }}" = "stax" ] || [ "${{ matrix.device }}" = "flex" ]; then
python3 -m pip show ragger
python3 -m pip show speculos
./tests/integration/run_test_local.sh -F -m ${{ matrix.device }} \
./tests/integration/touch
else
Expand All @@ -92,6 +94,8 @@ jobs:
python3 -m pip install -r ./tests/requirements.txt -q
TMP_DIR=$(mktemp -d /tmp/foo-XXXXXX)
tar xfz app_${{ matrix.device }}_dbg.tgz -C $TMP_DIR
python3 -m pip show ragger
python3 -m pip show speculos
python3 -m pytest -n 32 tests/integration/nano/ --tb=no \
--device ${{ matrix.device }} --app $TMP_DIR/app.elf \
--log-dir integration_tests_log
Expand All @@ -111,6 +115,20 @@ jobs:
name: integration_tests_log_${{ matrix.device }}
path: ./integration_tests_log

- name: Upload Snapshots
uses: actions/upload-artifact@v4
if: always() && (matrix.device == 'stax')
with:
name: integration_tests_${{ matrix.device }}_snapshots
path: ./tests/integration/touch/snapshots-tmp

- name: Upload Snapshots
uses: actions/upload-artifact@v4
if: always() && (matrix.device == 'flex')
with:
name: integration_tests_${{ matrix.device }}_snapshots
path: tests/integration/touch/snapshots-tmp

generate_samples_unit_tests:
needs: [build_docker_tezos_ocaml]
runs-on: ubuntu-latest
Expand Down
18 changes: 17 additions & 1 deletion tests/integration/touch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class TezosAppScreen(metaclass=MetaScreen):
__golden: bool
__snapshots_path: str
__prefixed_snapshots_path: str
__tmp_snapshots_path: str
__prefixed_tmp_snapshots_path: str
__snapshotted: List[str] = []

def __init__(self,
Expand All @@ -179,6 +181,10 @@ def __init__(self,
f"{os.path.dirname(realpath)}/snapshots/{firmware.name}"
self.__prefixed_snapshots_path = \
f"{self.__snapshots_path}/{Path(snapshot_prefix).stem}"
self.__tmp_snapshots_path = \
f"{os.path.dirname(realpath)}/snapshots/{firmware.name}"
self.__prefixed_tmp_snapshots_path = \
f"{self.__tmp_snapshots_path}/{Path(snapshot_prefix).stem}"
self.firmware = firmware
self.commit = commit
self.version = version
Expand All @@ -193,6 +199,14 @@ def __init__(self,
home_path = os.path.join(path, "home.png")
if os.path.exists(home_path):
os.remove(home_path)
path = f"{self.__prefixed_tmp_snapshots_path}"
Path(path).mkdir(parents=True, exist_ok=True)
for filename in os.listdir(path):
os.remove(os.path.join(path, filename))
path = f"{self.__tmp_snapshots_path}"
home_path = os.path.join(path, "home.png")
if os.path.exists(home_path):
os.remove(home_path)

def send_apdu(self, data):
"""Send hex-encoded bytes to the apdu"""
Expand Down Expand Up @@ -229,12 +243,14 @@ def assert_screen(self, screen, fixed: bool = False):

if fixed:
path = f'{self.__snapshots_path}/{screen}.png'
tmp_path = f'{self.__tmp_snapshots_path}/{screen}.png'
else:
path = f'{self.__prefixed_snapshots_path}/{screen}.png'
tmp_path = f'{self.__prefixed_tmp_snapshots_path}/{screen}.png'

def check():
print(f"- Expecting {screen} -")
assert self.__backend.compare_screen_with_snapshot(path, golden_run=golden)
assert self.__backend.compare_screen_with_snapshot(path, tmp_snap_path=tmp_path, golden_run=golden)

with_retry(check)

Expand Down
Loading