Skip to content

Commit

Permalink
ci: fix CI by correcting wrong cfg value & removing cache with sudo (#…
Browse files Browse the repository at this point in the history
…2394)

* refactor: correct wrong cfg value && remove ones that do not exist

* debug ci

* debug ci

* debug ci

* debug ci

* test: disable test_mq module for Fuchsia

* style: fmt
  • Loading branch information
SteveLauC authored May 5, 2024
1 parent 590ab4d commit 047d662
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
TARGET: '${{ env.TARGET }}'

- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
run: sudo rm -rf $CARGO_HOME/registry/index

macos-aarch64:
runs-on: macos-14
Expand All @@ -68,7 +68,7 @@ jobs:
TARGET: "${{ env.TARGET }}"

- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
run: sudo rm -rf $CARGO_HOME/registry/index

# Use cross for QEMU-based testing
# cross needs to execute Docker, GitHub Action already has it installed
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
TARGET: '${{ matrix.TARGET }}'

- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
run: sudo rm -rf $CARGO_HOME/registry/index;

rust_stable:
runs-on: ubuntu-20.04
Expand All @@ -188,7 +188,7 @@ jobs:
TARGET: '${{ env.TARGET }}'

- name: before_cache_script
run: rm -rf $CARGO_HOME/registry/index
run: sudo rm -rf $CARGO_HOME/registry/index



Expand Down
11 changes: 11 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,15 @@ fn main() {
netbsdlike: { any(netbsd, openbsd) },
solarish: { any(illumos, solaris) },
}

// Below are Nix's custom cfg values that we need to let the compiler know
println!("cargo:rustc-check-cfg=cfg(apple_targets)");
println!("cargo:rustc-check-cfg=cfg(bsd)");
println!("cargo:rustc-check-cfg=cfg(bsd_without_apple)");
println!("cargo:rustc-check-cfg=cfg(linux_android)");
println!("cargo:rustc-check-cfg=cfg(freebsdlike)");
println!("cargo:rustc-check-cfg=cfg(netbsdlike)");
println!("cargo:rustc-check-cfg=cfg(solarish)");
println!("cargo:rustc-check-cfg=cfg(fbsd14)");
println!("cargo:rustc-check-cfg=cfg(qemu)");
}
2 changes: 1 addition & 1 deletion src/sys/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ impl SigSet {
target_os = "haiku",
target_os = "hurd",
target_os = "aix",
target_os = "fushsia"
target_os = "fuchsia"
))]
#[doc(alias("sigsuspend"))]
pub fn suspend(&self) -> Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions test/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ cfg_if! {
#[macro_export]
macro_rules! require_mount {
($name:expr) => {
use ::sysctl::{CtlValue, Sysctl};
use nix::unistd::Uid;
use sysctl::{CtlValue, Sysctl};

let ctl = ::sysctl::Ctl::new("vfs.usermount").unwrap();
if !Uid::current().is_root() && CtlValue::Int(0) == ctl.value().unwrap()
Expand All @@ -65,7 +65,7 @@ macro_rules! skip_if_cirrus {
#[macro_export]
macro_rules! skip_if_jailed {
($name:expr) => {
use ::sysctl::{CtlValue, Sysctl};
use sysctl::{CtlValue, Sysctl};

let ctl = ::sysctl::Ctl::new("security.jail.jailed").unwrap();
if let CtlValue::Int(1) = ctl.value().unwrap() {
Expand Down
2 changes: 1 addition & 1 deletion test/sys/test_signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ fn test_sigwait() {
target_os = "haiku",
target_os = "hurd",
target_os = "aix",
target_os = "fushsia"
target_os = "fuchsia"
))]
#[test]
fn test_sigsuspend() {
Expand Down
7 changes: 1 addition & 6 deletions test/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ mod test_errno;
mod test_fcntl;
#[cfg(linux_android)]
mod test_kmod;
#[cfg(any(
freebsdlike,
target_os = "fushsia",
target_os = "linux",
target_os = "netbsd"
))]
#[cfg(any(freebsdlike, target_os = "linux", target_os = "netbsd"))]
mod test_mq;
#[cfg(not(target_os = "redox"))]
mod test_net;
Expand Down
4 changes: 0 additions & 4 deletions test/test_fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use nix::fcntl::{openat2, OpenHow, ResolveFlag};
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x32",
target_arch = "powerpc",
target_arch = "s390x"
)
Expand Down Expand Up @@ -146,7 +145,6 @@ fn test_renameat() {
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x32",
target_arch = "powerpc",
target_arch = "s390x"
)
Expand Down Expand Up @@ -190,7 +188,6 @@ fn test_renameat2_behaves_like_renameat_with_no_flags() {
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x32",
target_arch = "powerpc",
target_arch = "s390x"
)
Expand Down Expand Up @@ -238,7 +235,6 @@ fn test_renameat2_exchange() {
target_env = "gnu",
any(
target_arch = "x86_64",
target_arch = "x32",
target_arch = "powerpc",
target_arch = "s390x"
)
Expand Down

0 comments on commit 047d662

Please sign in to comment.