respect CARGO_EXTRA_FLAGS in more places
This commit is contained in:
parent
95fe7ab2a8
commit
269cbc20ac
@ -52,7 +52,7 @@ function run_tests {
|
|||||||
|
|
||||||
# Also run some many-seeds tests. 64 seeds means this takes around a minute per test.
|
# Also run some many-seeds tests. 64 seeds means this takes around a minute per test.
|
||||||
for FILE in tests/many-seeds/*.rs; do
|
for FILE in tests/many-seeds/*.rs; do
|
||||||
MIRI_SEEDS=64 CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS -q" ./miri many-seeds ./miri run "$FILE"
|
MIRI_SEEDS=64 ./miri many-seeds ./miri run "$FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check that the benchmarks build and run, but without actually benchmarking.
|
# Check that the benchmarks build and run, but without actually benchmarking.
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
set -e
|
set -e
|
||||||
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through
|
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through
|
||||||
# rustup (that sets it's own environmental variables), which is undesirable.
|
# rustup (that sets it's own environmental variables), which is undesirable.
|
||||||
cargo build -q --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
|
cargo build $CARGO_EXTRA_FLAGS -q --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
|
||||||
"$(dirname "$0")"/miri-script/target/debug/miri-script "$@"
|
"$(dirname "$0")"/miri-script/target/debug/miri-script "$@"
|
||||||
|
@ -319,6 +319,8 @@ impl Command {
|
|||||||
let Some((program_name, args)) = hyperfine.split_first() else {
|
let Some((program_name, args)) = hyperfine.split_first() else {
|
||||||
bail!("expected HYPERFINE environment variable to be non-empty");
|
bail!("expected HYPERFINE environment variable to be non-empty");
|
||||||
};
|
};
|
||||||
|
// Extra flags to pass to cargo.
|
||||||
|
let cargo_extra_flags = std::env::var("CARGO_EXTRA_FLAGS").unwrap_or_default();
|
||||||
// Make sure we have an up-to-date Miri installed and selected the right toolchain.
|
// Make sure we have an up-to-date Miri installed and selected the right toolchain.
|
||||||
Self::install(vec![])?;
|
Self::install(vec![])?;
|
||||||
|
|
||||||
@ -341,7 +343,7 @@ impl Command {
|
|||||||
// That seems to make Windows CI happy.
|
// That seems to make Windows CI happy.
|
||||||
cmd!(
|
cmd!(
|
||||||
sh,
|
sh,
|
||||||
"{program_name} {args...} 'cargo miri run --manifest-path \"'{current_bench}'\"'"
|
"{program_name} {args...} 'cargo miri run '{cargo_extra_flags}' --manifest-path \"'{current_bench}'\"'"
|
||||||
)
|
)
|
||||||
.run()?;
|
.run()?;
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,14 @@ CGREEN = '\33[32m'
|
|||||||
CBOLD = '\33[1m'
|
CBOLD = '\33[1m'
|
||||||
CEND = '\33[0m'
|
CEND = '\33[0m'
|
||||||
|
|
||||||
|
CARGO_EXTRA_FLAGS = os.environ.get("CARGO_EXTRA_FLAGS", "").split()
|
||||||
|
|
||||||
def fail(msg):
|
def fail(msg):
|
||||||
print("\nTEST FAIL: {}".format(msg))
|
print("\nTEST FAIL: {}".format(msg))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def cargo_miri(cmd, quiet = True):
|
def cargo_miri(cmd, quiet = True):
|
||||||
args = ["cargo", "miri", cmd]
|
args = ["cargo", "miri", cmd] + CARGO_EXTRA_FLAGS
|
||||||
if quiet:
|
if quiet:
|
||||||
args += ["-q"]
|
args += ["-q"]
|
||||||
if 'MIRI_TEST_TARGET' in os.environ:
|
if 'MIRI_TEST_TARGET' in os.environ:
|
||||||
|
@ -16,6 +16,11 @@ fn get_host() -> String {
|
|||||||
.host
|
.host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn flagsplit(flags: &str) -> Vec<String> {
|
||||||
|
// This code is taken from `RUSTFLAGS` handling in cargo.
|
||||||
|
flags.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect()
|
||||||
|
}
|
||||||
|
|
||||||
// Build the shared object file for testing external C function calls.
|
// Build the shared object file for testing external C function calls.
|
||||||
fn build_so_for_c_ffi_tests() -> PathBuf {
|
fn build_so_for_c_ffi_tests() -> PathBuf {
|
||||||
let cc = option_env!("CC").unwrap_or("cc");
|
let cc = option_env!("CC").unwrap_or("cc");
|
||||||
@ -100,14 +105,16 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
|
|||||||
if with_dependencies && use_std {
|
if with_dependencies && use_std {
|
||||||
config.dependencies_crate_manifest_path =
|
config.dependencies_crate_manifest_path =
|
||||||
Some(Path::new("test_dependencies").join("Cargo.toml"));
|
Some(Path::new("test_dependencies").join("Cargo.toml"));
|
||||||
config.dependency_builder.args = vec![
|
let mut builder_args = vec!["run".into()];
|
||||||
"run".into(),
|
builder_args.extend(flagsplit(&env::var("CARGO_EXTRA_FLAGS").unwrap_or_default()));
|
||||||
|
builder_args.extend([
|
||||||
"--manifest-path".into(),
|
"--manifest-path".into(),
|
||||||
"cargo-miri/Cargo.toml".into(),
|
"cargo-miri/Cargo.toml".into(),
|
||||||
"--".into(),
|
"--".into(),
|
||||||
"miri".into(),
|
"miri".into(),
|
||||||
"run".into(), // There is no `cargo miri build` so we just use `cargo miri run`.
|
"run".into(), // There is no `cargo miri build` so we just use `cargo miri run`.
|
||||||
];
|
]);
|
||||||
|
config.dependency_builder.args = builder_args.into_iter().map(Into::into).collect();
|
||||||
}
|
}
|
||||||
config
|
config
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user