1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-26 00:08:10 +00:00

ci: use external servers in CI and scripts

This commit is contained in:
matejcik 2022-03-22 12:12:11 +01:00 committed by matejcik
parent 7f97ea4961
commit 82182ae078
3 changed files with 13 additions and 16 deletions

View File

@ -31,7 +31,7 @@ Implement U2F/FIDO2 tests.
## Upgrade tests ## Upgrade tests
These tests test upgrade from one firmware version to another. They initialize an emulator on some specific version and then pass its storage to another version to see if the firmware operates as expected. They use fixtures from https://firmware.corp.sldev.cz/upgrade_tests/ which can be downloaded using the `download_emulators.sh` script. These tests test upgrade from one firmware version to another. They initialize an emulator on some specific version and then pass its storage to another version to see if the firmware operates as expected. They use fixtures from https://data.trezor.io/dev/firmware/releases/emulators/ which can be downloaded using the `download_emulators.sh` script.
See the [upgrade-tests.md](upgrade-tests.md) for instructions how to run it. See the [upgrade-tests.md](upgrade-tests.md) for instructions how to run it.

View File

@ -1,11 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
SITE="https://firmware.corp.sldev.cz/releases/emulators/" SITE="https://data.trezor.io/dev/firmware/releases/emulators/"
cd "$(dirname "$0")" cd "$(dirname "$0")"
# download all emulators without index files, without directories and only if not present # download all emulators without index files, without directories and only if not present
wget -e robots=off --no-verbose --no-clobber --no-parent --cut-dirs=2 --no-host-directories --recursive --reject "index.html*" -P emulators/ $SITE wget -e robots=off \
--no-verbose \
--no-clobber \
--no-parent \
--no-directories \
--no-host-directories \
--recursive \
--reject "index.html*" \
-P emulators/ \
$SITE
chmod u+x emulators/trezor-emu-* chmod u+x emulators/trezor-emu-*

View File

@ -7,19 +7,12 @@ from typing import Dict
import requests import requests
RECORDS_WEBSITE = "https://firmware.corp.sldev.cz/ui_tests/" RECORDS_WEBSITE = "https://data.trezor.io/dev/firmware/ui_tests/"
FIXTURES_MASTER = "https://raw.githubusercontent.com/trezor/trezor-firmware/master/tests/ui_tests/fixtures.json" FIXTURES_MASTER = "https://raw.githubusercontent.com/trezor/trezor-firmware/master/tests/ui_tests/fixtures.json"
FIXTURES_CURRENT = Path(__file__).resolve().parent.parent / "fixtures.json" FIXTURES_CURRENT = Path(__file__).resolve().parent.parent / "fixtures.json"
_dns_failed = False
def fetch_recorded(hash: str, path: Path) -> None: def fetch_recorded(hash: str, path: Path) -> None:
global _dns_failed
if _dns_failed:
raise RuntimeError("Not trying firmware.corp.sldev.cz again after DNS failure.")
zip_src = RECORDS_WEBSITE + hash + ".zip" zip_src = RECORDS_WEBSITE + hash + ".zip"
zip_dest = path / "recorded.zip" zip_dest = path / "recorded.zip"
@ -27,11 +20,6 @@ def fetch_recorded(hash: str, path: Path) -> None:
urllib.request.urlretrieve(zip_src, zip_dest) urllib.request.urlretrieve(zip_src, zip_dest)
except urllib.error.HTTPError: except urllib.error.HTTPError:
raise RuntimeError(f"No such recorded collection was found on '{zip_src}'.") raise RuntimeError(f"No such recorded collection was found on '{zip_src}'.")
except urllib.error.URLError:
_dns_failed = True
raise RuntimeError(
"Server firmware.corp.sldev.cz could not be found. Are you on VPN?"
)
with zipfile.ZipFile(zip_dest, "r") as z: with zipfile.ZipFile(zip_dest, "r") as z:
z.extractall(path) z.extractall(path)