Add support for running tests in no_std mode.
This commit is contained in:
10
README.rst
10
README.rst
@@ -74,11 +74,13 @@ Or, when using `cretonne` as a dependency (in Cargo.toml):
|
|||||||
path = "..."
|
path = "..."
|
||||||
features = ["no_std"]
|
features = ["no_std"]
|
||||||
|
|
||||||
Currently, tests don't test the `no_std` feature:
|
`no_std` is currently "best effort". We won't try to break it, and we'll
|
||||||
|
accept patches fixing problems, however we don't expect all developers to
|
||||||
|
build and test with `no_std` when submitting patches. Accordingly, the
|
||||||
|
`./test-all.sh` script does not test `no_std`.
|
||||||
|
|
||||||
1. `cargo test --features no_std` won't compile.
|
There is a separate `./test-no_std.sh` script that tests the `no_std`
|
||||||
|
feature in packages which support it.
|
||||||
2. `./test-all.sh` doesn't test the `no_std` feature.
|
|
||||||
|
|
||||||
It's important to note that cretonne still needs liballoc to compile.
|
It's important to note that cretonne still needs liballoc to compile.
|
||||||
Thus, whatever environment is used must implement an allocator.
|
Thus, whatever environment is used must implement an allocator.
|
||||||
|
|||||||
28
cranelift/test-no_std.sh
Executable file
28
cranelift/test-no_std.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This is the test script for testing the no_std configuration of
|
||||||
|
# packages which support it.
|
||||||
|
|
||||||
|
# Exit immediately on errors.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Repository top-level directory.
|
||||||
|
cd $(dirname "$0")
|
||||||
|
topdir=$(pwd)
|
||||||
|
|
||||||
|
function banner() {
|
||||||
|
echo "====== $@ ======"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test those packages which have no_std support.
|
||||||
|
LIBS="cretonne frontend wasm native"
|
||||||
|
cd "$topdir"
|
||||||
|
for LIB in $LIBS
|
||||||
|
do
|
||||||
|
banner "Rust unit tests in $LIB"
|
||||||
|
cd "lib/$LIB"
|
||||||
|
cargo test --features no_std
|
||||||
|
cd "$topdir"
|
||||||
|
done
|
||||||
|
|
||||||
|
banner "OK"
|
||||||
@@ -222,7 +222,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a text version of the path to `key`.
|
/// Get a text version of the path to `key`.
|
||||||
fn tpath(&self, key: K, forest: &MapForest<K, V, C>, comp: &C) -> String {
|
fn tpath(&self, key: K, forest: &MapForest<K, V, C>, comp: &C) -> ::std::string::String {
|
||||||
|
use std::string::ToString;
|
||||||
match self.root.expand() {
|
match self.root.expand() {
|
||||||
None => "map(empty)".to_string(),
|
None => "map(empty)".to_string(),
|
||||||
Some(root) => {
|
Some(root) => {
|
||||||
@@ -415,7 +416,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a text version of the path to the current position.
|
/// Get a text version of the path to the current position.
|
||||||
fn tpath(&self) -> String {
|
fn tpath(&self) -> ::std::string::String {
|
||||||
|
use std::string::ToString;
|
||||||
self.path.to_string()
|
self.path.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,6 +425,7 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::vec::Vec;
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::super::NodeData;
|
use super::super::NodeData;
|
||||||
|
|
||||||
|
|||||||
@@ -580,6 +580,7 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::string::ToString;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
// Forest impl for a set implementation.
|
// Forest impl for a set implementation.
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ impl<F: Forest> NodePool<F> {
|
|||||||
{
|
{
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
use std::vec::Vec;
|
||||||
use super::Comparator;
|
use super::Comparator;
|
||||||
use entity::SparseSet;
|
use entity::SparseSet;
|
||||||
|
|
||||||
|
|||||||
@@ -314,7 +314,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get a text version of the path to the current position.
|
/// Get a text version of the path to the current position.
|
||||||
fn tpath(&self) -> String {
|
fn tpath(&self) -> ::std::string::String {
|
||||||
|
use std::string::ToString;
|
||||||
self.path.to_string()
|
self.path.to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,6 +352,7 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::vec::Vec;
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::super::NodeData;
|
use super::super::NodeData;
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ use std::fmt;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
#[cfg(not(feature = "no_std"))]
|
#[cfg(not(feature = "no_std"))]
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
use std::sync::atomic;
|
use std::sync::atomic;
|
||||||
#[cfg(not(feature = "no_std"))]
|
#[cfg(not(feature = "no_std"))]
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
static STATE: atomic::AtomicIsize = atomic::ATOMIC_ISIZE_INIT;
|
static STATE: atomic::AtomicIsize = atomic::ATOMIC_ISIZE_INIT;
|
||||||
|
|
||||||
/// Is debug tracing enabled?
|
/// Is debug tracing enabled?
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use cursor::{Cursor, FuncCursor};
|
use cursor::{Cursor, FuncCursor};
|
||||||
use ir::{Function, InstBuilder, types};
|
use ir::{Function, InstBuilder, types};
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty() {
|
fn empty() {
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ impl FromStr for FloatCC {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
static INT_ALL: [IntCC; 10] = [
|
static INT_ALL: [IntCC; 10] = [
|
||||||
IntCC::Equal,
|
IntCC::Equal,
|
||||||
|
|||||||
@@ -944,6 +944,7 @@ mod tests {
|
|||||||
use cursor::{Cursor, FuncCursor};
|
use cursor::{Cursor, FuncCursor};
|
||||||
use ir::types;
|
use ir::types;
|
||||||
use ir::{Function, Opcode, InstructionData, TrapCode};
|
use ir::{Function, Opcode, InstructionData, TrapCode};
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn make_inst() {
|
fn make_inst() {
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ impl From<Heap> for AnyEntity {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn value_with_number() {
|
fn value_with_number() {
|
||||||
|
|||||||
@@ -379,6 +379,7 @@ impl FromStr for CallConv {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ir::types::{I32, F32, B8};
|
use ir::types::{I32, F32, B8};
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn argument_type() {
|
fn argument_type() {
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ impl FromStr for ExternalName {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::ExternalName;
|
use super::ExternalName;
|
||||||
use ir::LibCall;
|
use ir::LibCall;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display_testcase() {
|
fn display_testcase() {
|
||||||
|
|||||||
@@ -630,6 +630,7 @@ mod tests {
|
|||||||
use std::{f32, f64};
|
use std::{f32, f64};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn format_imm64() {
|
fn format_imm64() {
|
||||||
|
|||||||
@@ -724,6 +724,7 @@ pub enum ResolvedConstraint {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn opcodes() {
|
fn opcodes() {
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ mod tests {
|
|||||||
use super::JumpTableData;
|
use super::JumpTableData;
|
||||||
use ir::Ebb;
|
use ir::Ebb;
|
||||||
use entity::EntityRef;
|
use entity::EntityRef;
|
||||||
|
use std::vec::Vec;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty() {
|
fn empty() {
|
||||||
|
|||||||
@@ -743,6 +743,7 @@ mod tests {
|
|||||||
use entity::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{Ebb, Inst, ProgramOrder, SourceLoc};
|
use ir::{Ebb, Inst, ProgramOrder, SourceLoc};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
struct LayoutCursor<'f> {
|
struct LayoutCursor<'f> {
|
||||||
/// Borrowed function layout. Public so it can be re-borrowed from this cursor.
|
/// Borrowed function layout. Public so it can be re-borrowed from this cursor.
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ impl LibCall {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display() {
|
fn display() {
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use entity::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{Inst, Ebb};
|
use ir::{Inst, Ebb};
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn convert() {
|
fn convert() {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ impl fmt::Display for SourceLoc {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ir::SourceLoc;
|
use ir::SourceLoc;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display() {
|
fn display() {
|
||||||
|
|||||||
@@ -320,6 +320,7 @@ mod tests {
|
|||||||
use ir::Function;
|
use ir::Function;
|
||||||
use ir::types;
|
use ir::types;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stack_slot() {
|
fn stack_slot() {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ impl FromStr for TrapCode {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
// Everything but user-defined codes.
|
// Everything but user-defined codes.
|
||||||
const CODES: [TrapCode; 8] = [
|
const CODES: [TrapCode; 8] = [
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ impl Default for Type {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_scalars() {
|
fn basic_scalars() {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-arm32.rs"));
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::{INFO, GPR, S, D};
|
use super::{INFO, GPR, S, D};
|
||||||
use isa::RegUnit;
|
use isa::RegUnit;
|
||||||
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unit_encodings() {
|
fn unit_encodings() {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-arm64.rs"));
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::INFO;
|
use super::INFO;
|
||||||
use isa::RegUnit;
|
use isa::RegUnit;
|
||||||
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unit_encodings() {
|
fn unit_encodings() {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-intel.rs"));
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use isa::RegUnit;
|
use isa::RegUnit;
|
||||||
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unit_encodings() {
|
fn unit_encodings() {
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ mod tests {
|
|||||||
use isa;
|
use isa;
|
||||||
use ir::{DataFlowGraph, InstructionData, Opcode};
|
use ir::{DataFlowGraph, InstructionData, Opcode};
|
||||||
use ir::{types, immediates};
|
use ir::{types, immediates};
|
||||||
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
fn encstr(isa: &isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {
|
fn encstr(isa: &isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {
|
||||||
match enc {
|
match enc {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ include!(concat!(env!("OUT_DIR"), "/registers-riscv.rs"));
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::{INFO, GPR, FPR};
|
use super::{INFO, GPR, FPR};
|
||||||
use isa::RegUnit;
|
use isa::RegUnit;
|
||||||
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn unit_encodings() {
|
fn unit_encodings() {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::{builder, Flags};
|
use super::{builder, Flags};
|
||||||
use settings::{self, Configurable};
|
use settings::{self, Configurable};
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display_default() {
|
fn display_default() {
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn adjpairs() {
|
fn adjpairs() {
|
||||||
use super::IteratorExtras;
|
use super::IteratorExtras;
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ mod write;
|
|||||||
#[cfg(feature = "no_std")]
|
#[cfg(feature = "no_std")]
|
||||||
mod std {
|
mod std {
|
||||||
pub use core::*;
|
pub use core::*;
|
||||||
#[macro_use]
|
|
||||||
pub use alloc::{boxed, vec, string};
|
pub use alloc::{boxed, vec, string};
|
||||||
pub mod collections {
|
pub mod collections {
|
||||||
pub use hashmap_core::{HashMap, HashSet};
|
pub use hashmap_core::{HashMap, HashSet};
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ mod test {
|
|||||||
use loop_analysis::{Loop, LoopAnalysis};
|
use loop_analysis::{Loop, LoopAnalysis};
|
||||||
use flowgraph::ControlFlowGraph;
|
use flowgraph::ControlFlowGraph;
|
||||||
use dominator_tree::DominatorTree;
|
use dominator_tree::DominatorTree;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn nested_loops_detection() {
|
fn nested_loops_detection() {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::partition_slice;
|
use super::partition_slice;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
fn check(x: &[u32], want: &[u32]) {
|
fn check(x: &[u32], want: &[u32]) {
|
||||||
assert_eq!(x.len(), want.len());
|
assert_eq!(x.len(), want.len());
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ impl fmt::Display for AllocatableSet {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use isa::registers::{RegClass, RegClassData};
|
use isa::registers::{RegClass, RegClassData};
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
// Register classes for testing.
|
// Register classes for testing.
|
||||||
const GPR: RegClass = &RegClassData {
|
const GPR: RegClass = &RegClassData {
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ use std::cmp;
|
|||||||
use std::iter;
|
use std::iter;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
use std::iter::Peekable;
|
|
||||||
use std::mem;
|
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use isa::{TargetIsa, EncInfo};
|
use isa::{TargetIsa, EncInfo};
|
||||||
use timing;
|
use timing;
|
||||||
|
|||||||
@@ -463,6 +463,7 @@ mod tests {
|
|||||||
use entity::EntityRef;
|
use entity::EntityRef;
|
||||||
use ir::{ProgramOrder, ExpandedProgramPoint};
|
use ir::{ProgramOrder, ExpandedProgramPoint};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
use std::vec::Vec;
|
||||||
|
|
||||||
// Dummy program order which simply compares indexes.
|
// Dummy program order which simply compares indexes.
|
||||||
// It is assumed that EBBs have indexes that are multiples of 10, and instructions have indexes
|
// It is assumed that EBBs have indexes that are multiples of 10, and instructions have indexes
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ mod tests {
|
|||||||
use regalloc::AllocatableSet;
|
use regalloc::AllocatableSet;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use super::Pressure;
|
use super::Pressure;
|
||||||
|
use std::boxed::Box;
|
||||||
|
|
||||||
// Make an arm32 `TargetIsa`, if possible.
|
// Make an arm32 `TargetIsa`, if possible.
|
||||||
fn arm32() -> Option<Box<TargetIsa>> {
|
fn arm32() -> Option<Box<TargetIsa>> {
|
||||||
|
|||||||
@@ -1163,6 +1163,7 @@ mod tests {
|
|||||||
use isa::{TargetIsa, RegClass, RegUnit, RegInfo};
|
use isa::{TargetIsa, RegClass, RegUnit, RegInfo};
|
||||||
use regalloc::AllocatableSet;
|
use regalloc::AllocatableSet;
|
||||||
use super::{Solver, Move};
|
use super::{Solver, Move};
|
||||||
|
use std::boxed::Box;
|
||||||
|
|
||||||
// Make an arm32 `TargetIsa`, if possible.
|
// Make an arm32 `TargetIsa`, if possible.
|
||||||
fn arm32() -> Option<Box<TargetIsa>> {
|
fn arm32() -> Option<Box<TargetIsa>> {
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ mod tests {
|
|||||||
use super::{builder, Flags};
|
use super::{builder, Flags};
|
||||||
use super::Error::*;
|
use super::Error::*;
|
||||||
use super::Configurable;
|
use super::Configurable;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display_default() {
|
fn display_default() {
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ mod details {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn display() {
|
fn display() {
|
||||||
|
|||||||
@@ -1132,7 +1132,10 @@ mod tests {
|
|||||||
Ok(_) => { panic!("Expected an error!") },
|
Ok(_) => { panic!("Expected an error!") },
|
||||||
Err(Error { message, .. } ) => {
|
Err(Error { message, .. } ) => {
|
||||||
if !message.contains($msg) {
|
if !message.contains($msg) {
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
panic!(format!("'{}' did not contain the substring '{}'", message, $msg));
|
panic!(format!("'{}' did not contain the substring '{}'", message, $msg));
|
||||||
|
#[cfg(feature = "no_std")]
|
||||||
|
panic!("error message did not contain the expected substring");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,6 +467,7 @@ impl<'a> fmt::Display for DisplayValues<'a> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use ir::{Function, ExternalName, StackSlotData, StackSlotKind};
|
use ir::{Function, ExternalName, StackSlotData, StackSlotKind};
|
||||||
use ir::types;
|
use ir::types;
|
||||||
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
|
|||||||
@@ -1039,7 +1039,12 @@ mod tests {
|
|||||||
let flags = settings::Flags::new(&settings::builder());
|
let flags = settings::Flags::new(&settings::builder());
|
||||||
match verify_function(&func, &flags) {
|
match verify_function(&func, &flags) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(err) => panic!(err.message),
|
Err(err) => {
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
|
panic!(err.message);
|
||||||
|
#[cfg(feature = "no_std")]
|
||||||
|
panic!("function failed to verify");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1213,7 +1218,12 @@ mod tests {
|
|||||||
let flags = settings::Flags::new(&settings::builder());
|
let flags = settings::Flags::new(&settings::builder());
|
||||||
match verify_function(&func, &flags) {
|
match verify_function(&func, &flags) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(err) => panic!(err.message),
|
Err(err) => {
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
|
panic!(err.message);
|
||||||
|
#[cfg(feature = "no_std")]
|
||||||
|
panic!("function failed to verify");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1259,7 +1269,12 @@ mod tests {
|
|||||||
let flags = settings::Flags::new(&settings::builder());
|
let flags = settings::Flags::new(&settings::builder());
|
||||||
match verify_function(&func, &flags) {
|
match verify_function(&func, &flags) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(err) => panic!(err.message),
|
Err(err) => {
|
||||||
|
#[cfg(not(feature = "no_std"))]
|
||||||
|
panic!(err.message);
|
||||||
|
#[cfg(feature = "no_std")]
|
||||||
|
panic!("function failed to verify");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user