Skip to content

Commit 4529e67

Browse files
committed
freebsd: test std threadname and fs APIs
also reorder foreign_items to fix the grouping, and reorder the tests_minimal invocations to be more consistent
1 parent a551b4d commit 4529e67

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

src/tools/miri/ci/ci.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@ case $HOST_TARGET in
141141
MIRI_TEST_TARGET=arm-unknown-linux-gnueabi run_tests
142142
MIRI_TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
143143
# Partially supported targets (tier 2)
144-
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align num_cpus
145-
MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal hello integer vec panic/panic concurrency/simple pthread-threadname libc-getentropy libc-getrandom libc-misc libc-fs atomic env align num_cpus
146-
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal hello integer vec panic/panic
147-
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal no_std integer strings wasm
148-
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std integer strings wasm
144+
VERY_BASIC="integer vec string btreemap" # common things we test on all of them (if they have std), requires no target-specific shims
145+
BASIC="$VERY_BASIC hello hashmap alloc align" # ensures we have the shims for stdout and basic data structures
146+
MIRI_TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-getentropy libc-getrandom libc-misc fs env num_cpus
147+
MIRI_TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC panic/panic concurrency/simple atomic threadname libc-getentropy libc-getrandom libc-misc fs env num_cpus
148+
MIRI_TEST_TARGET=aarch64-linux-android run_tests_minimal $VERY_BASIC hello panic/panic
149+
MIRI_TEST_TARGET=wasm32-wasi run_tests_minimal $VERY_BASIC wasm
150+
MIRI_TEST_TARGET=wasm32-unknown-unknown run_tests_minimal $VERY_BASIC wasm
149151
MIRI_TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
150152
# Custom target JSON file
151153
MIRI_TEST_TARGET=tests/avr.json MIRI_NO_STD=1 run_tests_minimal no_std

src/tools/miri/src/shims/unix/freebsd/foreign_items.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
4747
this.read_scalar(len)?,
4848
)?;
4949
}
50-
"getrandom" => {
51-
let [ptr, len, flags] =
52-
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
53-
let ptr = this.read_pointer(ptr)?;
54-
let len = this.read_target_usize(len)?;
55-
let _flags = this.read_scalar(flags)?.to_i32()?;
56-
// flags on freebsd does not really matter
57-
// in practice, GRND_RANDOM does not particularly draw from /dev/random
58-
// since it is the same as to /dev/urandom.
59-
// GRND_INSECURE is only an alias of GRND_NONBLOCK, which
60-
// does not affect the RNG.
61-
// https://man.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&n=1
62-
this.gen_random(ptr, len)?;
63-
this.write_scalar(Scalar::from_target_usize(len, this), dest)?;
64-
}
6550

6651
// File related shims
6752
// For those, we both intercept `func` and `call@FBSD_1.0` symbols cases
@@ -90,7 +75,22 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
9075
this.write_scalar(result, dest)?;
9176
}
9277

93-
// errno
78+
// Miscellaneous
79+
"getrandom" => {
80+
let [ptr, len, flags] =
81+
this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
82+
let ptr = this.read_pointer(ptr)?;
83+
let len = this.read_target_usize(len)?;
84+
let _flags = this.read_scalar(flags)?.to_i32()?;
85+
// flags on freebsd does not really matter
86+
// in practice, GRND_RANDOM does not particularly draw from /dev/random
87+
// since it is the same as to /dev/urandom.
88+
// GRND_INSECURE is only an alias of GRND_NONBLOCK, which
89+
// does not affect the RNG.
90+
// https://man.freebsd.org/cgi/man.cgi?query=getrandom&sektion=2&n=1
91+
this.gen_random(ptr, len)?;
92+
this.write_scalar(Scalar::from_target_usize(len, this), dest)?;
93+
}
9494
"__error" => {
9595
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
9696
let errno_place = this.last_error_place()?;

0 commit comments

Comments
 (0)