Skip to content

Commit dab7332

Browse files
authored
Merge pull request #1497 from asomers/cirrus2
Multiple CI improvements
2 parents 28f547f + d20fe20 commit dab7332

File tree

8 files changed

+96
-174
lines changed

8 files changed

+96
-174
lines changed

.cirrus.yml

Lines changed: 51 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ cargo_cache:
88
# the system's binaries, so the environment shouldn't matter.
99
task:
1010
name: FreeBSD amd64 & i686
11-
env:
12-
# Temporary workaround for https://github.com/rust-lang/rustup/issues/2774
13-
RUSTUP_IO_THREADS: 1
1411
freebsd_instance:
1512
image: freebsd-11-4-release-amd64
1613
setup_script:
@@ -31,24 +28,17 @@ task:
3128
- name: OSX x86_64
3229
env:
3330
TARGET: x86_64-apple-darwin
34-
- name: iOS aarch64
35-
env:
36-
TARGET: aarch64-apple-ios
37-
DISABLE_TESTS: 1
38-
- name: iOS x86_64
39-
env:
40-
TARGET: x86_64-apple-ios
41-
DISABLE_TESTS: 1
4231
osx_instance:
4332
image: catalina-xcode
4433
setup_script:
4534
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
4635
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
4736
- . $HOME/.cargo/env
48-
- bash ci/install.sh
37+
- cargo install cross
4938
script:
5039
- . $HOME/.cargo/env
51-
- bash ci/script.sh
40+
- cross build --target $TARGET
41+
- cross test --target $TARGET
5242
before_cache_script: rm -rf $CARGO_HOME/registry/index
5343

5444
# Use cross for QEMU-based testing
@@ -100,10 +90,11 @@ task:
10090
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
10191
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
10292
- . $HOME/.cargo/env
103-
- bash ci/install.sh
93+
- cargo install cross
10494
script:
10595
- . $HOME/.cargo/env || true
106-
- bash ci/script.sh
96+
- cross build --target $TARGET
97+
- cross test --target $TARGET
10798
before_cache_script: rm -rf $CARGO_HOME/registry/index
10899

109100
# Tasks for Linux amd64 builds
@@ -128,14 +119,18 @@ task:
128119
- rustup target add --toolchain $TOOLCHAIN $TARGET
129120
script:
130121
- cargo +$TOOLCHAIN build --target $TARGET --all-targets
131-
- cargo +$TOOLCHAIN build --target $TARGET --all-targets --release
132122
- cargo +$TOOLCHAIN test --target $TARGET
133-
- cargo +$TOOLCHAIN test --target $TARGET --release
134123
before_cache_script: rm -rf $CARGO_HOME/registry/index
135124

136125
# Tasks for cross-compiling, but no testing
137126
task:
127+
container:
128+
image: rust:1.46
129+
env:
130+
TOOLCHAIN: 1.46.0
138131
matrix:
132+
# Cross claims to support Android, but when it tries to run Nix's tests it
133+
# reports undefined symbol references.
139134
- name: Android aarch64
140135
env:
141136
TARGET: aarch64-linux-android
@@ -154,9 +149,40 @@ task:
154149
- name: Linux arm-musleabi
155150
env:
156151
TARGET: arm-unknown-linux-musleabi
152+
- name: Fuchsia x86_64
153+
env:
154+
TARGET: x86_64-fuchsia
155+
- name: Illumos
156+
env:
157+
TARGET: x86_64-unknown-illumos
158+
# illumos toolchain isn't available via rustup until 1.50
159+
TOOLCHAIN: 1.50.0
160+
container:
161+
image: rust:1.50
162+
# Cross claims to support running tests on iOS, but it actually doesn't.
163+
# https://github.com/rust-embedded/cross/issues/535
164+
- name: iOS aarch64
165+
env:
166+
TARGET: aarch64-apple-ios
167+
# Rustup only supports cross-building from arbitrary hosts for iOS at
168+
# 1.49.0 and above. Below that it's possible to cross-build from an OSX
169+
# host, but OSX VMs
170+
# are more expensive than Linux VMs.
171+
TOOLCHAIN: 1.49.0
172+
- name: iOS x86_64
173+
env:
174+
TARGET: x86_64-apple-ios
175+
TOOLCHAIN: 1.49.0
176+
# Cross testing on powerpc fails with "undefined reference to renameat2".
177+
# Perhaps cross is using too-old a version?
157178
- name: Linux powerpc
158179
env:
159180
TARGET: powerpc-unknown-linux-gnu
181+
# Cross claims to support Linux powerpc64, but it really doesn't.
182+
# https://github.com/rust-embedded/cross/issues/441
183+
- name: Linux powerpc64
184+
env:
185+
TARGET: powerpc64-unknown-linux-gnu
160186
- name: Linux s390x
161187
env:
162188
TARGET: s390x-unknown-linux-gnu
@@ -166,57 +192,24 @@ task:
166192
- name: NetBSD x86_64
167193
env:
168194
TARGET: x86_64-unknown-netbsd
169-
- name: Fuchsia x86_64
195+
- name: Redox x86_64
170196
env:
171-
TARGET: x86_64-fuchsia
172-
container:
173-
image: rust:1.46
174-
setup_script:
175-
- rustup target add $TARGET
176-
script:
177-
- cargo +$TOOLCHAIN check --target $TARGET
178-
- cargo +$TOOLCHAIN check --target $TARGET --release
179-
- cargo +$TOOLCHAIN check --all-targets --target $TARGET
180-
before_cache_script: rm -rf $CARGO_HOME/registry/index
181-
182-
# illumos toolchain isn't available via rustup until 1.50
183-
task:
184-
name: illumos
185-
env:
186-
TARGET: x86_64-unknown-illumos
187-
container:
188-
image: rust:1.50
197+
TARGET: x86_64-unknown-redox
198+
# Redox requires a nightly compiler.
199+
# If stuff breaks, change nightly to the date in the toolchain_*
200+
# directory at https://static.redox-os.org
201+
TOOLCHAIN: nightly-2020-08-04
189202
setup_script:
190203
- rustup target add $TARGET
191-
script:
192-
- cargo +$TOOLCHAIN check --target $TARGET
193-
- cargo +$TOOLCHAIN check --target $TARGET --release
194-
before_cache_script: rm -rf $CARGO_HOME/registry/index
195-
196-
# Redoxer is too unreliable, so we'll do a cross-build only
197-
# See also:
198-
# https://github.com/nix-rust/nix/issues/1258
199-
# https://github.com/rust-embedded/cross/issues/427
200-
task:
201-
name: Redox x86_64
202-
env:
203-
TARGET: x86_64-unknown-redox
204-
# Redox requires a nightly compiler.
205-
# If stuff breaks, change nightly to the date in the toolchain_*
206-
# directory at https://static.redox-os.org
207-
TOOLCHAIN: nightly-2020-08-04
208-
container:
209-
image: rustlang/rust:nightly
210-
setup_script:
211204
- rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET
212205
script:
213206
- cargo +$TOOLCHAIN check --target $TARGET
214-
- cargo +$TOOLCHAIN check --target $TARGET --release
207+
- cargo +$TOOLCHAIN check --all-targets --target $TARGET
215208
before_cache_script: rm -rf $CARGO_HOME/registry/index
216209

217210
# Test that we can build with the lowest version of all dependencies.
218211
# "cargo test" doesn't work because some of our dev-dependencies, like
219-
# rand, can't build with thier own minimal dependencies.
212+
# rand, can't build with their own minimal dependencies.
220213
task:
221214
name: Minver
222215
container:

bors.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ status = [
1717
"Linux i686",
1818
"Linux mipsel",
1919
"Linux powerpc",
20+
"Linux powerpc64",
2021
"Linux powerpc64le",
2122
"Linux s390x",
2223
"Linux x32",

ci/install.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

ci/script.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

test/test_fcntl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ use std::io::prelude::*;
2828
#[cfg(not(target_os = "redox"))]
2929
use std::os::unix::fs;
3030

31-
use crate::*;
32-
3331
#[test]
3432
#[cfg(not(target_os = "redox"))]
3533
fn test_openat() {

test/test_stat.rs

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use std::path::Path;
1111

1212
#[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
1313
use libc::{S_IFMT, S_IFLNK};
14-
#[cfg(not(target_os = "redox"))]
1514
use libc::mode_t;
1615

1716
#[cfg(not(target_os = "redox"))]
@@ -312,39 +311,47 @@ fn test_mkdirat_fail() {
312311
target_os = "ios",
313312
target_os = "macos",
314313
target_os = "redox")))]
315-
fn test_mknod_family() {
314+
fn test_mknod() {
315+
use stat::{lstat, mknod, SFlag};
316+
317+
let file_name = "test_file";
318+
let tempdir = tempfile::tempdir().unwrap();
319+
let target = tempdir.path().join(file_name);
320+
mknod(&target, SFlag::S_IFREG, Mode::S_IRWXU, 0).unwrap();
321+
let mode = lstat(&target).unwrap().st_mode as mode_t;
322+
assert!(mode & libc::S_IFREG == libc::S_IFREG);
323+
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
324+
}
325+
326+
#[test]
327+
#[cfg(not(any(target_os = "freebsd",
328+
target_os = "illumos",
329+
target_os = "ios",
330+
target_os = "macos",
331+
target_os = "redox")))]
332+
fn test_mknodat() {
316333
use fcntl::{AtFlags, OFlag};
317334
use nix::dir::Dir;
318-
use stat::{fstatat, lstat, mknod, mknodat, SFlag};
335+
use stat::{fstatat, mknodat, SFlag};
319336

320337
let file_name = "test_file";
321-
{
322-
let tempdir = tempfile::tempdir().unwrap();
323-
let target = tempdir.path().join(file_name);
324-
mknod(&target, SFlag::S_IFREG, Mode::S_IRWXU, 0).unwrap();
325-
let mode = lstat(&target).unwrap().st_mode as mode_t;
326-
assert!(mode & libc::S_IFREG == libc::S_IFREG);
327-
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
328-
}
329-
{
330-
let tempdir = tempfile::tempdir().unwrap();
331-
let target_dir = Dir::open(tempdir.path(), OFlag::O_DIRECTORY, Mode::S_IRWXU).unwrap();
332-
mknodat(
333-
target_dir.as_raw_fd(),
334-
file_name,
335-
SFlag::S_IFREG,
336-
Mode::S_IRWXU,
337-
0,
338-
)
339-
.unwrap();
340-
let mode = fstatat(
341-
target_dir.as_raw_fd(),
342-
file_name,
343-
AtFlags::AT_SYMLINK_NOFOLLOW,
344-
)
345-
.unwrap()
346-
.st_mode as mode_t;
347-
assert!(mode & libc::S_IFREG == libc::S_IFREG);
348-
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
349-
}
338+
let tempdir = tempfile::tempdir().unwrap();
339+
let target_dir = Dir::open(tempdir.path(), OFlag::O_DIRECTORY, Mode::S_IRWXU).unwrap();
340+
mknodat(
341+
target_dir.as_raw_fd(),
342+
file_name,
343+
SFlag::S_IFREG,
344+
Mode::S_IRWXU,
345+
0,
346+
)
347+
.unwrap();
348+
let mode = fstatat(
349+
target_dir.as_raw_fd(),
350+
file_name,
351+
AtFlags::AT_SYMLINK_NOFOLLOW,
352+
)
353+
.unwrap()
354+
.st_mode as mode_t;
355+
assert!(mode & libc::S_IFREG == libc::S_IFREG);
356+
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
350357
}

test/test_time.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
target_os = "emscripten",
77
))]
88
use nix::time::clock_getcpuclockid;
9-
use nix::time::{clock_getres, clock_gettime, ClockId};
9+
use nix::time::{clock_gettime, ClockId};
1010

11+
#[cfg(not(target_os = "redox"))]
1112
#[test]
1213
pub fn test_clock_getres() {
13-
assert!(clock_getres(ClockId::CLOCK_REALTIME).is_ok());
14+
assert!(nix::time::clock_getres(ClockId::CLOCK_REALTIME).is_ok());
1415
}
1516

1617
#[test]
@@ -31,6 +32,7 @@ pub fn test_clock_getcpuclockid() {
3132
assert!(clock_gettime(clock_id).is_ok());
3233
}
3334

35+
#[cfg(not(target_os = "redox"))]
3436
#[test]
3537
pub fn test_clock_id_res() {
3638
assert!(ClockId::CLOCK_REALTIME.res().is_ok());

test/test_unistd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ fn test_access_file_exists() {
10251025
assert!(access(&path, AccessFlags::R_OK | AccessFlags::W_OK).is_ok());
10261026
}
10271027

1028+
#[cfg(not(target_os = "redox"))]
10281029
#[test]
10291030
fn test_user_into_passwd() {
10301031
// get the UID of the "nobody" user

0 commit comments

Comments
 (0)