7b402e930c schemars: Add pinning docs (Tobin C. Harding)
0848ab7e25 Fix clippy warnings for embedded build (Tobin C. Harding)
5b1443a91c hashes/embedded: Add script dir and README (Tobin C. Harding)
94732aecbf Add patch section to test crates (Tobin C. Harding)
512d982275 Remove path field from internals dependency (Tobin C. Harding)

Pull request description:

  Do a bunch of infrastructure fixes that either are needed for adding additional crate deps (hex) or updating deps (internals, hashes), or just make the tests more maintainable.

ACKs for top commit:
  apoelstra:
    ACK 7b402e930c
  sanket1729:
    ACK 7b402e930c

Tree-SHA512: 9349bb20225363914acc774cca672a23e6562fb02aea644777c558074d5eeb65289d68a93b5be59a93e9b32167e2494f6599caedc8a0d9cfbee2f94d406edbfc
This commit is contained in:
Andrew Poelstra 2023-07-19 15:57:47 +00:00
commit 894c926f56
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
11 changed files with 53 additions and 4 deletions

View File

@ -6,3 +6,6 @@ path = "bitcoin"
[patch.crates-io.bitcoin_hashes]
path = "hashes"
[patch.crates-io.bitcoin-internals]
path = "internals"

View File

@ -34,7 +34,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
internals = { package = "bitcoin-internals", version = "0.2.0", path = "../internals" }
internals = { package = "bitcoin-internals", version = "0.2.0" }
bech32 = { version = "0.9.0", default-features = false }
hashes = { package = "bitcoin_hashes", version = "0.12.0", default-features = false }
secp256k1 = { version = "0.27.0", default-features = false, features = ["bitcoin_hashes"] }

View File

@ -30,3 +30,6 @@ lto = true # better optimizations
[patch.crates-io.bitcoin_hashes]
path = "../../hashes"
[patch.crates-io.bitcoin-internals]
path = "../../internals"

View File

@ -25,7 +25,7 @@ mod primitive {
use crate::prelude::*;
#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))]
fn check_limit(len: usize) -> Result<(), PushBytesError> { Ok(()) }
fn check_limit(_: usize) -> Result<(), PushBytesError> { Ok(()) }
#[cfg(not(any(target_pointer_width = "16", target_pointer_width = "32")))]
fn check_limit(len: usize) -> Result<(), PushBytesError> {
@ -380,7 +380,7 @@ mod error {
}
impl fmt::Display for PushBytesError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.never {} }
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { match self.never {} }
}
}

View File

@ -23,7 +23,7 @@ all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
internals = { path = "../internals", package = "bitcoin-internals", version = "0.2.0" }
internals = { package = "bitcoin-internals", version = "0.2.0" }
core2 = { version = "0.3.0", default_features = false, optional = true }
schemars = { version = "0.8.3", optional = true }

View File

@ -30,3 +30,6 @@ bench = false
codegen-units = 1 # better optimizations
debug = true # symbols are nice and they don't increase the size on Flash
lto = true # better optimizations
[patch.crates-io.bitcoin-internals]
path = "../../internals"

30
hashes/embedded/README.md Normal file
View File

@ -0,0 +1,30 @@
# Running
To run the embedded test, first prepare your environment:
```shell
sudo ./scripts/install-deps
rustup +nightly target add thumbv7m-none-eabi
```
Then:
```shell
source ./scripts/env.sh && cargo +nightly run --target thumbv7m-none-eabi
```
Output should be something like:
```text
hash:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad hash_check:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
hash:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad hash_check:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
```
## Cleanup
After sourcing `scripts/env.sh` and _before_ building again using another target
you'll want to unset `RUSTFLAGS` otherwise you'll get linker errors.
```shell
unset RUSTFLAGS
```

View File

@ -0,0 +1,2 @@
export RUSTFLAGS="-C link-arg=-Tlink.x"
export CARGO_TARGET_THUMBV7M_NONE_EABI_RUNNER="qemu-system-arm -cpu cortex-m3 -machine mps2-an385 -nographic -semihosting-config enable=on,target=native -kernel"

View File

@ -0,0 +1,3 @@
#!/bin/sh
apt install gcc-arm-none-eabi qemu-system-arm gdb-multiarch

View File

@ -18,3 +18,6 @@ serde = { version = "1.0", default-features = false}
schemars = "0.8.3"
serde_test = "1.0"
serde_json = "1.0"
[patch.crates-io.bitcoin-internals]
path = "../../../internals"

View File

@ -7,3 +7,5 @@ Run as usual with `cargo test`.
To run the tests with the MSRV you will need to pin `serde`:
- `cargo update -p serde --precise 1.0.156`
- `cargo update -p regex --precise 1.7.3`
- `cargo update -p chrono --precise 0.4.24`