From 129cea936e1b89ad2c084c80867e7fa224ee167a Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 4 Dec 2024 19:14:13 +0100 Subject: [PATCH] add nrf to smoketester --- .github/test-projects/nrf/.cargo/config.toml | 2 + .github/test-projects/nrf/.gitignore | 2 + .github/test-projects/nrf/Cargo.lock | 1016 +++++++++++++++++ .github/test-projects/nrf/Cargo.toml | 48 + .github/test-projects/nrf/build.rs | 30 + .github/test-projects/nrf/build.sh | 19 + .../test-projects/nrf/expected_rtt_logs.txt | 17 + .../nrf/expected_test_results.txt | 16 + .github/test-projects/nrf/memory-nrf51.x | 5 + .github/test-projects/nrf/memory-nrf52.x | 5 + .github/test-projects/nrf/memory-nrf52833.x | 5 + .github/test-projects/nrf/src/main.rs | 11 + .../test-projects/nrf/tests/example_test.rs | 52 + .github/workflows/smoketest_master.yml | 16 +- 14 files changed, 1236 insertions(+), 8 deletions(-) create mode 100644 .github/test-projects/nrf/.cargo/config.toml create mode 100644 .github/test-projects/nrf/.gitignore create mode 100644 .github/test-projects/nrf/Cargo.lock create mode 100644 .github/test-projects/nrf/Cargo.toml create mode 100644 .github/test-projects/nrf/build.rs create mode 100755 .github/test-projects/nrf/build.sh create mode 100644 .github/test-projects/nrf/expected_rtt_logs.txt create mode 100644 .github/test-projects/nrf/expected_test_results.txt create mode 100644 .github/test-projects/nrf/memory-nrf51.x create mode 100644 .github/test-projects/nrf/memory-nrf52.x create mode 100644 .github/test-projects/nrf/memory-nrf52833.x create mode 100644 .github/test-projects/nrf/src/main.rs create mode 100644 .github/test-projects/nrf/tests/example_test.rs diff --git a/.github/test-projects/nrf/.cargo/config.toml b/.github/test-projects/nrf/.cargo/config.toml new file mode 100644 index 0000000..73066e8 --- /dev/null +++ b/.github/test-projects/nrf/.cargo/config.toml @@ -0,0 +1,2 @@ +[unstable] +build-std = ["core"] \ No newline at end of file diff --git a/.github/test-projects/nrf/.gitignore b/.github/test-projects/nrf/.gitignore new file mode 100644 index 0000000..fbe4996 --- /dev/null +++ b/.github/test-projects/nrf/.gitignore @@ -0,0 +1,2 @@ +/target +/output diff --git a/.github/test-projects/nrf/Cargo.lock b/.github/test-projects/nrf/Cargo.lock new file mode 100644 index 0000000..b544120 --- /dev/null +++ b/.github/test-projects/nrf/Cargo.lock @@ -0,0 +1,1016 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "az" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version 0.2.3", +] + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bytemuck" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cortex-m" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +dependencies = [ + "bare-metal", + "bitfield", + "critical-section", + "embedded-hal 0.2.7", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d4dec46b34c299ccf6b036717ae0fce602faa4f4fe816d9013b9a7c9f5ba6" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "defmt" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f6162c53f659f65d00619fe31f14556a6e9f8752ccc4a41bd177ffcf3d6130" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d135dd939bad62d7490b0002602d35b358dce5fd9233a709d3c1ef467d4bde6" +dependencies = [ + "defmt-parser", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "defmt-parser" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3983b127f13995e68c1e29071e5d115cd96f215ccb5e6812e3728cd6f92653b3" +dependencies = [ + "thiserror", +] + +[[package]] +name = "defmt-rtt" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab697b3dbbc1750b7c8b821aa6f6e7f2480b47a99bc057a2ed7b170ebef0c51" +dependencies = [ + "critical-section", + "defmt", +] + +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + +[[package]] +name = "embassy-embedded-hal" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5794414bc20e0d750f145bc0e82366b19dd078e9e075e8331fb8dd069a1cb6a2" +dependencies = [ + "embassy-futures", + "embassy-sync", + "embassy-time", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-executor" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64f84599b0f4296b92a4b6ac2109bc02340094bda47b9766c5f9ec6a318ebf8" +dependencies = [ + "cortex-m", + "critical-section", + "document-features", + "embassy-executor-macros", + "embassy-time-driver", + "embassy-time-queue-driver", +] + +[[package]] +name = "embassy-executor-macros" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "embassy-futures" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067" + +[[package]] +name = "embassy-hal-internal" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59" +dependencies = [ + "cortex-m", + "critical-section", + "num-traits", +] + +[[package]] +name = "embassy-nrf" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5f41f2ef4df68d3066c62667a0027b194cf6294e58afe8e6c36b8feede1e4ac" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "critical-section", + "document-features", + "embassy-embedded-hal", + "embassy-hal-internal", + "embassy-sync", + "embassy-time-driver", + "embassy-usb-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-io", + "embedded-io-async", + "embedded-storage", + "embedded-storage-async", + "fixed", + "nrf51-pac", + "nrf52805-pac", + "nrf52810-pac", + "nrf52811-pac", + "nrf52820-pac", + "nrf52832-pac", + "nrf52833-pac", + "nrf52840-pac", + "nrf5340-app-pac", + "nrf5340-net-pac", + "nrf9120-pac", + "nrf9160-pac", + "rand_core", +] + +[[package]] +name = "embassy-sync" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3899a6e39fa3f54bf8aaf00979f9f9c0145a522f7244810533abbb748be6ce82" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async", + "futures-sink", + "futures-util", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-time" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "158080d48f824fad101d7b2fae2d83ac39e3f7a6fa01811034f7ab8ffc6e7309" +dependencies = [ + "cfg-if", + "critical-section", + "document-features", + "embassy-time-driver", + "embassy-time-queue-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "futures-util", + "heapless 0.8.0", +] + +[[package]] +name = "embassy-time-driver" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e0c214077aaa9206958b16411c157961fb7990d4ea628120a78d1a5a28aed24" +dependencies = [ + "document-features", +] + +[[package]] +name = "embassy-time-queue-driver" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1177859559ebf42cd24ae7ba8fe6ee707489b01d0bf471f8827b7b12dcb0bc0" + +[[package]] +name = "embassy-usb-driver" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970" + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +dependencies = [ + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io", +] + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "embedded-storage-async" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" +dependencies = [ + "embedded-storage", +] + +[[package]] +name = "embedded-test" +version = "0.6.0" +dependencies = [ + "embassy-executor", + "embedded-test-macros", + "heapless 0.8.0", + "log", + "semihosting", + "serde", + "serde-json-core", +] + +[[package]] +name = "embedded-test-macros" +version = "0.6.0" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "fixed" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" +dependencies = [ + "az", + "bytemuck", + "half", + "typenum", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + +[[package]] +name = "half" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "heapless" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32 0.2.1", + "rustc_version 0.4.1", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32 0.3.1", + "stable_deref_trait", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" + +[[package]] +name = "nrf-embedded-test" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "defmt-rtt", + "embassy-executor", + "embassy-nrf", + "embassy-time", + "embedded-test", + "log", + "panic-probe", + "rtt-target 0.6.1", +] + +[[package]] +name = "nrf51-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "137f187dc6ee482e27312086bd3c3a83e1c273512782cf131a61957f72fc4219" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52805-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2da657648039d59f4de6bc31b948dd3a5d03b32529a4d5d19d9e2dd9d4bfa6c" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52810-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c26b12d5af17a9f4bb9a06ca9a1f814bca3d67bc8715b23f8dc230b09a227666" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52811-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4179b2a7ed0b2fd5e109d0fab9b4fc55b3936b2a4916a9306d22e5bc8dc1fd8f" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52820-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4791cff995e6419a5ad1aebc3b3c9539d79125ca85eb5bfd2cff9b470b81071" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52832-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0242b685c9c15648fb803e155628f42ace457478b2cb930868f40cae2db925e0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52833-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10e1358255b360cdc816dd7b6ef81be8c8499c0998277e5249bed222bd0f5241" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf52840-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30713f36f1be02e5bc9abefa30eae4a1f943d810f199d4923d3ad062d1be1b3d" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf5340-app-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c88824573cd150fe9f27c1a48cea31a8cb24d3322df488875775143618c087a" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf5340-net-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c03e44df22fe5888109fe42e523162c7059adf4d30860f4f73ecc8b1fc16fe" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf9120-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c012f18dc278aa33741722d374bc84e3d2d7694e29745f0bb83e56b2d6faf9b" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "nrf9160-pac" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7344d74afb5684e00c48d175cad9619f36d629cfb0687d33b4d1bb86fba688f4" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +dependencies = [ + "critical-section", + "portable-atomic", +] + +[[package]] +name = "panic-probe" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4047d9235d1423d66cc97da7d07eddb54d4f154d6c13805c6d0793956f4f25b0" +dependencies = [ + "cortex-m", + "rtt-target 0.5.0", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "portable-atomic" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rtt-target" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10b34c9e6832388e45f3c01f1bb60a016384a0a4ad80cdd7d34913bed25037f0" +dependencies = [ + "critical-section", + "ufmt-write", +] + +[[package]] +name = "rtt-target" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4235cd78091930e907d2a510adb0db1369e82668eafa338f109742fa0c83059d" +dependencies = [ + "critical-section", + "log", + "once_cell", + "portable-atomic", + "ufmt-write", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semihosting" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1004ff204633065b824d4b952bf5ac84c185d3bd4d43f6b3ae2f049ee318944e" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-json-core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9e1ab533c0bc414c34920ec7e5f097101d126ed5eac1a1aac711222e0bbb33" +dependencies = [ + "heapless 0.7.17", + "ryu", + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.215" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ufmt-write" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" + +[[package]] +name = "unicode-ident" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +dependencies = [ + "vcell", +] diff --git a/.github/test-projects/nrf/Cargo.toml b/.github/test-projects/nrf/Cargo.toml new file mode 100644 index 0000000..996bb22 --- /dev/null +++ b/.github/test-projects/nrf/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "nrf-embedded-test" +version = "0.1.0" +authors = ["Dániel Buga "] +edition = "2021" +license = "MIT OR Apache-2.0" + +[dependencies] +defmt-rtt = "0.4.0" +cortex-m = { version = "0.7.7", features = ["inline-asm", "critical-section-single-core"] } +cortex-m-rt = "0.7.3" +panic-probe = { version = "0.3", features = ["print-rtt"] } + +embassy-nrf = { version = "0.2.0", features = ["time-driver-rtc1", "unstable-pac", "rt"] } + +rtt-target = { version = "0.6.1", features = ["log"] } +embassy-executor = { version = "0.6.3", features = ["arch-cortex-m", "executor-thread", "integrated-timers"] } +embassy-time = "0.3.2" +log = "0.4.22" + + + +[features] +nrf51422 = ["embassy-nrf/nrf51"] +nrf52832 = ["embassy-nrf/nrf52832"] +nrf52833 = ["embassy-nrf/nrf52833"] + +[dev-dependencies] +embedded-test = { path = "../../..", features = ["embassy", "log"] } + + +[[test]] +name = "example_test" +harness = false + +[profile.dev] +# Rust debug is too slow. +# For debug builds always builds with some optimization +opt-level = "s" + +[profile.release] +codegen-units = 1 # LLVM can perform better optimizations using a single thread +debug = 2 +debug-assertions = false +incremental = false +lto = 'fat' +opt-level = 's' +overflow-checks = false diff --git a/.github/test-projects/nrf/build.rs b/.github/test-projects/nrf/build.rs new file mode 100644 index 0000000..dff2fd6 --- /dev/null +++ b/.github/test-projects/nrf/build.rs @@ -0,0 +1,30 @@ +use std::{env, fs::File, io::Write, path::PathBuf}; + +#[cfg(feature = "nrf51422")] +const MEM_X: &[u8] = include_bytes!("memory-nrf51.x"); +#[cfg(feature = "nrf52832")] +const MEM_X: &[u8] = include_bytes!("memory-nrf52.x"); +#[cfg(feature = "nrf52833")] +const MEM_X: &[u8] = include_bytes!("memory-nrf52833.x"); + +fn main() { + // Put `memory.x` in our output directory and ensure it's + // on the linker search path. + + let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); + File::create(out.join("memory.x")) + .unwrap() + .write_all(MEM_X) + .unwrap(); + println!("cargo:rustc-link-search={}", out.display()); + + // By default, Cargo will re-run a build script whenever + // any file in the project changes. By specifying `memory.x` + // here, we ensure the build script is only re-run when + // `memory.x` is changed. + println!("cargo:rerun-if-changed=memory.x"); + + println!("cargo:rustc-link-arg=--nmagic"); + println!("cargo:rustc-link-arg=-Tlink.x"); + println!("cargo::rustc-link-arg-tests=-Tembedded-test.x"); +} diff --git a/.github/test-projects/nrf/build.sh b/.github/test-projects/nrf/build.sh new file mode 100755 index 0000000..47e2b84 --- /dev/null +++ b/.github/test-projects/nrf/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +set -x +set -e + +# to show a possible error in the output +cargo test --locked --target "$2" --features "$1" --release --test example_test --no-run + +# Copy artifact to output directory +exec=$(cargo test --locked --target "$2" --features "$1" --release --test example_test --no-run --message-format=json | jq -r 'select(.executable and .target.kind==["test"])|.executable') +mkdir -p output +cp "$exec" output/"$1" +cp expected_test_results.txt output/ +cp expected_rtt_logs.txt output/ \ No newline at end of file diff --git a/.github/test-projects/nrf/expected_rtt_logs.txt b/.github/test-projects/nrf/expected_rtt_logs.txt new file mode 100644 index 0000000..b9f6699 --- /dev/null +++ b/.github/test-projects/nrf/expected_rtt_logs.txt @@ -0,0 +1,17 @@ +INFO [embedded_test::export] tests available: [Test { name: "test::test", should_panic: false, ignored: false, timeout: None }, Test { name: "test::it_fails1", should_panic: false, ignored: false, timeout: None }, Test { name: "test::it_fails2", should_panic: false, ignored: false, timeout: None }, Test { name: "test::it_passes", should_panic: true, ignored: false, timeout: None }, Test { name: "test::it_fails3", should_panic: true, ignored: false, timeout: None }, Test { name: "test::it_timeouts", should_panic: false, ignored: false, timeout: Some(3) }, Test { name: "test::async_test", should_panic: false, ignored: false, timeout: None }] +INFO [embedded_test::export] Running test: Test { name: "test::test", should_panic: false, ignored: false, timeout: None } +ERROR [example_test::test] Hello, log! +INFO [embedded_test::export] Test exited with () or Ok(..) +INFO [embedded_test::export] Running test: Test { name: "test::it_fails1", should_panic: false, ignored: false, timeout: None } +ERROR [embedded_test] ====================== PANIC ====================== +ERROR [embedded_test] panicked at tests/example_test.rs:22:9: +INFO [embedded_test::export] Running test: Test { name: "test::it_fails2", should_panic: false, ignored: false, timeout: None } +INFO [embedded_test::export] Test exited with Err(..): Err("It failed because ...") +INFO [embedded_test::export] Running test: Test { name: "test::it_passes", should_panic: true, ignored: false, timeout: None } +ERROR [embedded_test] ====================== PANIC ====================== +ERROR [embedded_test] panicked at tests/example_test.rs:33:9: +INFO [embedded_test::export] Running test: Test { name: "test::it_fails3", should_panic: true, ignored: false, timeout: None } +INFO [embedded_test::export] Test exited with () or Ok(..) +INFO [embedded_test::export] Running test: Test { name: "test::it_timeouts", should_panic: false, ignored: false, timeout: Some(3) } +INFO [embedded_test::export] Running test: Test { name: "test::async_test", should_panic: false, ignored: false, timeout: None } +INFO [embedded_test::export] Test exited with () or Ok(..) diff --git a/.github/test-projects/nrf/expected_test_results.txt b/.github/test-projects/nrf/expected_test_results.txt new file mode 100644 index 0000000..8bd7f02 --- /dev/null +++ b/.github/test-projects/nrf/expected_test_results.txt @@ -0,0 +1,16 @@ +{"type":"suite","event":"started","test_count":7} +{"type":"test","event":"started","name":"test::test"} +{"type":"test","name":"test::test","event":"ok"} +{"type":"test","event":"started","name":"test::it_fails1"} +{"type":"test","name":"test::it_fails1","event":"failed","stdout":"Error: \"Test should Pass but it did Panic\"\n"} +{"type":"test","event":"started","name":"test::it_fails2"} +{"type":"test","name":"test::it_fails2","event":"failed","stdout":"Error: \"Test should Pass but it did Panic\"\n"} +{"type":"test","event":"started","name":"test::it_passes"} +{"type":"test","name":"test::it_passes","event":"ok"} +{"type":"test","event":"started","name":"test::it_fails3"} +{"type":"test","name":"test::it_fails3","event":"failed","stdout":"Error: \"Test should Panic but it did Pass\"\n"} +{"type":"test","event":"started","name":"test::it_timeouts"} +{"type":"test","name":"test::it_timeouts","event":"failed","stdout":"Error: \"Test timed out after 3s\"\n"} +{"type":"test","event":"started","name":"test::async_test"} +{"type":"test","name":"test::async_test","event":"ok"} +{"type":"suite","event":"failed","passed":3,"failed":4,"ignored":0,"measured":0,"filtered_out":0} diff --git a/.github/test-projects/nrf/memory-nrf51.x b/.github/test-projects/nrf/memory-nrf51.x new file mode 100644 index 0000000..0abe5ae --- /dev/null +++ b/.github/test-projects/nrf/memory-nrf51.x @@ -0,0 +1,5 @@ +MEMORY +{ + FLASH : ORIGIN = 0x00000000, LENGTH = 128K + RAM : ORIGIN = 0x20000000, LENGTH = 16K +} \ No newline at end of file diff --git a/.github/test-projects/nrf/memory-nrf52.x b/.github/test-projects/nrf/memory-nrf52.x new file mode 100644 index 0000000..a4baa2d --- /dev/null +++ b/.github/test-projects/nrf/memory-nrf52.x @@ -0,0 +1,5 @@ +MEMORY +{ + FLASH : ORIGIN = 0x00000000, LENGTH = 512K + RAM : ORIGIN = 0x20000000, LENGTH = 64K +} diff --git a/.github/test-projects/nrf/memory-nrf52833.x b/.github/test-projects/nrf/memory-nrf52833.x new file mode 100644 index 0000000..eedc09c --- /dev/null +++ b/.github/test-projects/nrf/memory-nrf52833.x @@ -0,0 +1,5 @@ +MEMORY +{ + FLASH : ORIGIN = 0x00000000, LENGTH = 512K + RAM : ORIGIN = 0x20000000, LENGTH = 128K +} diff --git a/.github/test-projects/nrf/src/main.rs b/.github/test-projects/nrf/src/main.rs new file mode 100644 index 0000000..0513a4d --- /dev/null +++ b/.github/test-projects/nrf/src/main.rs @@ -0,0 +1,11 @@ +#![no_std] +#![no_main] + +use panic_probe as _; + +#[cortex_m_rt::entry] +fn main() -> ! { + let _p = embassy_nrf::init(Default::default()); + + loop {} +} diff --git a/.github/test-projects/nrf/tests/example_test.rs b/.github/test-projects/nrf/tests/example_test.rs new file mode 100644 index 0000000..9339752 --- /dev/null +++ b/.github/test-projects/nrf/tests/example_test.rs @@ -0,0 +1,52 @@ +#![no_std] +#![no_main] + +#[cfg(test)] +#[embedded_test::tests(setup=rtt_target::rtt_init_log!())] +mod test { + use embassy_time::{Duration, Timer}; + + #[init] + fn init() -> () { + let _p = embassy_nrf::init(Default::default()); + } + + #[test] + fn test() { + log::error!("Hello, log!"); + assert_eq!(1 + 1, 2); + } + + #[test] + fn it_fails1() { + assert!(false) + } + + #[test] + fn it_fails2() -> Result<(), &'static str> { + Err("It failed because ...") + } + + #[test] + #[should_panic] + fn it_passes() { + assert!(false) + } + + // This test should panic, but doesn't => it fails + #[test] + #[should_panic] + fn it_fails3() {} + + #[test] + #[timeout(3)] + fn it_timeouts() { + loop {} // should run into the 3s timeout + } + + #[test] + async fn async_test() { + Timer::after(Duration::from_millis(100)).await; + assert_eq!(1 + 1, 2); + } +} diff --git a/.github/workflows/smoketest_master.yml b/.github/workflows/smoketest_master.yml index 9894b51..693ea4b 100644 --- a/.github/workflows/smoketest_master.yml +++ b/.github/workflows/smoketest_master.yml @@ -22,14 +22,14 @@ jobs: { soc: "esp32c6", "target": "riscv32imac-unknown-none-elf", "project": "esp32" }, { soc: "esp32s3", "target": "xtensa-esp32s3-none-elf", "project": "esp32" }, { soc: "stm32c011f6", "target": "thumbv6m-none-eabi", "project": "stm32" }, - #{ soc: "stm32f051r8", "target": "thumbv6m-none-eabi", "project": "stm32" }, - #{ soc: "stm32f429zi", "target": "thumbv7em-none-eabi", "project": "stm32" }, - #{ soc: "stm32g031k8", "target": "thumbv6m-none-eabi", "project": "stm32" }, - #{ soc: "stm32g431kb", "target": "thumbv7em-none-eabi", "project": "stm32" }, - #{ soc: "stm32l432kc", "target": "thumbv7em-none-eabi", "project": "stm32" }, - #{ soc: "stm32u545re", "target": "thumbv8m.main-none-eabihf", "project": "stm32" }, - #{ soc: "nrf51422", "target": "thumbv7em-none-eabihf", "project": "nrf" }, - #{ soc: "nrf52832", "target": "thumbv7em-none-eabihf", "project": "nrf" } + { soc: "stm32f051r8", "target": "thumbv6m-none-eabi", "project": "stm32" }, + { soc: "stm32f429zi", "target": "thumbv7em-none-eabi", "project": "stm32" }, + { soc: "stm32g031k8", "target": "thumbv6m-none-eabi", "project": "stm32" }, + { soc: "stm32g431kb", "target": "thumbv7em-none-eabi", "project": "stm32" }, + { soc: "stm32l432kc", "target": "thumbv7em-none-eabi", "project": "stm32" }, + { soc: "stm32u545re", "target": "thumbv8m.main-none-eabihf", "project": "stm32" }, + { soc: "nrf51422", "target": "thumbv6m-none-eabi", "project": "nrf" }, + { soc: "nrf52832", "target": "thumbv7em-none-eabihf", "project": "nrf" } ]