diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f2c5762..cfedda8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 diff --git a/tests/integration/touch/utils.py b/tests/integration/touch/utils.py index 169d7101..8399145d 100644 --- a/tests/integration/touch/utils.py +++ b/tests/integration/touch/utils.py @@ -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, @@ -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 @@ -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""" @@ -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)