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

Multiple CI improvements #1497

Merged
merged 2 commits into from
Aug 22, 2021
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
109 changes: 51 additions & 58 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ cargo_cache:
# the system's binaries, so the environment shouldn't matter.
task:
name: FreeBSD amd64 & i686
env:
# Temporary workaround for https://github.com/rust-lang/rustup/issues/2774
RUSTUP_IO_THREADS: 1
freebsd_instance:
image: freebsd-11-4-release-amd64
setup_script:
Expand All @@ -31,24 +28,17 @@ task:
- name: OSX x86_64
env:
TARGET: x86_64-apple-darwin
- name: iOS aarch64
env:
TARGET: aarch64-apple-ios
DISABLE_TESTS: 1
- name: iOS x86_64
env:
TARGET: x86_64-apple-ios
DISABLE_TESTS: 1
osx_instance:
image: catalina-xcode
setup_script:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
- . $HOME/.cargo/env
- bash ci/install.sh
- cargo install cross
script:
- . $HOME/.cargo/env
- bash ci/script.sh
- cross build --target $TARGET
- cross test --target $TARGET
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Use cross for QEMU-based testing
Expand Down Expand Up @@ -100,10 +90,11 @@ task:
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
- . $HOME/.cargo/env
- bash ci/install.sh
- cargo install cross
script:
- . $HOME/.cargo/env || true
- bash ci/script.sh
- cross build --target $TARGET
- cross test --target $TARGET
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Tasks for Linux amd64 builds
Expand All @@ -128,14 +119,18 @@ task:
- rustup target add --toolchain $TOOLCHAIN $TARGET
script:
- cargo +$TOOLCHAIN build --target $TARGET --all-targets
- cargo +$TOOLCHAIN build --target $TARGET --all-targets --release
- cargo +$TOOLCHAIN test --target $TARGET
- cargo +$TOOLCHAIN test --target $TARGET --release
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Tasks for cross-compiling, but no testing
task:
container:
image: rust:1.46
env:
TOOLCHAIN: 1.46.0
matrix:
# Cross claims to support Android, but when it tries to run Nix's tests it
# reports undefined symbol references.
- name: Android aarch64
env:
TARGET: aarch64-linux-android
Expand All @@ -154,9 +149,40 @@ task:
- name: Linux arm-musleabi
env:
TARGET: arm-unknown-linux-musleabi
- name: Fuchsia x86_64
env:
TARGET: x86_64-fuchsia
- name: Illumos
env:
TARGET: x86_64-unknown-illumos
# illumos toolchain isn't available via rustup until 1.50
TOOLCHAIN: 1.50.0
container:
image: rust:1.50
# Cross claims to support running tests on iOS, but it actually doesn't.
# https://github.com/rust-embedded/cross/issues/535
- name: iOS aarch64
env:
TARGET: aarch64-apple-ios
# Rustup only supports cross-building from arbitrary hosts for iOS at
# 1.49.0 and above. Below that it's possible to cross-build from an OSX
# host, but OSX VMs
# are more expensive than Linux VMs.
TOOLCHAIN: 1.49.0
- name: iOS x86_64
env:
TARGET: x86_64-apple-ios
TOOLCHAIN: 1.49.0
# Cross testing on powerpc fails with "undefined reference to renameat2".
# Perhaps cross is using too-old a version?
- name: Linux powerpc
env:
TARGET: powerpc-unknown-linux-gnu
# Cross claims to support Linux powerpc64, but it really doesn't.
# https://github.com/rust-embedded/cross/issues/441
- name: Linux powerpc64
env:
TARGET: powerpc64-unknown-linux-gnu
- name: Linux s390x
env:
TARGET: s390x-unknown-linux-gnu
Expand All @@ -166,57 +192,24 @@ task:
- name: NetBSD x86_64
env:
TARGET: x86_64-unknown-netbsd
- name: Fuchsia x86_64
- name: Redox x86_64
env:
TARGET: x86_64-fuchsia
container:
image: rust:1.46
setup_script:
- rustup target add $TARGET
script:
- cargo +$TOOLCHAIN check --target $TARGET
- cargo +$TOOLCHAIN check --target $TARGET --release
- cargo +$TOOLCHAIN check --all-targets --target $TARGET
before_cache_script: rm -rf $CARGO_HOME/registry/index

# illumos toolchain isn't available via rustup until 1.50
task:
name: illumos
env:
TARGET: x86_64-unknown-illumos
container:
image: rust:1.50
TARGET: x86_64-unknown-redox
# Redox requires a nightly compiler.
# If stuff breaks, change nightly to the date in the toolchain_*
# directory at https://static.redox-os.org
TOOLCHAIN: nightly-2020-08-04
setup_script:
- rustup target add $TARGET
script:
- cargo +$TOOLCHAIN check --target $TARGET
- cargo +$TOOLCHAIN check --target $TARGET --release
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Redoxer is too unreliable, so we'll do a cross-build only
# See also:
# https://github.com/nix-rust/nix/issues/1258
# https://github.com/rust-embedded/cross/issues/427
task:
name: Redox x86_64
env:
TARGET: x86_64-unknown-redox
# Redox requires a nightly compiler.
# If stuff breaks, change nightly to the date in the toolchain_*
# directory at https://static.redox-os.org
TOOLCHAIN: nightly-2020-08-04
container:
image: rustlang/rust:nightly
setup_script:
- rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET
script:
- cargo +$TOOLCHAIN check --target $TARGET
- cargo +$TOOLCHAIN check --target $TARGET --release
- cargo +$TOOLCHAIN check --all-targets --target $TARGET
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Test that we can build with the lowest version of all dependencies.
# "cargo test" doesn't work because some of our dev-dependencies, like
# rand, can't build with thier own minimal dependencies.
# rand, can't build with their own minimal dependencies.
task:
name: Minver
container:
Expand Down
1 change: 1 addition & 0 deletions bors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ status = [
"Linux i686",
"Linux mipsel",
"Linux powerpc",
"Linux powerpc64",
"Linux powerpc64le",
"Linux s390x",
"Linux x32",
Expand Down
49 changes: 0 additions & 49 deletions ci/install.sh

This file was deleted.

31 changes: 0 additions & 31 deletions ci/script.sh

This file was deleted.

2 changes: 0 additions & 2 deletions test/test_fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ use std::io::prelude::*;
#[cfg(not(target_os = "redox"))]
use std::os::unix::fs;

use crate::*;

#[test]
#[cfg(not(target_os = "redox"))]
fn test_openat() {
Expand Down
71 changes: 39 additions & 32 deletions test/test_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::path::Path;

#[cfg(not(any(target_os = "netbsd", target_os = "redox")))]
use libc::{S_IFMT, S_IFLNK};
#[cfg(not(target_os = "redox"))]
use libc::mode_t;

#[cfg(not(target_os = "redox"))]
Expand Down Expand Up @@ -312,39 +311,47 @@ fn test_mkdirat_fail() {
target_os = "ios",
target_os = "macos",
target_os = "redox")))]
fn test_mknod_family() {
fn test_mknod() {
use stat::{lstat, mknod, SFlag};

let file_name = "test_file";
let tempdir = tempfile::tempdir().unwrap();
let target = tempdir.path().join(file_name);
mknod(&target, SFlag::S_IFREG, Mode::S_IRWXU, 0).unwrap();
let mode = lstat(&target).unwrap().st_mode as mode_t;
assert!(mode & libc::S_IFREG == libc::S_IFREG);
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
}

#[test]
#[cfg(not(any(target_os = "freebsd",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox")))]
fn test_mknodat() {
use fcntl::{AtFlags, OFlag};
use nix::dir::Dir;
use stat::{fstatat, lstat, mknod, mknodat, SFlag};
use stat::{fstatat, mknodat, SFlag};

let file_name = "test_file";
{
let tempdir = tempfile::tempdir().unwrap();
let target = tempdir.path().join(file_name);
mknod(&target, SFlag::S_IFREG, Mode::S_IRWXU, 0).unwrap();
let mode = lstat(&target).unwrap().st_mode as mode_t;
assert!(mode & libc::S_IFREG == libc::S_IFREG);
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
}
{
let tempdir = tempfile::tempdir().unwrap();
let target_dir = Dir::open(tempdir.path(), OFlag::O_DIRECTORY, Mode::S_IRWXU).unwrap();
mknodat(
target_dir.as_raw_fd(),
file_name,
SFlag::S_IFREG,
Mode::S_IRWXU,
0,
)
.unwrap();
let mode = fstatat(
target_dir.as_raw_fd(),
file_name,
AtFlags::AT_SYMLINK_NOFOLLOW,
)
.unwrap()
.st_mode as mode_t;
assert!(mode & libc::S_IFREG == libc::S_IFREG);
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
}
let tempdir = tempfile::tempdir().unwrap();
let target_dir = Dir::open(tempdir.path(), OFlag::O_DIRECTORY, Mode::S_IRWXU).unwrap();
mknodat(
target_dir.as_raw_fd(),
file_name,
SFlag::S_IFREG,
Mode::S_IRWXU,
0,
)
.unwrap();
let mode = fstatat(
target_dir.as_raw_fd(),
file_name,
AtFlags::AT_SYMLINK_NOFOLLOW,
)
.unwrap()
.st_mode as mode_t;
assert!(mode & libc::S_IFREG == libc::S_IFREG);
assert!(mode & libc::S_IRWXU == libc::S_IRWXU);
}
6 changes: 4 additions & 2 deletions test/test_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
target_os = "emscripten",
))]
use nix::time::clock_getcpuclockid;
use nix::time::{clock_getres, clock_gettime, ClockId};
use nix::time::{clock_gettime, ClockId};

#[cfg(not(target_os = "redox"))]
#[test]
pub fn test_clock_getres() {
assert!(clock_getres(ClockId::CLOCK_REALTIME).is_ok());
assert!(nix::time::clock_getres(ClockId::CLOCK_REALTIME).is_ok());
}

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

#[cfg(not(target_os = "redox"))]
#[test]
pub fn test_clock_id_res() {
assert!(ClockId::CLOCK_REALTIME.res().is_ok());
Expand Down
1 change: 1 addition & 0 deletions test/test_unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ fn test_access_file_exists() {
assert!(access(&path, AccessFlags::R_OK | AccessFlags::W_OK).is_ok());
}

#[cfg(not(target_os = "redox"))]
#[test]
fn test_user_into_passwd() {
// get the UID of the "nobody" user
Expand Down