From 7e6ccccd1a3b7d350456ab7b0103e8b019b943cd Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Wed, 24 Jan 2024 17:30:29 +0100 Subject: [PATCH] Add test dependencies in manifest for ragger tests --- .../workflows/build_and_functional_tests.yml | 2 +- .gitignore | 3 ++- ledger_app.toml | 8 ++++++++ .../.ethereum_application_build_goes_there | 0 tests/README.md | 17 +++++++++-------- tests/conftest.py | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) rename tests/{ethereum_build => .test_dependencies/ethereum}/.ethereum_application_build_goes_there (100%) diff --git a/.github/workflows/build_and_functional_tests.yml b/.github/workflows/build_and_functional_tests.yml index 865cfa3b..d6ddf86a 100644 --- a/.github/workflows/build_and_functional_tests.yml +++ b/.github/workflows/build_and_functional_tests.yml @@ -43,4 +43,4 @@ jobs: with: download_app_binaries_artifact: plugin_binaries additional_app_binaries_artifact: ethereum_build_develop - additional_app_binaries_artifact_dir: ./tests/ethereum_build/build + additional_app_binaries_artifact_dir: ./tests/.test_dependencies/ethereum/build diff --git a/.gitignore b/.gitignore index a18756e7..bbb0b5b4 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ ledger/ tests/snapshots-tmp/ # Directory storing the ethereum build output for tests run -tests/ethereum_build/build/ +tests/.test_dependencies/ethereum/* +!tests/.test_dependencies/ethereum/.ethereum_application_build_goes_there diff --git a/ledger_app.toml b/ledger_app.toml index c264aa9d..bdb67c98 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -5,3 +5,11 @@ devices = ["nanos", "nanox", "nanos+", "stax"] [tests] pytest_directory = "./tests/" + +[tests.dependencies] +testing_with_prod = [ + {url = "https://github.com/LedgerHQ/app-ethereum", ref = "master", use_case = "use_test_keys"}, +] +testing_with_latest = [ + {url = "https://github.com/LedgerHQ/app-ethereum", ref = "develop", use_case = "use_test_keys"}, +] diff --git a/tests/ethereum_build/.ethereum_application_build_goes_there b/tests/.test_dependencies/ethereum/.ethereum_application_build_goes_there similarity index 100% rename from tests/ethereum_build/.ethereum_application_build_goes_there rename to tests/.test_dependencies/ethereum/.ethereum_application_build_goes_there diff --git a/tests/README.md b/tests/README.md index 03f83678..1f10c76f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -17,15 +17,16 @@ In order to run the tests you need to provide the binaries for both the plugin a Compiling the plugin will produce the binary for the targeted device. They will be used as-is by the test framework. -The binaries of the Ethereum application must be gathered and placed in the directory `tests/ethereum_build/`. +The binaries of the Ethereum application must be gathered and placed in the directory `tests/.test_dependencies/ethereum/`. Example of the correct file tree with Ethereum compiled for all targets. -* `tests/ethereum_build/build/nanos/bin/app.elf` -* `tests/ethereum_build/build/nanos2/bin/app.elf` -* `tests/ethereum_build/build/nanox/bin/app.elf` -* `tests/ethereum_build/build/stax/bin/app.elf` - -The first method is to go in the Ethereum project, compile the application, and dispatch the `build/` output directory. -A second method is to re-use the Ethereum build used in the CI, and available as artifact. +* `tests/.test_dependencies/ethereum/build/nanos/bin/app.elf` +* `tests/.test_dependencies/ethereum/build/nanos2/bin/app.elf` +* `tests/.test_dependencies/ethereum/build/nanox/bin/app.elf` +* `tests/.test_dependencies/ethereum/build/stax/bin/app.elf` + +The first method is to use the Ledger VSCode extension to automatically manage dependencies +The second method is to go in the Ethereum project, compile the application, and dispatch the `build/` output directory. +A third method is to re-use the Ethereum build used in the CI, and available as artifact. For example in the [plugin-boilerplate CI](https://github.com/LedgerHQ/app-plugin-boilerplate/actions/workflows/build_and_functional_tests.yml). diff --git a/tests/conftest.py b/tests/conftest.py index 5e51dfa4..4bdf8db3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,7 +7,7 @@ # 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 -configuration.OPTIONAL.APP_DIR = "tests/ethereum_build/" +configuration.OPTIONAL.APP_DIR = "tests/.test_dependencies/" configuration.OPTIONAL.LOAD_MAIN_APP_AS_LIBRARY = True