-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up libc-test/build.rs for FreeBSD and enable testing FreeBSD12 on CI #1346
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
freebsd_instance: | ||
image: freebsd-11-1-release-amd64 | ||
|
||
task: | ||
# This name gets reported as a build status in GitHub | ||
name: stable x86_64-unknown-freebsd | ||
name: stable x86_64-unknown-freebsd-11 | ||
freebsd_instance: | ||
image: freebsd-11-2-release-amd64 | ||
setup_script: | ||
- pkg install -y curl | ||
- curl https://sh.rustup.rs -sSf --output rustup.sh | ||
- sh rustup.sh -y | ||
- . $HOME/.cargo/env | ||
- rustup default stable | ||
test_script: | ||
- . $HOME/.cargo/env | ||
- sh ci/run.sh x86_64-unknown-freebsd | ||
|
||
task: | ||
name: nightly x86_64-unknown-freebsd-12 | ||
freebsd_instance: | ||
image: freebsd-12-0-release-amd64 | ||
setup_script: | ||
- pkg install -y curl | ||
- curl https://sh.rustup.rs -sSf --output rustup.sh | ||
- sh rustup.sh --default-toolchain nightly -y | ||
- . $HOME/.cargo/env | ||
- rustup default nightly | ||
test_script: | ||
- . $HOME/.cargo/env | ||
- cd libc-test | ||
- cargo test | ||
- sh ci/run.sh x86_64-unknown-freebsd |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,12 @@ fn main() { | |
); | ||
} | ||
|
||
if std::env::var("LIBC_CI").is_ok() { | ||
if let Some(12) = which_freebsd() { | ||
println!("cargo:rustc-cfg=freebsd12"); | ||
} | ||
} | ||
|
||
// Rust >= 1.15 supports private module use: | ||
if rustc_minor_ver >= 15 || rustc_dep_of_std { | ||
println!("cargo:rustc-cfg=libc_priv_mod_use"); | ||
|
@@ -70,3 +76,26 @@ fn rustc_minor_version() -> Option<u32> { | |
|
||
otry!(pieces.next()).parse().ok() | ||
} | ||
|
||
fn which_freebsd() -> Option<i32> { | ||
let output = std::process::Command::new("freebsd-version").output().ok(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Easier to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, good point. Dragonfly's man page doesn't mention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, apple doesn't have We might want to revisit this issue when we start exploring how to expose this capability to users. |
||
if output.is_none() { | ||
return None; | ||
} | ||
let output = output.unwrap(); | ||
if !output.status.success() { | ||
return None; | ||
} | ||
|
||
let stdout = String::from_utf8(output.stdout).ok(); | ||
if stdout.is_none() { | ||
return None; | ||
} | ||
let stdout = stdout.unwrap(); | ||
|
||
match &stdout { | ||
s if s.starts_with("11") => Some(11), | ||
s if s.starts_with("12") => Some(12), | ||
_ => None, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This invocation will install both nightly and stable toolchains. It would be faster just to install nightly. I haven't tested it, but I think you could do it like this: