From e1d2c697cda6f1e6e1ceedd7e78fe63b8d340145 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 11 Jun 2024 15:56:28 +0200 Subject: [PATCH] Add `-Zbuild-std` test --- .github/workflows/rust.yml | 25 +++++++++++++++++++++++++ Cargo.toml | 4 ++++ tests/build_std.rs | 21 +++++++++++++++++++++ tests/build_std/test.rs | 0 4 files changed, 50 insertions(+) create mode 100644 tests/build_std.rs create mode 100644 tests/build_std/test.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 208f4bbe..7d9e93ba 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -60,3 +60,28 @@ jobs: run: cargo test --verbose - name: Test no-rustc mode run: cargo check --no-default-features + + build-std: + strategy: + matrix: + include: + - os: ubuntu-latest + host_target: x86_64-unknown-linux-gnu + - os: macos-latest + host_target: x86_64-apple-darwin + - os: windows-latest + host_target: i686-pc-windows-msvc + runs-on: ${{ matrix.os }} + # Run tests under a directory with a space in it to double check the windows path heuristic + defaults: + run: + working-directory: "dir with spaces/build std" + steps: + - uses: actions/checkout@v4 + with: + path: "dir with spaces/build std" + - uses: dtolnay/rust-toolchain@nightly + with: + components: rust-src + - name: Run build-std test + run: cargo test --verbose --test build_std diff --git a/Cargo.toml b/Cargo.toml index 45a133d8..75980a40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,10 @@ features = ["capture-spantrace"] name = "integration" harness = false +[[test]] +name = "build_std" +test = false + [features] default = ["rustc"] rustc = [] diff --git a/tests/build_std.rs b/tests/build_std.rs new file mode 100644 index 00000000..2109b1e7 --- /dev/null +++ b/tests/build_std.rs @@ -0,0 +1,21 @@ +use ui_test::dependencies::DependencyBuilder; +use ui_test::spanned::Spanned; +use ui_test::Config; + +#[test] +fn test() { + let mut config = Config::rustc("tests/build_std"); + let revisioned = config.comment_defaults.base(); + + revisioned.exit_status = Spanned::dummy(0).into(); + revisioned.require_annotations = Spanned::dummy(false).into(); + revisioned.set_custom( + "dependencies", + DependencyBuilder { + build_std: Some(String::new()), + ..DependencyBuilder::default() + }, + ); + + ui_test::run_tests(config).unwrap(); +} diff --git a/tests/build_std/test.rs b/tests/build_std/test.rs new file mode 100644 index 00000000..e69de29b