mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
tests: ensure Shamir persistence test runs only for core
This commit is contained in:
parent
bc1696b947
commit
f22f4d920e
@ -72,5 +72,6 @@ class BackgroundDeviceHandler:
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
if not self.check_finalize():
|
||||
finalized_ok = self.check_finalize()
|
||||
if exc_type is None and not finalized_ok:
|
||||
raise RuntimeError("Exit while task is unfinished")
|
||||
|
@ -0,0 +1,37 @@
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from ..emulators import EmulatorWrapper
|
||||
|
||||
SELECTED_GENS = [
|
||||
gen.strip() for gen in os.environ.get("TREZOR_UPGRADE_TEST", "").split(",") if gen
|
||||
]
|
||||
|
||||
if SELECTED_GENS:
|
||||
# if any gens were selected via the environment variable, force enable all selected
|
||||
LEGACY_ENABLED = "legacy" in SELECTED_GENS
|
||||
CORE_ENABLED = "core" in SELECTED_GENS
|
||||
|
||||
else:
|
||||
# if no selection was provided, select those for which we have emulators
|
||||
try:
|
||||
EmulatorWrapper("legacy")
|
||||
LEGACY_ENABLED = True
|
||||
except Exception:
|
||||
LEGACY_ENABLED = False
|
||||
|
||||
try:
|
||||
EmulatorWrapper("core")
|
||||
CORE_ENABLED = True
|
||||
except Exception:
|
||||
CORE_ENABLED = False
|
||||
|
||||
|
||||
legacy_only = pytest.mark.skipif(
|
||||
not LEGACY_ENABLED, reason="This test requires legacy emulator"
|
||||
)
|
||||
|
||||
core_only = pytest.mark.skipif(
|
||||
not CORE_ENABLED, reason="This test requires core emulator"
|
||||
)
|
@ -14,14 +14,13 @@
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import MINIMUM_FIRMWARE_VERSION, btc, debuglink, device
|
||||
from trezorlib.tools import H_
|
||||
|
||||
from ..emulators import ALL_TAGS, EmulatorWrapper
|
||||
from . import SELECTED_GENS
|
||||
|
||||
MINIMUM_FIRMWARE_VERSION["1"] = (1, 0, 0)
|
||||
MINIMUM_FIRMWARE_VERSION["T"] = (2, 0, 0)
|
||||
@ -41,11 +40,8 @@ def for_all(*args, minimum_version=(1, 0, 0)):
|
||||
if not args:
|
||||
args = ("core", "legacy")
|
||||
|
||||
specified_gens = os.environ.get("TREZOR_UPGRADE_TEST")
|
||||
if specified_gens is not None:
|
||||
enabled_gens = specified_gens.split(",")
|
||||
else:
|
||||
enabled_gens = args
|
||||
# If any gens were selected, use them. If none, select all.
|
||||
enabled_gens = SELECTED_GENS or args
|
||||
|
||||
all_params = []
|
||||
for gen in args:
|
||||
|
@ -19,6 +19,7 @@ from trezorlib import device
|
||||
from .. import buttons
|
||||
from ..device_handler import BackgroundDeviceHandler
|
||||
from ..emulators import EmulatorWrapper
|
||||
from . import core_only
|
||||
|
||||
|
||||
def enter_word(debug, word):
|
||||
@ -28,6 +29,7 @@ def enter_word(debug, word):
|
||||
return debug.click(buttons.CONFIRM_WORD, wait=True)
|
||||
|
||||
|
||||
@core_only
|
||||
def test_persistence():
|
||||
with EmulatorWrapper("core") as emu, BackgroundDeviceHandler(
|
||||
emu.client
|
||||
|
Loading…
Reference in New Issue
Block a user