}
fn payload_offset<T>(&self) -> *mut T {
- let mut ptr = (self as *const AllocSlab) as usize;
- ptr += mem::size_of::<AllocSlab>();
- ptr as *mut T
+ // This looks really scary, should this method be marked as unsafe?
+ // Also, this seems to cause UB.
+ unsafe { (self as *const AllocSlab).add(1) as *mut T }
}
}
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn heap_cell_value_const_cast() {
let mut wam = MockWAM::new();
#[cfg(target_pointer_width = "32")]
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on arena.rs UB")]
fn heap_put_literal_tests() {
let mut wam = MockWAM::new();
} else if let Some(ptr) = self.as_ptr() {
AtomString::Dynamic(AtomTableRef::map(ptr, |ptr| {
let header =
+ // Miri seems to hit this line a lot
unsafe { ptr::read::<AtomHeader>(ptr as *const u8 as *const AtomHeader) };
let len = header.len() as usize;
let buf = unsafe { (ptr as *const u8).add(mem::size_of::<AtomHeader>()) };
unsafe fn write_to_ptr(string: &str, ptr: *mut u8) {
ptr::write(ptr as *mut _, AtomHeader::build_with(string.len() as u64));
- let str_ptr = (ptr as usize + mem::size_of::<AtomHeader>()) as *mut u8;
+ let str_ptr = ptr.add(mem::size_of::<AtomHeader>());
ptr::copy_nonoverlapping(string.as_ptr(), str_ptr, string.len());
}
}
#[test]
+ #[cfg_attr(miri, ignore = "it takes too long to run")]
fn heap_stackless_iter_tests() {
let mut wam = MockWAM::new();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on atom_table.rs UB")]
fn heap_stackful_iter_tests() {
let mut wam = MockWAM::new();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on atom_table.rs UB")]
fn heap_stackful_post_order_iter() {
let mut wam = MockWAM::new();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on atom_table.rs UB")]
fn heap_stackless_post_order_iter() {
let mut wam = MockWAM::new();
use crate::machine::mock_wam::*;
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn term_printing_tests() {
let mut wam = MockWAM::new();
use crate::machine::mock_wam::*;
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn arith_eval_by_metacall_tests() {
let mut wam = MachineState::new();
let mut op_dir = default_op_dir();
use crate::machine::mock_wam::*;
#[test]
+ #[cfg_attr(miri, ignore = "blocked on atom_table.rs UB")]
fn copier_tests() {
let mut wam = MockWAM::new();
use crate::machine::mock_wam::*;
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn heap_marking_tests() {
let mut wam = MockWAM::new();
use crate::machine::{QueryMatch, QueryResolution, Value};
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn programatic_query() {
let mut machine = Machine::new_lib();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn failing_query() {
let mut machine = Machine::new_lib();
let query = String::from(r#"triple("a",P,"b")."#);
}
#[test]
+ #[cfg_attr(miri, ignore)]
fn complex_results() {
let mut machine = Machine::new_lib();
machine.load_module_string(
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn empty_predicate() {
let mut machine = Machine::new_lib();
machine.load_module_string(
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn list_results() {
let mut machine = Machine::new_lib();
machine.load_module_string(
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn consult() {
let mut machine = Machine::new_lib();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn integration_test() {
let mut machine = Machine::new_lib();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn findall() {
let mut machine = Machine::new_lib();
use super::*;
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn unify_tests() {
let mut wam = MachineState::new();
let mut op_dir = default_op_dir();
}
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn test_unify_with_occurs_check() {
let mut wam = MachineState::new();
let mut op_dir = default_op_dir();
use crate::machine::mock_wam::*;
#[test]
+ #[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn pstr_iter_tests() {
let mut wam = MockWAM::new();
for idx in 0..num_cells {
ptr::write(
- (new_ptr as usize + offset) as *mut HeapCellValue,
+ new_ptr.add(offset) as *mut HeapCellValue,
stack_loc_as_cell!(AndFrame, e, idx + 1),
);
#[inline(always)]
pub(crate) fn index_and_frame_mut(&mut self, e: usize) -> &mut AndFrame {
unsafe {
- let ptr = self.buf.base as usize + e;
+ // This is doing alignment wrong
+ let ptr = self.buf.base.add(e);
&mut *(ptr as *mut AndFrame)
}
}
use crate::machine::mock_wam::*;
#[test]
+ #[cfg_attr(miri, ignore)]
fn stack_tests() {
let mut wam = MockWAM::new();
#[inline]
fn copy_to_arena(self, dst: *mut Self) -> Self::PtrToAllocated {
unsafe {
+ // Miri seems to hit this a lot
ptr::write(dst, self);
TypedArenaPtr::new(dst as *mut Self)
}
use std::io::Cursor;
#[test]
+ #[cfg_attr(miri, ignore = "slow and not very relevant")]
fn plain_string() {
let mut read_string = CharReader::new(Cursor::new("a string"));
}
#[test]
+ #[cfg_attr(miri, ignore = "slow and not very relevant")]
fn greek_string() {
let mut read_string = CharReader::new(Cursor::new("λέξη"));
}
#[test]
+ #[cfg_attr(miri, ignore = "slow and not very relevant")]
fn russian_string() {
let mut read_string = CharReader::new(Cursor::new("слово"));
}
#[test]
+ #[cfg_attr(miri, ignore = "slow and not very relevant")]
fn greek_lorem_ipsum() {
let lorem_ipsum = "Λορεμ ιπσθμ δολορ σιτ αμετ, οφφενδιτ
εφφιcιενδι σιτ ει, ηαρθμ λεγερε qθαερενδθμ ιθσ νε. Ηασ νο εροσ
}
#[test]
+ #[cfg_attr(miri, ignore = "slow and not very relevant")]
fn armenian_lorem_ipsum() {
let lorem_ipsum = "լոռեմ իպսում դոլոռ սիթ ամեթ, նովում գռաեծո
սեա եա, աբհոռռեանթ դիսպութանդո եի քուի. իդ քուոդ ինդոծթում
}
#[test]
+ #[cfg_attr(miri, ignore = "slow and not very relevant")]
fn russian_lorem_ipsum() {
let lorem_ipsum = "Лорем ипсум долор сит амет, атяуи дицам еи
сит, ид сеа фацилис елаборарет. Меа еу яуас алияуид, те яуи
let layout = alloc::Layout::from_size_align_unchecked(cap, T::align());
self.base = alloc::alloc(layout) as *const _;
- self.top = (self.base as usize + cap) as *const _;
+ self.top = self.base.add(cap);
*self.ptr.get_mut() = self.base as *mut _;
}
pub unsafe fn alloc(&self, size: usize) -> *mut u8 {
if self.free_space() >= size {
let ptr = *self.ptr.get();
- *self.ptr.get() = (ptr as usize + size) as *mut _;
+ *self.ptr.get() = ptr.add(size) as *mut _;
ptr
} else {
ptr::null_mut()
// issue #831
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn call_0() {
load_module_test(
"tests-pl/issue831-call0.pl",
/// to re-generate all reference output files run `TRYCMD=overwrite cargo test -- cli_test`
/// then check that the changes are as expected e.g. by looking at the `git diff`
#[test]
+#[cfg_attr(miri, ignore = "blocked on crossbeam UB")]
fn cli_tests() {
trycmd::TestCases::new()
.default_bin_name("scryer-prolog")
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn builtins() {
load_module_test("src/tests/builtins.pl", "");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn call_with_inference_limit() {
load_module_test("src/tests/call_with_inference_limit.pl", "");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn facts() {
load_module_test("src/tests/facts.pl", "");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn hello_world() {
load_module_test("src/tests/hello_world.pl", "Hello World!\n");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn syntax_error() {
load_module_test(
"tests-pl/syntax_error.pl",
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn predicates() {
load_module_test("src/tests/predicates.pl", "");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn rules() {
load_module_test("src/tests/rules.pl", "");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn setup_call_cleanup_load() {
load_module_test(
"src/tests/setup_call_cleanup.pl",
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn clpz_load() {
load_module_test("src/tests/clpz/test_clpz.pl", "");
}
#[serial]
#[test]
+#[cfg_attr(miri, ignore = "blocked on streams.rs UB")]
fn iso_conformity_tests() {
load_module_test("tests-pl/iso-conformity-tests.pl", "All tests passed");
}