From d118eba91cba567f95d628fc97fa6cf1cdd671d6 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Mon, 26 Dec 2022 12:18:47 +0300 Subject: [PATCH] reenable cmsis tests --- .github/workflows/ci.yml | 2 ++ .gitignore | 3 +++ generate-tests.sh | 25 ++++++++++++++++--------- tests/src/cmsis_tests.rs | 1 + tests/src/lib.rs | 1 + 5 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 tests/src/cmsis_tests.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77397100..e58ffeda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,8 @@ jobs: toolchain: stable profile: minimal override: true + - name: Generate test for SVDs from cmsis-svd repository + run: bash generate-tests.sh - uses: actions-rs/cargo@v1 with: command: test diff --git a/.gitignore b/.gitignore index c626e048..0f018ced 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ [._]*.sw[a-p] Cargo.lock target +cmsis-svd/ +tests/src/cmsis_tests.rs +tests/src/cmsis_tests/ diff --git a/generate-tests.sh b/generate-tests.sh index ab3fadad..55f34e2b 100644 --- a/generate-tests.sh +++ b/generate-tests.sh @@ -9,8 +9,10 @@ elementIn() { } main() { + git clone https://github.com/posborne/cmsis-svd || true + local tests_dir=$(pwd)/tests - local cmsis_dir=$tests_dir/cmsis_tests + local cmsis_dir=$tests_dir/src/cmsis_tests local blacklist=( # These SVD files have some registers with a `resetValue` bigger than the register itself Toshiba/M365 @@ -21,12 +23,14 @@ main() { SiliconLabs/SIM3L1x8_SVD ) - rm -rf tests/cmsis_tests - mkdir -p tests/cmsis_tests + rm -rf $cmsis_dir + mkdir -p $cmsis_dir + >"$cmsis_dir/../cmsis_tests.rs" local vendor_dir for vendor_dir in $(echo cmsis-svd/data/*); do local vendor=$(basename $vendor_dir) + vendor=${vendor//-/_} cat >"$cmsis_dir/$vendor.rs" <>"$cmsis_dir/$vendor.rs" <>"$cmsis_dir/mod.rs" <>"$cmsis_dir/../cmsis_tests.rs" <"$tests_dir/cmsis.rs"<