-
Notifications
You must be signed in to change notification settings - Fork 391
Implement non-deterministc mode #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
7323957
312f938
dddeda7
808b149
5530d29
6b0440e
b120e8b
6d3e93c
858e82b
5f99764
1748744
5e07ff6
6b4c5b8
9243680
22044c8
ae8e7f6
c6e0d09
0837d63
2eb2c8d
48b22b8
a8763f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// ignore-macos | ||
// ignore-windows | ||
|
||
#![feature(rustc_private)] | ||
extern crate libc; | ||
|
||
fn main() { | ||
let mut buf = [0u8; 5]; | ||
unsafe { | ||
libc::syscall(libc::SYS_getrandom, buf.as_mut_ptr() as *mut libc::c_void, 5 as libc::size_t, 0 as libc::c_uint); | ||
//~^ ERROR constant evaluation error: miri does not support gathering system entropy in deterministic mode! | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
// compile-flags: -Zmiri-seed=0000000000000000 | ||
|
||
use std::collections::{self, HashMap}; | ||
use std::hash::BuildHasherDefault; | ||
use std::hash::{BuildHasherDefault, BuildHasher}; | ||
|
||
fn main() { | ||
let mut map : HashMap<i32, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = Default::default(); | ||
fn test_map<S: BuildHasher>(mut map: HashMap<i32, i32, S>) { | ||
map.insert(0, 0); | ||
assert_eq!(map.values().fold(0, |x, y| x+y), 0); | ||
|
||
|
@@ -22,4 +23,17 @@ fn main() { | |
assert_eq!(map.values().fold(0, |x, y| x+y), num*(num-1)/2); | ||
|
||
// TODO: Test Entry API, Iterators, ... | ||
|
||
} | ||
|
||
fn main() { | ||
let _map : HashMap<i32, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = Default::default(); | ||
|
||
// TODO: Implement random number generation on OS X | ||
if cfg!(not(target_os = "macos")) { | ||
let map_normal: HashMap<i32, i32> = HashMap::new(); | ||
test_map(map_normal); | ||
} else { | ||
test_map(_map); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to test creation of both types of maps on all platforms, even though only one has the full set of tests run on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH I don't see the point, this code just looks weird. Why test creation on both but not the rest of the test? The purpose of this is mostly to test Miri, not to test the HashMap. For that, HashBrown actually runs its test suite in Miri. I don't see a good reason to use multiple different hash functions here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My intention was to ensure that Miri's test coverage didn't regress (e.g. ensure that we catch any regressions with creating a HashMap with a custom hasher). I'll clean it up. |
||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.