Skip to content

Commit 047d662

Browse files
authored
ci: fix CI by correcting wrong cfg value & removing cache with sudo (#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
1 parent 590ab4d commit 047d662

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
TARGET: '${{ env.TARGET }}'
4242

4343
- name: before_cache_script
44-
run: rm -rf $CARGO_HOME/registry/index
44+
run: sudo rm -rf $CARGO_HOME/registry/index
4545

4646
macos-aarch64:
4747
runs-on: macos-14
@@ -68,7 +68,7 @@ jobs:
6868
TARGET: "${{ env.TARGET }}"
6969

7070
- name: before_cache_script
71-
run: rm -rf $CARGO_HOME/registry/index
71+
run: sudo rm -rf $CARGO_HOME/registry/index
7272

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

164164
- name: before_cache_script
165-
run: rm -rf $CARGO_HOME/registry/index
165+
run: sudo rm -rf $CARGO_HOME/registry/index;
166166

167167
rust_stable:
168168
runs-on: ubuntu-20.04
@@ -188,7 +188,7 @@ jobs:
188188
TARGET: '${{ env.TARGET }}'
189189

190190
- name: before_cache_script
191-
run: rm -rf $CARGO_HOME/registry/index
191+
run: sudo rm -rf $CARGO_HOME/registry/index
192192

193193

194194

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,15 @@ fn main() {
2626
netbsdlike: { any(netbsd, openbsd) },
2727
solarish: { any(illumos, solaris) },
2828
}
29+
30+
// Below are Nix's custom cfg values that we need to let the compiler know
31+
println!("cargo:rustc-check-cfg=cfg(apple_targets)");
32+
println!("cargo:rustc-check-cfg=cfg(bsd)");
33+
println!("cargo:rustc-check-cfg=cfg(bsd_without_apple)");
34+
println!("cargo:rustc-check-cfg=cfg(linux_android)");
35+
println!("cargo:rustc-check-cfg=cfg(freebsdlike)");
36+
println!("cargo:rustc-check-cfg=cfg(netbsdlike)");
37+
println!("cargo:rustc-check-cfg=cfg(solarish)");
38+
println!("cargo:rustc-check-cfg=cfg(fbsd14)");
39+
println!("cargo:rustc-check-cfg=cfg(qemu)");
2940
}

src/sys/signal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ impl SigSet {
597597
target_os = "haiku",
598598
target_os = "hurd",
599599
target_os = "aix",
600-
target_os = "fushsia"
600+
target_os = "fuchsia"
601601
))]
602602
#[doc(alias("sigsuspend"))]
603603
pub fn suspend(&self) -> Result<()> {

test/common/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ cfg_if! {
3737
#[macro_export]
3838
macro_rules! require_mount {
3939
($name:expr) => {
40-
use ::sysctl::{CtlValue, Sysctl};
4140
use nix::unistd::Uid;
41+
use sysctl::{CtlValue, Sysctl};
4242

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

7070
let ctl = ::sysctl::Ctl::new("security.jail.jailed").unwrap();
7171
if let CtlValue::Int(1) = ctl.value().unwrap() {

test/sys/test_signal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ fn test_sigwait() {
350350
target_os = "haiku",
351351
target_os = "hurd",
352352
target_os = "aix",
353-
target_os = "fushsia"
353+
target_os = "fuchsia"
354354
))]
355355
#[test]
356356
fn test_sigsuspend() {

test/test.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ mod test_errno;
1313
mod test_fcntl;
1414
#[cfg(linux_android)]
1515
mod test_kmod;
16-
#[cfg(any(
17-
freebsdlike,
18-
target_os = "fushsia",
19-
target_os = "linux",
20-
target_os = "netbsd"
21-
))]
16+
#[cfg(any(freebsdlike, target_os = "linux", target_os = "netbsd"))]
2217
mod test_mq;
2318
#[cfg(not(target_os = "redox"))]
2419
mod test_net;

test/test_fcntl.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use nix::fcntl::{openat2, OpenHow, ResolveFlag};
1313
target_env = "gnu",
1414
any(
1515
target_arch = "x86_64",
16-
target_arch = "x32",
1716
target_arch = "powerpc",
1817
target_arch = "s390x"
1918
)
@@ -146,7 +145,6 @@ fn test_renameat() {
146145
target_env = "gnu",
147146
any(
148147
target_arch = "x86_64",
149-
target_arch = "x32",
150148
target_arch = "powerpc",
151149
target_arch = "s390x"
152150
)
@@ -190,7 +188,6 @@ fn test_renameat2_behaves_like_renameat_with_no_flags() {
190188
target_env = "gnu",
191189
any(
192190
target_arch = "x86_64",
193-
target_arch = "x32",
194191
target_arch = "powerpc",
195192
target_arch = "s390x"
196193
)
@@ -238,7 +235,6 @@ fn test_renameat2_exchange() {
238235
target_env = "gnu",
239236
any(
240237
target_arch = "x86_64",
241-
target_arch = "x32",
242238
target_arch = "powerpc",
243239
target_arch = "s390x"
244240
)

0 commit comments

Comments
 (0)