Skip to content

Commit 0a1a06c

Browse files
committed
Add no-std tests
1 parent 8447e82 commit 0a1a06c

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

.github/actions/prepare/action.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,26 @@ inputs:
1212
runs:
1313
using: "composite"
1414
steps:
15+
- name: "Install ARM cross-compiler for no-std"
16+
shell: bash
17+
run: |
18+
sudo apt-get update && sudo apt-get install -y gcc-arm-none-eabi
19+
echo "CC_thumbv7m_none_eabi=arm-none-eabi-gcc" >> $GITHUB_ENV
20+
1521
- name: "Determine toolchain"
1622
id: toolchain
1723
shell: bash
1824
run: |
19-
if [ "${{ inputs.toolchain }}" = "nightly" ]; then
20-
TOOLCHAIN="$(cat nightly-version)"
21-
else
22-
TOOLCHAIN="${{ inputs.toolchain }}"
23-
fi
25+
[[ "${{ inputs.toolchain }}" == "nightly" ]] && TOOLCHAIN=$(cat nightly-version) || TOOLCHAIN="${{ inputs.toolchain }}"
2426
echo "version=$TOOLCHAIN" >> $GITHUB_OUTPUT
2527
2628
- name: "Setup requested toolchain"
2729
uses: actions-rust-lang/setup-rust-toolchain@v1
2830
with:
29-
toolchain: ${{ steps.toolchain.outputs.version }}
31+
toolchain: stable,${{ steps.toolchain.outputs.version }}
3032
components: ${{ inputs.components }}
33+
target: thumbv7m-none-eabi
3134

3235
- name: "Install RBMT"
3336
shell: bash
34-
run: cargo install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev "$(cat rbmt-version)" cargo-rbmt --locked
37+
run: cargo +stable install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev "$(cat rbmt-version)" cargo-rbmt --locked

rbmt-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
bcff6290c9e3f5b4d7e832acb5a8c6bf890fd1ce
1+
554c939298cac198aab6d9704890a832a2ed839b

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
//! [BIP-174]: <https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki>
99
//! [BIP-370]: <https://github.com/bitcoin/bips/blob/master/bip-0370.mediawiki>
1010
11-
#![cfg_attr(all(not(feature = "std"), not(test)), no_std)]
11+
#![no_std]
1212
// Experimental features we need.
1313
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
1414
// Coding conventions
1515
#![warn(missing_docs)]
1616

17+
#[cfg(any(feature = "std", test))]
18+
extern crate std;
19+
1720
#[macro_use]
1821
extern crate alloc;
1922

@@ -76,5 +79,8 @@ mod prelude {
7679
#[cfg(any(feature = "std", test))]
7780
pub use std::collections::{BTreeMap, BTreeSet, btree_map, BinaryHeap};
7881

82+
#[cfg(any(feature = "std", test))]
83+
pub use std::{println, print, format, write, writeln};
84+
7985
pub use bitcoin::hex::DisplayHex;
8086
}

src/v0/miniscript/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: CC0-1.0
22

33
//! Private utils copied from `rust-miniscript`'s `util` module.
4-
4+
5+
use crate::prelude::*;
56
use bitcoin::consensus::encode::VarInt;
67
use miniscript::miniscript::satisfy::Placeholder;
78
use miniscript::MiniscriptKey;

0 commit comments

Comments
 (0)