1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #2625 from miDeb/nightly-for-cov

CICD: use nightly rust for code coverage
This commit is contained in:
Sylvestre Ledru 2021-08-31 15:45:49 +02:00 committed by GitHub
commit 2bd556e252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 29 deletions

View file

@ -14,7 +14,6 @@ env:
PROJECT_DESC: "Core universal (cross-platform) utilities" PROJECT_DESC: "Core universal (cross-platform) utilities"
PROJECT_AUTH: "uutils" PROJECT_AUTH: "uutils"
RUST_MIN_SRV: "1.47.0" ## MSRV v1.47.0 RUST_MIN_SRV: "1.47.0" ## MSRV v1.47.0
RUST_COV_SRV: "2021-05-06" ## (~v1.52.0) supported rust version for code coverage; (date required/used by 'coverage') ## !maint: refactor when code coverage support is included in the stable channel
on: [push, pull_request] on: [push, pull_request]
@ -606,7 +605,7 @@ jobs:
## VARs setup ## VARs setup
outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } outputs() { step_id="vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# toolchain # toolchain
TOOLCHAIN="nightly-${{ env.RUST_COV_SRV }}" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support TOOLCHAIN="nightly" ## default to "nightly" toolchain (required for certain required unstable compiler flags) ## !maint: refactor when stable channel has needed support
# * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files # * specify gnu-type TOOLCHAIN for windows; `grcov` requires gnu-style code coverage data files
case ${{ matrix.job.os }} in windows-*) TOOLCHAIN="$TOOLCHAIN-x86_64-pc-windows-gnu" ;; esac; case ${{ matrix.job.os }} in windows-*) TOOLCHAIN="$TOOLCHAIN-x86_64-pc-windows-gnu" ;; esac;
# * use requested TOOLCHAIN if specified # * use requested TOOLCHAIN if specified

View file

@ -368,7 +368,7 @@ impl UIoError {
pub fn new<S: Into<String>>(kind: std::io::ErrorKind, context: S) -> Box<dyn UError> { pub fn new<S: Into<String>>(kind: std::io::ErrorKind, context: S) -> Box<dyn UError> {
Box::new(Self { Box::new(Self {
context: context.into(), context: context.into(),
inner: std::io::Error::new(kind, ""), inner: kind.into(),
}) })
} }
} }
@ -380,32 +380,36 @@ impl Error for UIoError {}
impl Display for UIoError { impl Display for UIoError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
use std::io::ErrorKind::*; use std::io::ErrorKind::*;
write!(
f, let message;
"{}: {}", let message = match self.inner.kind() {
self.context, NotFound => "No such file or directory",
match self.inner.kind() { PermissionDenied => "Permission denied",
NotFound => "No such file or directory", ConnectionRefused => "Connection refused",
PermissionDenied => "Permission denied", ConnectionReset => "Connection reset",
ConnectionRefused => "Connection refused", ConnectionAborted => "Connection aborted",
ConnectionReset => "Connection reset", NotConnected => "Not connected",
ConnectionAborted => "Connection aborted", AddrInUse => "Address in use",
NotConnected => "Not connected", AddrNotAvailable => "Address not available",
AddrInUse => "Address in use", BrokenPipe => "Broken pipe",
AddrNotAvailable => "Address not available", AlreadyExists => "Already exists",
BrokenPipe => "Broken pipe", WouldBlock => "Would block",
AlreadyExists => "Already exists", InvalidInput => "Invalid input",
WouldBlock => "Would block", InvalidData => "Invalid data",
InvalidInput => "Invalid input", TimedOut => "Timed out",
InvalidData => "Invalid data", WriteZero => "Write zero",
TimedOut => "Timed out", Interrupted => "Interrupted",
WriteZero => "Write zero", Other => "Other",
Interrupted => "Interrupted", UnexpectedEof => "Unexpected end of file",
Other => "Other", _ => {
UnexpectedEof => "Unexpected end of file", // TODO: using `strip_errno()` causes the error message
_ => panic!("Unexpected io error: {}", self.inner), // to not be capitalized. When the new error variants (https://github.com/rust-lang/rust/issues/86442)
}, // are stabilized, we should add them to the match statement.
) message = strip_errno(&self.inner);
&message
}
};
write!(f, "{}: {}", self.context, message,)
} }
} }