1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 13:37:48 +00:00

Merge pull request #3271 from tertsdiepraam/unittests-in-ci

Fix unittests not running in CI
This commit is contained in:
Sylvestre Ledru 2022-03-19 20:53:20 +01:00 committed by GitHub
commit e6d55b2c5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View file

@ -638,7 +638,7 @@ jobs:
# target-specific options # target-specific options
# * CARGO_FEATURES_OPTION # * CARGO_FEATURES_OPTION
CARGO_FEATURES_OPTION='' ; CARGO_FEATURES_OPTION='' ;
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ; fi
outputs CARGO_FEATURES_OPTION outputs CARGO_FEATURES_OPTION
# * CARGO_USE_CROSS (truthy) # * CARGO_USE_CROSS (truthy)
CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac; CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac;
@ -705,7 +705,7 @@ jobs:
## Dependent VARs setup ## Dependent VARs setup
outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# * determine sub-crate utility list # * determine sub-crate utility list
UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" UTILITY_LIST="$(./util/show-utils.sh ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }})"
echo UTILITY_LIST=${UTILITY_LIST} echo UTILITY_LIST=${UTILITY_LIST}
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS outputs CARGO_UTILITY_LIST_OPTIONS
@ -988,7 +988,7 @@ jobs:
## Dependent VARs setup ## Dependent VARs setup
outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; } outputs() { step_id="dep_vars"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo ::set-output name=${var}::${!var}; done; }
# * determine sub-crate utility list # * determine sub-crate utility list
UTILITY_LIST="$(./util/show-utils.sh ${CARGO_FEATURES_OPTION})" UTILITY_LIST="$(./util/show-utils.sh ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }})"
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo "-puu_${u}"; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS outputs CARGO_UTILITY_LIST_OPTIONS
- name: Test uucore - name: Test uucore

View file

@ -303,10 +303,10 @@ fn test_status_level_noxfer() {
fn test_multiple_flags_options() { fn test_multiple_flags_options() {
let args = vec![ let args = vec![
String::from("dd"), String::from("dd"),
String::from("--iflag=fullblock,directory"), String::from("--iflag=fullblock,count_bytes"),
String::from("--iflag=skip_bytes"), String::from("--iflag=skip_bytes"),
String::from("--oflag=direct"), String::from("--oflag=append"),
String::from("--oflag=dsync"), String::from("--oflag=seek_bytes"),
String::from("--conv=ascii,ucase"), String::from("--conv=ascii,ucase"),
String::from("--conv=unblock"), String::from("--conv=unblock"),
]; ];
@ -315,13 +315,13 @@ fn test_multiple_flags_options() {
// iflag // iflag
let iflags = parse_flag_list::<Flag>(options::IFLAG, &matches).unwrap(); let iflags = parse_flag_list::<Flag>(options::IFLAG, &matches).unwrap();
assert_eq!( assert_eq!(
vec![Flag::FullBlock, Flag::Directory, Flag::SkipBytes], vec![Flag::FullBlock, Flag::CountBytes, Flag::SkipBytes],
iflags iflags
); );
// oflag // oflag
let oflags = parse_flag_list::<Flag>(options::OFLAG, &matches).unwrap(); let oflags = parse_flag_list::<Flag>(options::OFLAG, &matches).unwrap();
assert_eq!(vec![Flag::Direct, Flag::Dsync], oflags); assert_eq!(vec![Flag::Append, Flag::SeekBytes], oflags);
// conv // conv
let conv = parse_flag_list::<ConvFlag>(options::CONV, &matches).unwrap(); let conv = parse_flag_list::<ConvFlag>(options::CONV, &matches).unwrap();
@ -685,7 +685,7 @@ mod test_64bit_arch {
#[test] #[test]
#[should_panic] #[should_panic]
fn test_overflow_panic() { fn test_overflow_panic() {
let bs_str = format!("{}KiB", usize::MAX); let bs_str = format!("{}KiB", u64::MAX);
parse_bytes_with_opt_multiplier(&bs_str).unwrap(); parse_bytes_with_opt_multiplier(&bs_str).unwrap();
} }

View file

@ -274,7 +274,7 @@ mod tests {
use crate::digest::DigestWriter; use crate::digest::DigestWriter;
// Writing "\r" in one call to `write()`, and then "\n" in another. // Writing "\r" in one call to `write()`, and then "\n" in another.
let mut digest = Box::new(md5::Context::new()) as Box<dyn Digest>; let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
let mut writer_crlf = DigestWriter::new(&mut digest, false); let mut writer_crlf = DigestWriter::new(&mut digest, false);
writer_crlf.write_all(&[b'\r']).unwrap(); writer_crlf.write_all(&[b'\r']).unwrap();
writer_crlf.write_all(&[b'\n']).unwrap(); writer_crlf.write_all(&[b'\n']).unwrap();
@ -282,7 +282,7 @@ mod tests {
let result_crlf = digest.result_str(); let result_crlf = digest.result_str();
// We expect "\r\n" to be replaced with "\n" in text mode on Windows. // We expect "\r\n" to be replaced with "\n" in text mode on Windows.
let mut digest = Box::new(md5::Context::new()) as Box<dyn Digest>; let mut digest = Box::new(md5::Md5::new()) as Box<dyn Digest>;
let mut writer_lf = DigestWriter::new(&mut digest, false); let mut writer_lf = DigestWriter::new(&mut digest, false);
writer_lf.write_all(&[b'\n']).unwrap(); writer_lf.write_all(&[b'\n']).unwrap();
writer_lf.finalize(); writer_lf.finalize();