-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'tcharding/07-28-alloc-feature' into HEAD
- Loading branch information
Showing
11 changed files
with
147 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
# | ||
# CI test script for rust-bech32. | ||
# | ||
# The "strict" feature is used to configure cargo to deny all warnings, always use it in test runs. | ||
|
||
set -ex | ||
|
||
# Sanity, check tools exist. | ||
cargo --version | ||
rustc --version | ||
|
||
# Sanity, first check with default features. | ||
|
||
cargo build | ||
cargo test | ||
|
||
# Sanity, build with no features. | ||
|
||
cargo build --no-default-features --features="strict" | ||
|
||
# Check "alloc" feature alone. | ||
|
||
cargo build --no-default-features --features="strict std" | ||
cargo test --no-default-features --features="strict std" | ||
|
||
# Check "std" feature (implies "alloc"). | ||
|
||
cargo build --no-default-features --features="strict alloc" | ||
cargo test --no-default-features --features="strict alloc" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
authors = ["Tobin C. Harding <me@tobin.cc>"] | ||
edition = "2018" | ||
readme = "README.md" | ||
name = "no-allocator" | ||
version = "0.1.0" | ||
|
||
[profile.dev] | ||
panic = "abort" | ||
|
||
[profile.release] | ||
panic = "abort" | ||
|
||
[dependencies] | ||
bech32 = { path = "../../", default_features = false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# no_std test crate without an allocator | ||
|
||
This crate is based on the blog post found at: | ||
|
||
https://blog.dbrgn.ch/2019/12/24/testing-for-no-std-compatibility/ | ||
|
||
Its purpose is to test that the `rust-bech32` library can be built in a `no_std` environment without | ||
a global allocator. | ||
|
||
Build with: `cargo rustc -- -C link-arg=-nostartfiles`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! Test `no_std` build of `bech32`. | ||
//! | ||
//! Build with: `cargo rustc -- -C link-arg=-nostartfiles`. | ||
//! | ||
#![no_std] | ||
#![no_main] | ||
|
||
use core::panic::PanicInfo; | ||
|
||
// Note: `#[global_allocator]` is NOT set. | ||
|
||
#[allow(unused_imports)] | ||
use bech32; | ||
|
||
/// This function is called on panic, defining this ensures build will fail if `std` is enabled | ||
/// because `panic` will be defined twice. | ||
#[panic_handler] | ||
fn panic(_info: &PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn _start() -> ! { | ||
loop {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.