From 13d59eca9a77e8cedaeac552b360c95f53dccf6d Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 13 Nov 2024 08:06:53 +0300 Subject: use `--exact` on `--skip` to avoid unintended substring matches Without the `--exact` flag, using `--skip tests/rustdoc` can unintentionally skip other tests that match as substrings such as `rustdoc-gui`, `rustdoc-js`, etc. For debugging, run: `./x.py --stage 2 test rustdoc-ui --skip tests/rustdoc` and `./x.py --stage 2 test rustdoc-ui --skip tests/rustdoc -- --exact` Signed-off-by: onur-ozkan --- src/ci/github-actions/jobs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 340dfd67b7d..82ba3f587e2 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -48,7 +48,7 @@ runners: envs: env-x86_64-apple-tests: &env-x86_64-apple-tests - SCRIPT: ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc + SCRIPT: ./x.py --stage 2 test --skip tests/ui --skip tests/rustdoc -- --exact RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc RUSTC_RETRY_LINKER_ON_SEGFAULT: 1 MACOSX_DEPLOYMENT_TARGET: 10.12 -- cgit 1.4.1-3-g733a5 From 1824c7fa32bab5bdff0c2e768cca6af26477dcb3 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 13 Nov 2024 16:48:36 +0300 Subject: don't pass every test arg to cg_clif Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/test.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 2c36d8bab82..1e4a4c904d3 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -3405,7 +3405,6 @@ impl Step for CodegenCranelift { // FIXME remove once vendoring is handled .arg("--skip-test") .arg("testsuite.extended_sysroot"); - cargo.args(builder.config.test_args()); cargo.into_cmd().run(builder); } -- cgit 1.4.1-3-g733a5 From e8796c452dcb682c485c1d0e2bfe6298623f7f51 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:00:09 +0100 Subject: CI: split x86_64-msvc-ext job --- src/ci/github-actions/jobs.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 9a51a3f4268..69d2c1ae871 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -384,13 +384,12 @@ auto: SCRIPT: make ci-msvc <<: *job-windows-8c - - image: x86_64-msvc-ext + # x86_64-msvc-ext is split into multiple jobs to run tests in parallel. + - image: x86_64-msvc-ext1 env: - SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo && src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows - HOST_TARGET: x86_64-pc-windows-msvc - RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld --save-toolstates=/tmp/toolstate/toolstates.json - DEPLOY_TOOLSTATES_JSON: toolstates-windows.json - <<: *job-windows-8c + SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld + <<: *job-windows # Temporary builder to workaround CI issues # See @@ -406,6 +405,15 @@ auto: RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld <<: *job-windows + # Run `checktools.sh` and upload the toolstate file. + - image: x86_64-msvc-ext3 + env: + SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows + HOST_TARGET: x86_64-pc-windows-msvc + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld --save-toolstates=/tmp/toolstate/toolstates.json + DEPLOY_TOOLSTATES_JSON: toolstates-windows.json + <<: *job-windows + # 32/64-bit MinGW builds. # # We are using MinGW with POSIX threads since LLVM requires -- cgit 1.4.1-3-g733a5 From 16a78526cedfdb9af5d6befce3c77436aabc9a2f Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 25 Nov 2024 11:26:47 +0000 Subject: generate-copyright: Ensure output has UNIX line-endings for consistency. --- src/tools/generate-copyright/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/tools/generate-copyright/src/main.rs b/src/tools/generate-copyright/src/main.rs index f9d96b59462..f83d16d0cab 100644 --- a/src/tools/generate-copyright/src/main.rs +++ b/src/tools/generate-copyright/src/main.rs @@ -57,6 +57,10 @@ fn main() -> Result<(), Error> { dependencies: collected_cargo_metadata, }; let output = template.render()?; + // Git stores text files with \n, but this file may contain \r\n in files + // copied from dependencies. Normalise them before we write them out, for + // consistency. + let output = output.replace("\r\n", "\n"); std::fs::write(&dest_file, output)?; // Output libstd subset file @@ -65,6 +69,10 @@ fn main() -> Result<(), Error> { dependencies: library_collected_cargo_metadata, }; let output = template.render()?; + // Git stores text files with \n, but this file may contain \r\n in files + // copied from dependencies. Normalise them before we write them out, for + // consistency. + let output = output.replace("\r\n", "\n"); std::fs::write(&libstd_dest_file, output)?; Ok(()) -- cgit 1.4.1-3-g733a5 From 03cdaeed972c730912713ed3151f353367a87561 Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 25 Nov 2024 14:14:57 +0000 Subject: collect-license-metadata: move JSON to root, and add a 'check' mode --- REUSE.toml | 1 + license-metadata.json | 269 ++++++++++++++++++++++++ src/bootstrap/src/core/build_steps/run.rs | 3 +- src/bootstrap/src/core/build_steps/test.rs | 32 +++ src/bootstrap/src/core/builder/mod.rs | 1 + src/tools/collect-license-metadata/src/main.rs | 39 +++- src/tools/collect-license-metadata/src/reuse.rs | 4 +- 7 files changed, 335 insertions(+), 14 deletions(-) create mode 100644 license-metadata.json (limited to 'src') diff --git a/REUSE.toml b/REUSE.toml index 3a11c37854e..6b16d97ed80 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -28,6 +28,7 @@ path = [ "COPYRIGHT", "INSTALL.md", "LICENSE-APACHE", + "license-metadata.json", "LICENSE-MIT", "README.md", "RELEASES.md", diff --git a/license-metadata.json b/license-metadata.json new file mode 100644 index 00000000000..09cc3693565 --- /dev/null +++ b/license-metadata.json @@ -0,0 +1,269 @@ +{ + "files": { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "children": [ + { + "directories": [], + "files": [ + "analyzer-decls.h", + "malloc-macro.h" + ], + "license": { + "copyright": [ + "2000-2024 Free Software Foundation, Inc" + ], + "spdx": "GPL-2.0-only" + }, + "type": "group" + } + ], + "license": { + "copyright": [ + "2007-2011 Atheros Communications Inc", + "2011-2012,2017 Qualcomm Atheros, Inc", + "2016-2017 Erik Stromdahl " + ], + "spdx": "ISC" + }, + "name": "c-c++-common/analyzer", + "type": "directory" + } + ], + "license": { + "copyright": [ + "2000-2024 Free Software Foundation, Inc" + ], + "spdx": "GPL-2.0-only" + }, + "name": "gcc/testsuite", + "type": "directory" + }, + { + "license": { + "copyright": [ + "2000-2024 Free Software Foundation, Inc" + ], + "spdx": "GCC-exception-3.1" + }, + "name": "libstdc++-v3/config/os/aix/os_defines.h", + "type": "file" + } + ], + "license": { + "copyright": [ + "1997-2024 Free Software Foundation, Inc" + ], + "spdx": "GPL-3.0-or-later" + }, + "name": "src/gcc", + "type": "directory" + }, + { + "children": [ + { + "license": { + "copyright": [ + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": "noscript.css", + "type": "file" + }, + { + "license": { + "copyright": [ + "Nicolas Gallagher and Jonathan Neal" + ], + "spdx": "MIT" + }, + "name": "normalize.css", + "type": "file" + } + ], + "license": { + "copyright": [ + "2016 Ike Ku, Jessica Stokes and Leon Guan", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": "src/librustdoc/html/static/css", + "type": "directory" + }, + { + "children": [ + { + "license": { + "copyright": [ + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": "README.txt", + "type": "file" + }, + { + "directories": [], + "files": [ + "FiraSans-LICENSE.txt", + "FiraSans-Medium.woff2", + "FiraSans-Regular.woff2" + ], + "license": { + "copyright": [ + "2014, Mozilla Foundation", + "2014, Telefonica S.A" + ], + "spdx": "OFL-1.1" + }, + "type": "group" + }, + { + "directories": [], + "files": [ + "NanumBarunGothic-LICENSE.txt", + "NanumBarunGothic.ttf.woff2" + ], + "license": { + "copyright": [ + "2010 NAVER Corporation" + ], + "spdx": "OFL-1.1" + }, + "type": "group" + } + ], + "license": { + "copyright": [ + "2010, 2012, 2014-2023, Adobe Systems Incorporated" + ], + "spdx": "OFL-1.1" + }, + "name": "src/librustdoc/html/static/fonts", + "type": "directory" + }, + { + "license": { + "copyright": [ + "2003-2019 University of Illinois at Urbana-Champaign", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 WITH LLVM-exception AND (Apache-2.0 OR MIT)" + }, + "name": "compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp", + "type": "file" + }, + { + "children": [], + "license": { + "copyright": [ + "2014 Alex Crichton", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": "library/backtrace", + "type": "directory" + }, + { + "license": { + "copyright": [ + "1991-2024 Unicode, Inc" + ], + "spdx": "Unicode-3.0" + }, + "name": "library/core/src/unicode/unicode_data.rs", + "type": "file" + }, + { + "children": [], + "license": { + "copyright": [ + "2019 The Crossbeam Project Developers", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": "library/std/src/sync/mpmc", + "type": "directory" + }, + { + "license": { + "copyright": [ + "2016 The Fuchsia Authors", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "BSD-2-Clause AND (Apache-2.0 OR MIT)" + }, + "name": "library/std/src/sys/sync/mutex/fuchsia.rs", + "type": "file" + }, + { + "children": [], + "license": { + "copyright": [ + "Rust on Embedded Devices Working Group", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR CC-BY-SA-4.0 OR MIT" + }, + "name": "src/doc/embedded-book", + "type": "directory" + }, + { + "children": [], + "license": { + "copyright": [ + "2014 Jorge Aparicio", + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": "src/doc/rust-by-example", + "type": "directory" + }, + { + "license": { + "copyright": [ + "2014-2021 Knut Sveidqvist" + ], + "spdx": "MIT" + }, + "name": "src/doc/rustc-dev-guide/mermaid.min.js", + "type": "file" + }, + { + "children": [], + "license": { + "copyright": [ + "2003-2019 University of Illinois at Urbana-Champaign", + "2003-2019 by the contributors listed in CREDITS.TXT (https://github.com/rust-lang/llvm-project/blob/7738295178045041669876bf32b0543ec8319a5c/llvm/CREDITS.TXT)", + "2010 Apple Inc" + ], + "spdx": "Apache-2.0 WITH LLVM-exception AND NCSA" + }, + "name": "src/llvm-project", + "type": "directory" + } + ], + "license": { + "copyright": [ + "The Rust Project Developers (see https://thanks.rust-lang.org)" + ], + "spdx": "Apache-2.0 OR MIT" + }, + "name": ".", + "type": "directory" + } + ], + "type": "root" + } +} \ No newline at end of file diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs index 1a0a90564e6..4052de9a240 100644 --- a/src/bootstrap/src/core/build_steps/run.rs +++ b/src/bootstrap/src/core/build_steps/run.rs @@ -181,8 +181,7 @@ impl Step for CollectLicenseMetadata { panic!("REUSE is required to collect the license metadata"); }; - // Temporary location, it will be moved to src/etc once it's accurate. - let dest = builder.out.join("license-metadata.json"); + let dest = builder.src.join("license-metadata.json"); let mut cmd = builder.tool_cmd(Tool::CollectLicenseMetadata); cmd.env("REUSE_EXE", reuse); diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 1cabd1c39f1..58d55d65aea 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -3675,3 +3675,35 @@ impl Step for TestFloatParse { cargo_run.into_cmd().run(builder); } } + +#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] +pub struct CollectLicenseMetadata; + +impl Step for CollectLicenseMetadata { + type Output = PathBuf; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/collect-license-metadata") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(CollectLicenseMetadata); + } + + fn run(self, builder: &Builder<'_>) -> Self::Output { + let Some(reuse) = &builder.config.reuse else { + panic!("REUSE is required to collect the license metadata"); + }; + + let dest = builder.src.join("license-metadata.json"); + + let mut cmd = builder.tool_cmd(Tool::CollectLicenseMetadata); + cmd.env("REUSE_EXE", reuse); + cmd.env("DEST", &dest); + cmd.env("ONLY_CHECK", "1"); + cmd.run(builder); + + dest + } +} diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index d59e0fa7288..e6902bb8cee 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -915,6 +915,7 @@ impl<'a> Builder<'a> { test::HtmlCheck, test::RustInstaller, test::TestFloatParse, + test::CollectLicenseMetadata, // Run bootstrap close to the end as it's unlikely to fail test::Bootstrap, // Run run-make last, since these won't pass without make on Windows diff --git a/src/tools/collect-license-metadata/src/main.rs b/src/tools/collect-license-metadata/src/main.rs index dce36bb17b6..08a30d0b899 100644 --- a/src/tools/collect-license-metadata/src/main.rs +++ b/src/tools/collect-license-metadata/src/main.rs @@ -4,7 +4,7 @@ mod reuse; use std::path::PathBuf; -use anyhow::Error; +use anyhow::{Context, Error}; use crate::licenses::LicensesInterner; @@ -12,10 +12,12 @@ use crate::licenses::LicensesInterner; /// /// You should probably let `bootstrap` execute this program instead of running it directly. /// -/// Run `x.py run collect-license-metadata` +/// * Run `x.py run collect-license-metadata` to re-regenerate the file. +/// * Run `x.py test collect-license-metadata` to check if the file you have is correct. fn main() -> Result<(), Error> { let reuse_exe: PathBuf = std::env::var_os("REUSE_EXE").expect("Missing REUSE_EXE").into(); let dest: PathBuf = std::env::var_os("DEST").expect("Missing DEST").into(); + let only_check = std::env::var_os("ONLY_CHECK").is_some(); let mut interner = LicensesInterner::new(); let paths = crate::reuse::collect(&reuse_exe, &mut interner)?; @@ -23,15 +25,32 @@ fn main() -> Result<(), Error> { let mut tree = crate::path_tree::build(paths); tree.simplify(); - if let Some(parent) = dest.parent() { - std::fs::create_dir_all(parent)?; + let output = serde_json::json!({ + "files": crate::path_tree::expand_interned_licenses(tree, &interner) + }); + + if only_check { + println!("loading existing license information"); + let existing = std::fs::read_to_string(&dest).with_context(|| { + format!("Failed to read existing license JSON at {}", dest.display()) + })?; + let existing_json: serde_json::Value = + serde_json::from_str(&existing).with_context(|| { + format!("Failed to read existing license JSON at {}", dest.display()) + })?; + if existing_json != output { + eprintln!("The existing {} file is out of date.", dest.display()); + eprintln!("Run ./x run collect-license-metadata to update it."); + anyhow::bail!("The existing {} file doesn't match what REUSE reports.", dest.display()); + } + println!("license information matches"); + } else { + if let Some(parent) = dest.parent() { + std::fs::create_dir_all(parent)?; + } + std::fs::write(&dest, &serde_json::to_vec_pretty(&output)?)?; + println!("license information written to {}", dest.display()); } - std::fs::write( - &dest, - &serde_json::to_vec_pretty(&serde_json::json!({ - "files": crate::path_tree::expand_interned_licenses(tree, &interner), - }))?, - )?; Ok(()) } diff --git a/src/tools/collect-license-metadata/src/reuse.rs b/src/tools/collect-license-metadata/src/reuse.rs index e5ee8f0da5e..dbe46781b7c 100644 --- a/src/tools/collect-license-metadata/src/reuse.rs +++ b/src/tools/collect-license-metadata/src/reuse.rs @@ -10,10 +10,10 @@ pub(crate) fn collect( reuse_exe: &Path, interner: &mut LicensesInterner, ) -> Result, Error> { - eprintln!("gathering license information from REUSE"); + println!("gathering license information from REUSE (this might take a minute...)"); let start = Instant::now(); let raw = &obtain_spdx_document(reuse_exe)?; - eprintln!("finished gathering the license information from REUSE in {:.2?}", start.elapsed()); + println!("finished gathering the license information from REUSE in {:.2?}", start.elapsed()); let document = spdx_rs::parsers::spdx_from_tag_value(&raw)?; -- cgit 1.4.1-3-g733a5 From 587369b95e2e5d99b5d808180b90542a6b38096a Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 25 Nov 2024 14:15:08 +0000 Subject: Run the license-metadata check in CI. This will tell you if license-metadata.json is out of date. --- src/ci/docker/host-x86_64/mingw-check/Dockerfile | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/ci/docker/host-x86_64/mingw-check/Dockerfile b/src/ci/docker/host-x86_64/mingw-check/Dockerfile index f0afb570cc4..d408cd518a0 100644 --- a/src/ci/docker/host-x86_64/mingw-check/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check/Dockerfile @@ -63,6 +63,7 @@ ENV SCRIPT \ /scripts/validate-toolstate.sh && \ /scripts/validate-error-codes.sh && \ reuse --include-submodules lint && \ + python3 ../x.py test collect-license-metadata && \ # Runs checks to ensure that there are no issues in our JS code. es-check es2019 ../src/librustdoc/html/static/js/*.js && \ eslint -c ../src/librustdoc/html/static/.eslintrc.js ../src/librustdoc/html/static/js/*.js && \ -- cgit 1.4.1-3-g733a5 From db71194416700d2c1365ae1ee7f882aa3a055a67 Mon Sep 17 00:00:00 2001 From: Jonathan Pallant Date: Mon, 25 Nov 2024 14:18:08 +0000 Subject: generate-copyright: Use license-metadata.json from git. --- src/bootstrap/src/core/build_steps/run.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/bootstrap/src/core/build_steps/run.rs b/src/bootstrap/src/core/build_steps/run.rs index 4052de9a240..c76504761be 100644 --- a/src/bootstrap/src/core/build_steps/run.rs +++ b/src/bootstrap/src/core/build_steps/run.rs @@ -208,8 +208,7 @@ impl Step for GenerateCopyright { } fn run(self, builder: &Builder<'_>) -> Self::Output { - let license_metadata = builder.ensure(CollectLicenseMetadata); - + let license_metadata = builder.src.join("license-metadata.json"); let dest = builder.out.join("COPYRIGHT.html"); let dest_libstd = builder.out.join("COPYRIGHT-library.html"); -- cgit 1.4.1-3-g733a5 From 77fccf59e3838473e234bdb970e7100ba5c361f8 Mon Sep 17 00:00:00 2001 From: joboet Date: Mon, 25 Nov 2024 16:27:17 +0100 Subject: miri: implement `TlsFree` If the variable does not need a destructor, `std` uses racy initialization for creating TLS keys on Windows. With just the right timing, this can lead to `TlsFree` being called. Unfortunately, with #132654 this is hit quite often, so miri should definitely support `TlsFree` ([documentation](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-tlsfree)). I'm filing this here instead of in the miri repo so that #132654 isn't blocked for so long. --- src/tools/miri/src/shims/windows/foreign_items.rs | 8 ++++++++ src/tools/miri/tests/pass/tls/windows-tls.rs | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/tools/miri/tests/pass/tls/windows-tls.rs (limited to 'src') diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index c145cf3ceb8..a1fad6f9af4 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -382,6 +382,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Return success (`1`). this.write_int(1, dest)?; } + "TlsFree" => { + let [key] = this.check_shim(abi, ExternAbi::System { unwind: false }, link_name, args)?; + let key = u128::from(this.read_scalar(key)?.to_u32()?); + this.machine.tls.delete_tls_key(key)?; + + // Return success (`1`). + this.write_int(1, dest)?; + } // Access to command-line arguments "GetCommandLineW" => { diff --git a/src/tools/miri/tests/pass/tls/windows-tls.rs b/src/tools/miri/tests/pass/tls/windows-tls.rs new file mode 100644 index 00000000000..58131be1903 --- /dev/null +++ b/src/tools/miri/tests/pass/tls/windows-tls.rs @@ -0,0 +1,18 @@ +//@only-target: windows # this directly tests windows-only functions + +use std::ffi::c_void; +use std::ptr; + +extern "system" { + fn TlsAlloc() -> u32; + fn TlsSetValue(key: u32, val: *mut c_void) -> bool; + fn TlsGetValue(key: u32) -> *mut c_void; + fn TlsFree(key: u32) -> bool; +} + +fn main() { + let key = unsafe { TlsAlloc() }; + assert!(unsafe { TlsSetValue(key, ptr::without_provenance_mut(1)) }); + assert_eq!(unsafe { TlsGetValue(key).addr() }, 1); + assert!(unsafe { TlsFree(key) }); +} -- cgit 1.4.1-3-g733a5 From 8d404a4af51c171e464848ae71a4365ffe6bd2c4 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 13 Nov 2024 23:12:29 +0300 Subject: don't pass every test arg to test-float-parse Signed-off-by: onur-ozkan --- src/bootstrap/src/core/build_steps/test.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 1e4a4c904d3..bdf110a2566 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -3599,12 +3599,8 @@ impl Step for TestFloatParse { &[], ); - cargo_run.arg("--"); - if builder.config.args().is_empty() { - // By default, exclude tests that take longer than ~1m. - cargo_run.arg("--skip-huge"); - } else { - cargo_run.args(builder.config.args()); + if !matches!(env::var("FLOAT_PARSE_TESTS_NO_SKIP_HUGE").as_deref(), Ok("1") | Ok("true")) { + cargo_run.args(["--", "--skip-huge"]); } cargo_run.into_cmd().run(builder); -- cgit 1.4.1-3-g733a5