Skip to content

Commit

Permalink
Apply small fixes to sync main and libc-0.2 build and test
Browse files Browse the repository at this point in the history
Just check out a few hunks of these files from `main` now that we aren't
limited by the old MSRV.
  • Loading branch information
tgross35 committed Nov 17, 2024
1 parent b194077 commit 4040e61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 26 deletions.
30 changes: 8 additions & 22 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn rustc_version_cmd(is_clippy_driver: bool) -> Output {

cmd.arg("--version");

let output = cmd.output().ok().expect("Failed to get rustc version");
let output = cmd.output().expect("Failed to get rustc version");

if !output.status.success() {
panic!(
Expand Down Expand Up @@ -193,20 +193,14 @@ fn rustc_minor_nightly() -> (u32, bool) {
}

fn which_freebsd() -> Option<i32> {
let output = std::process::Command::new("freebsd-version").output().ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
let output = std::process::Command::new("freebsd-version")
.output()
.ok()?;
if !output.status.success() {
return None;
}

let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let stdout = stdout.unwrap();
let stdout = String::from_utf8(output.stdout).ok()?;

match &stdout {
s if s.starts_with("10") => Some(10),
Expand All @@ -223,24 +217,16 @@ fn emcc_version_code() -> Option<u64> {
let output = std::process::Command::new("emcc")
.arg("-dumpversion")
.output()
.ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
.ok()?;
if !output.status.success() {
return None;
}

let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let version = stdout.unwrap();
let version = String::from_utf8(output.stdout).ok()?;

// Some Emscripten versions come with `-git` attached, so split the
// version string also on the `-` char.
let mut pieces = version.trim().split(|c| c == '.' || c == '-');
let mut pieces = version.trim().split(['.', '-']);

let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
Expand Down
3 changes: 2 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,7 @@ fn test_android(target: &str) {

// These are tested in the `linux_elf.rs` file.
"Elf64_Phdr" | "Elf32_Phdr" => true,

// These are intended to be opaque
"posix_spawn_file_actions_t" => true,
"posix_spawnattr_t" => true,
Expand Down Expand Up @@ -2463,7 +2464,7 @@ fn test_freebsd(target: &str) {
true
}

// Added in in FreeBSD 13.0 (r367776 and r367287)
// Added in FreeBSD 13.0 (r367776 and r367287)
"SCM_CREDS2" | "LOCAL_CREDS_PERSISTENT" if Some(13) > freebsd_ver => true,

// Added in FreeBSD 14
Expand Down
3 changes: 0 additions & 3 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@



ABS_CNT
ABS_MAX
ADDR_COMPAT_LAYOUT
Expand Down

0 comments on commit 4040e61

Please sign in to comment.