diff options
author | bors <bors@rust-lang.org> | 2019-08-15 04:56:09 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2019-08-15 04:56:09 +0000 |
commit | 37f8f8dc233a79ea9cc89b102aa30ff6e402fe94 (patch) | |
tree | 13f0a54d82b76a19fc57e58939e6e23b647da98f | |
parent | d7907c00e1a5061b4701e3d4aefca0ce4a181974 (diff) | |
parent | f0816947c9e7b975285b178b417b2601744af270 (diff) | |
download | rust-libc-37f8f8dc233a79ea9cc89b102aa30ff6e402fe94.tar.gz |
Auto merge of #1467 - gnzlbg:fix_freebsd, r=gnzlbg0.2.62
Fix FreeBSD
#1440 broke FreeBSD by changing `libc` FreeBSD targets to require a `cfg(freebsdXX)` to be defined, but not updating `build.rs` to define `freebsd11` when `LIBC_CI` is not available. Since `LIBC_CI` is always defined on CI, this issue went undetected.
This PR fixes that issue in the `build.rs` and introduces a build task that tests FreeBSD without `LIBC_CI` on FreeBSD11, although I'm not sure this would have caught the issue in #1466 .
Closes #1466 .
-rw-r--r-- | .cirrus.yml | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | build.rs | 21 | ||||
-rw-r--r-- | ci/azure.yml | 10 | ||||
-rw-r--r-- | ci/dox.sh | 3 | ||||
-rwxr-xr-x | ci/run-docker.sh | 1 | ||||
-rwxr-xr-x | ci/run.sh | 2 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/mod.rs | 4 |
8 files changed, 26 insertions, 19 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 178f5b2469..e3f777b529 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -10,6 +10,7 @@ task: - rustup default stable test_script: - . $HOME/.cargo/env + - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd - sh ci/run.sh x86_64-unknown-freebsd task: @@ -24,4 +25,5 @@ task: - rustup default nightly test_script: - . $HOME/.cargo/env + - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd - sh ci/run.sh x86_64-unknown-freebsd diff --git a/Cargo.toml b/Cargo.toml index c6e1b98c21..a39ab2945c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.61" +version = "0.2.62" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -7,6 +7,8 @@ fn main() { rustc_minor_version().expect("Failed to get rustc version"); let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok(); + #[allow(unused)] + let libc_ci = env::var("LIBC_CI").is_ok(); if env::var("CARGO_FEATURE_USE_STD").is_ok() { println!( @@ -15,16 +17,15 @@ fn main() { ); } - if env::var("LIBC_CI").is_ok() { - if let Some(11) = which_freebsd() { - println!("cargo:rustc-cfg=freebsd11"); - } - if let Some(12) = which_freebsd() { - println!("cargo:rustc-cfg=freebsd12"); - } - if let Some(13) = which_freebsd() { - println!("cargo:rustc-cfg=freebsd13"); - } + // The ABI of libc is backward compatible with FreeBSD 11. + // + // On CI, we detect the actual FreeBSD version and match its ABI exactly, + // running tests to ensure that the ABI is correct. + match which_freebsd() { + Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"), + Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"), + Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"), + Some(_) | None => println!("cargo:rustc-cfg=freebsd11"), } // Rust >= 1.15 supports private module use: diff --git a/ci/azure.yml b/ci/azure.yml index 04d12dae8f..4526361aef 100644 --- a/ci/azure.yml +++ b/ci/azure.yml @@ -15,7 +15,7 @@ jobs: vmImage: ubuntu-16.04 steps: - template: azure-install-rust.yml - - bash: sh ./ci/run-docker.sh $TARGET + - bash: LIBC_CI=1 sh ./ci/run-docker.sh $TARGET displayName: Execute run-docker.sh strategy: matrix: @@ -30,7 +30,7 @@ jobs: vmImage: ubuntu-16.04 steps: - template: azure-install-rust.yml - - bash: sh ./ci/run-docker.sh $TARGET + - bash: LIBC_CI=1 sh ./ci/run-docker.sh $TARGET displayName: Execute run-docker.sh strategy: matrix: @@ -88,7 +88,7 @@ jobs: vmImage: macos-10.14 steps: - template: azure-install-rust.yml - - bash: sh ./ci/run.sh $TARGET + - bash: LIBC_CI=1 sh ./ci/run.sh $TARGET displayName: Execute run.sh strategy: matrix: @@ -100,7 +100,7 @@ jobs: vmImage: macos-10.13 steps: - template: azure-install-rust.yml - - bash: sh ./ci/run.sh $TARGET + - bash: LIBC_CI=1 sh ./ci/run.sh $TARGET displayName: Execute run.sh strategy: matrix: @@ -112,7 +112,7 @@ jobs: vmImage: vs2017-win2016 steps: - template: azure-install-rust.yml - - bash: sh ./ci/run.sh $TARGET + - bash: LIBC_CI=1 sh ./ci/run.sh $TARGET displayName: Execute run.sh strategy: matrix: @@ -47,6 +47,9 @@ while read -r target; do rustup target add "${target}" || true + # Enable extra configuration flags: + export RUSTDOCFLAGS="--cfg freebsd11" + # If cargo doc fails, then try xargo: if ! cargo doc --target "${target}" \ --no-default-features --features extra_traits ; then diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 5fd0061446..3c0736a265 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -23,6 +23,7 @@ run() { docker run \ --rm \ --user "$(id -u)":"$(id -g)" \ + --env LIBC_CI \ --env CARGO_HOME=/cargo \ --env CARGO_TARGET_DIR=/checkout/target \ --volume "$(dirname "$(dirname "$(command -v cargo)")")":/cargo \ @@ -87,8 +87,6 @@ if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then opt="--release" fi -export LIBC_CI=1 - cargo test -vv $opt --no-default-features --manifest-path libc-test/Cargo.toml \ --target "${TARGET}" diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index c178b91b94..fea680d2af 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1334,9 +1334,11 @@ cfg_if! { } else if #[cfg(freebsd13)] { mod freebsd12; pub use self::freebsd12::*; - } else { + } else if #[cfg(freebsd11)] { mod freebsd11; pub use self::freebsd11::*; + } else { + // Unknown freebsd version } } |