1
0
mirror of https://github.com/uutils/coreutils synced 2024-07-01 06:54:36 +00:00

Merge pull request #2581 from sylvestre/freebsd

Use github action for FreeBSD testing and remove cirrus CI
This commit is contained in:
Sylvestre Ledru 2021-08-24 14:47:34 +02:00 committed by GitHub
commit 68c9bfa658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 68 additions and 33 deletions

View File

@ -1,21 +0,0 @@
env:
# Temporary workaround for error `error: sysinfo not supported on
# this platform` seen on FreeBSD platforms, affecting Rustup
#
# References: https://github.com/rust-lang/rustup/issues/2774
RUSTUP_IO_THREADS: 1
task:
name: stable x86_64-unknown-freebsd-12
freebsd_instance:
image: freebsd-12-2-release-amd64
setup_script:
- pkg install -y curl gmake
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --profile=minimal
build_script:
- . $HOME/.cargo/env
- cargo build
test_script:
- . $HOME/.cargo/env
- cargo test -p uucore -p coreutils

View File

@ -521,6 +521,51 @@ jobs:
n_fails=$(echo "$output" | grep "^FAIL:\s" | wc --lines)
if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi
test_freebsd:
runs-on: macos-latest
name: Tests/FreeBSD test suite
env:
mem: 2048
steps:
- uses: actions/checkout@v2
- name: Prepare, build and test
id: test
uses: vmactions/freebsd-vm@v0.1.4
with:
usesh: true
prepare: pkg install -y curl gmake sudo
run: |
# Need to be run in the same block. Otherwise, we are back on the mac host.
set -e
pw adduser -n cuuser -d /root/ -g wheel -c "Coreutils user to build" -w random
chown -R cuuser:wheel /root/ /Users/runner/work/coreutils/
whoami
# Needs to be done in a sudo as we are changing users
sudo -i -u cuuser sh << EOF
whoami
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile=minimal
## Info
# environment
echo "## environment"
echo "CI='${CI}'"
# tooling info display
echo "## tooling"
. $HOME/.cargo/env
cargo -V
rustc -V
env
# where the files are resynced
cd /Users/runner/work/coreutils/coreutils/
cargo build
cargo test --features feat_os_unix -p uucore -p coreutils
# Clean to avoid to rsync back the files
cargo clean
EOF
coverage:
name: Code Coverage
runs-on: ${{ matrix.job.os }}

View File

@ -28,9 +28,6 @@ use std::fmt::Display;
#[cfg(unix)]
use std::mem;
#[cfg(target_os = "freebsd")]
use uucore::libc::{c_char, fsid_t, uid_t};
#[cfg(windows)]
use std::path::Path;

View File

@ -195,6 +195,8 @@ fn test_chown_failed_stdout() {
}
#[test]
// FixME: Fails on freebsd because of chown: invalid group: 'root:root'
#[cfg(not(target_os = "freebsd"))]
fn test_chown_owner_group() {
// test chown username:group file.txt
@ -242,8 +244,11 @@ fn test_chown_owner_group() {
}
#[test]
// TODO: on macos group name is not recognized correctly: "chown: invalid group: ':groupname'
#[cfg(any(windows, all(unix, not(target_os = "macos"))))]
// FixME: on macos & freebsd group name is not recognized correctly: "chown: invalid group: ':groupname'
#[cfg(any(
windows,
all(unix, not(any(target_os = "macos", target_os = "freebsd")))
))]
fn test_chown_only_group() {
// test chown :group file.txt
@ -408,6 +413,8 @@ fn test_chown_owner_group_id() {
}
#[test]
// FixME: Fails on freebsd because of chown: invalid group: '0:root'
#[cfg(not(target_os = "freebsd"))]
fn test_chown_owner_group_mix() {
// test chown 1111:group file.txt

View File

@ -10,8 +10,8 @@ fn test_hostname() {
assert!(ls_default_res.stdout().len() >= ls_domain_res.stdout().len());
}
// FixME: fails for "MacOS"
#[cfg(not(target_vendor = "apple"))]
// FixME: fails for "MacOS" and "freebsd" "failed to lookup address information: Name does not resolve"
#[cfg(not(any(target_os = "macos", target_os = "freebsd")))]
#[test]
fn test_hostname_ip() {
let result = new_ucmd!().arg("-i").succeeds();

View File

@ -563,7 +563,8 @@ fn strip_source_file() -> &'static str {
}
#[test]
#[cfg(not(windows))]
// FixME: Freebsd fails on 'No such file or directory'
#[cfg(not(any(windows, target_os = "freebsd")))]
fn test_install_and_strip() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
@ -586,7 +587,8 @@ fn test_install_and_strip() {
}
#[test]
#[cfg(not(windows))]
// FixME: Freebsd fails on 'No such file or directory'
#[cfg(not(any(windows, target_os = "freebsd")))]
fn test_install_and_strip_with_program() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;

View File

@ -102,7 +102,7 @@ fn test_invalid_option() {
new_ucmd!().arg("-w").arg("-q").arg("/").fails();
}
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
#[cfg(unix)]
const NORMAL_FORMAT_STR: &str =
"%a %A %b %B %d %D %f %F %g %G %h %i %m %n %o %s %u %U %x %X %y %Y %z %Z"; // avoid "%w %W" (birth/creation) due to `stat` limitations and linux kernel & rust version capability variations
#[cfg(any(target_os = "linux"))]

View File

@ -477,7 +477,9 @@ fn test_nonexistent_file_is_not_symlink() {
}
#[test]
#[cfg(not(windows))] // Windows has no concept of sticky bit
// FixME: freebsd fails with 'chmod: sticky_file: Inappropriate file type or format'
// Windows has no concept of sticky bit
#[cfg(not(any(windows, target_os = "freebsd")))]
fn test_file_is_sticky() {
let scenario = TestScenario::new(util_name!());
let mut ucmd = scenario.ucmd();

View File

@ -290,6 +290,8 @@ fn test_touch_set_both() {
}
#[test]
// FixME: Fails on freebsd because of a different nanos
#[cfg(not(target_os = "freebsd"))]
fn test_touch_no_dereference() {
let (at, mut ucmd) = at_and_ucmd!();
let file_a = "test_touch_no_dereference_a";

View File

@ -65,7 +65,8 @@ fn test_wrong_argument() {
}
#[test]
#[cfg(not(windows))]
// FixME: freebsd panic
#[cfg(not(any(windows, target_os = "freebsd")))]
fn test_stdout_fail() {
let mut child = new_ucmd!().run_no_wait();
drop(child.stdout.take());