Skip to content
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

ci: fix CI by correcting wrong cfg value & removing cache with sudo #2394

Merged
merged 7 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested by new checks added in Rust 1.80:

error: unexpected `cfg` condition name: `linux_android`
    --> src/sys/socket/addr.rs:2403:15
     |
2403 |         #[cfg(linux_android)]
     |               ^^^^^^^^^^^^^
     |
     = help: consider using a Cargo feature instead or adding `println!("cargo::rustc-check-cfg=cfg(linux_android)");` to the top of the `build.rs`
     = note: see <https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#rustc-check-cfg> for more information about checking conditional configuration

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",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this PR, this test module was enabled for target fushsia(note it is a typo), it does not exist, and since module mqueue does not exist on Fuchsia, simply remove this line

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",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target does not exist, so remove it

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