mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-14 02:57:57 +00:00
commit
6276f5f2f9
4 changed files with 38 additions and 43 deletions
|
@ -7,12 +7,6 @@ matrix:
|
||||||
- rust: stable
|
- rust: stable
|
||||||
os: osx
|
os: osx
|
||||||
env: FEATURES=''
|
env: FEATURES=''
|
||||||
- rust: 1.20.0
|
|
||||||
os: linux
|
|
||||||
env: FEATURES=''
|
|
||||||
- rust: 1.20.0
|
|
||||||
os: osx
|
|
||||||
env: FEATURES=''
|
|
||||||
- rust: beta
|
- rust: beta
|
||||||
os: linux
|
os: linux
|
||||||
env: FEATURES=''
|
env: FEATURES=''
|
||||||
|
|
|
@ -24,7 +24,8 @@ to compile anywhere, and this is as good a way as any to try and learn it.
|
||||||
Rust Version
|
Rust Version
|
||||||
------------
|
------------
|
||||||
|
|
||||||
uutils supports and is tested on version `1.20.0` and above (including beta and nightly builds) of `rustc`.
|
uutils follows Rust's release channels and is tested against stable, beta and nightly.
|
||||||
|
To check which one is the latest stable version of Rust visit [Rust's releases page](https://github.com/rust-lang/rust/releases).
|
||||||
|
|
||||||
On Windows, only the nightly version is tested currently.
|
On Windows, only the nightly version is tested currently.
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ fn run_single_test(test: &TestCase, at: AtPath, mut ucmd: UCommand) {
|
||||||
mkfile(&at.plus_as_string(TEST_FILE), test.before);
|
mkfile(&at.plus_as_string(TEST_FILE), test.before);
|
||||||
let perms = at.metadata(TEST_FILE).permissions().mode();
|
let perms = at.metadata(TEST_FILE).permissions().mode();
|
||||||
if perms != test.before {
|
if perms != test.before {
|
||||||
panic!(format!("{}: expected: {:o} got: {:o}", "setting permissions failed", test.after, perms));
|
panic!(format!("{}: expected: {:o} got: {:o}", "setting permissions on test files before actual test run failed", test.after, perms));
|
||||||
}
|
}
|
||||||
|
|
||||||
for arg in &test.args {
|
for arg in &test.args {
|
||||||
|
@ -59,15 +59,15 @@ fn run_tests(tests: Vec<TestCase>) {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chmod_octal() {
|
fn test_chmod_octal() {
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"0700", TEST_FILE}, before: 0o000, after: 0o700},
|
TestCase{args: vec!{"0700", TEST_FILE}, before: 0o100000, after: 0o100700},
|
||||||
TestCase{args: vec!{"0070", TEST_FILE}, before: 0o000, after: 0o070},
|
TestCase{args: vec!{"0070", TEST_FILE}, before: 0o100000, after: 0o100070},
|
||||||
TestCase{args: vec!{"0007", TEST_FILE}, before: 0o000, after: 0o007},
|
TestCase{args: vec!{"0007", TEST_FILE}, before: 0o100000, after: 0o100007},
|
||||||
TestCase{args: vec!{"-0700", TEST_FILE}, before: 0o700, after: 0o000},
|
TestCase{args: vec!{"-0700", TEST_FILE}, before: 0o100700, after: 0o100000},
|
||||||
TestCase{args: vec!{"-0070", TEST_FILE}, before: 0o060, after: 0o000},
|
TestCase{args: vec!{"-0070", TEST_FILE}, before: 0o100060, after: 0o100000},
|
||||||
TestCase{args: vec!{"-0007", TEST_FILE}, before: 0o001, after: 0o000},
|
TestCase{args: vec!{"-0007", TEST_FILE}, before: 0o100001, after: 0o100000},
|
||||||
TestCase{args: vec!{"+0100", TEST_FILE}, before: 0o600, after: 0o700},
|
TestCase{args: vec!{"+0100", TEST_FILE}, before: 0o100600, after: 0o100700},
|
||||||
TestCase{args: vec!{"+0020", TEST_FILE}, before: 0o050, after: 0o070},
|
TestCase{args: vec!{"+0020", TEST_FILE}, before: 0o100050, after: 0o100070},
|
||||||
TestCase{args: vec!{"+0004", TEST_FILE}, before: 0o003, after: 0o007},
|
TestCase{args: vec!{"+0004", TEST_FILE}, before: 0o100003, after: 0o100007},
|
||||||
};
|
};
|
||||||
run_tests(tests);
|
run_tests(tests);
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,13 @@ fn test_chmod_ugoa() {
|
||||||
umask(0)
|
umask(0)
|
||||||
};
|
};
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"u=rwx", TEST_FILE}, before: 0o000, after: 0o700},
|
TestCase{args: vec!{"u=rwx", TEST_FILE}, before: 0o100000, after: 0o100700},
|
||||||
TestCase{args: vec!{"g=rwx", TEST_FILE}, before: 0o000, after: 0o070},
|
TestCase{args: vec!{"g=rwx", TEST_FILE}, before: 0o100000, after: 0o100070},
|
||||||
TestCase{args: vec!{"o=rwx", TEST_FILE}, before: 0o000, after: 0o007},
|
TestCase{args: vec!{"o=rwx", TEST_FILE}, before: 0o100000, after: 0o100007},
|
||||||
TestCase{args: vec!{"a=rwx", TEST_FILE}, before: 0o000, after: 0o777},
|
TestCase{args: vec!{"a=rwx", TEST_FILE}, before: 0o100000, after: 0o100777},
|
||||||
TestCase{args: vec!{"-r", TEST_FILE}, before: 0o777, after: 0o333},
|
TestCase{args: vec!{"-r", TEST_FILE}, before: 0o100777, after: 0o100333},
|
||||||
TestCase{args: vec!{"-w", TEST_FILE}, before: 0o777, after: 0o555},
|
TestCase{args: vec!{"-w", TEST_FILE}, before: 0o100777, after: 0o100555},
|
||||||
TestCase{args: vec!{"-x", TEST_FILE}, before: 0o777, after: 0o666},
|
TestCase{args: vec!{"-x", TEST_FILE}, before: 0o100777, after: 0o100666},
|
||||||
};
|
};
|
||||||
run_tests(tests);
|
run_tests(tests);
|
||||||
|
|
||||||
|
@ -94,14 +94,14 @@ fn test_chmod_ugoa() {
|
||||||
umask(0o022);
|
umask(0o022);
|
||||||
}
|
}
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"u=rwx", TEST_FILE}, before: 0o000, after: 0o700},
|
TestCase{args: vec!{"u=rwx", TEST_FILE}, before: 0o100000, after: 0o100700},
|
||||||
TestCase{args: vec!{"g=rwx", TEST_FILE}, before: 0o000, after: 0o070},
|
TestCase{args: vec!{"g=rwx", TEST_FILE}, before: 0o100000, after: 0o100070},
|
||||||
TestCase{args: vec!{"o=rwx", TEST_FILE}, before: 0o000, after: 0o007},
|
TestCase{args: vec!{"o=rwx", TEST_FILE}, before: 0o100000, after: 0o100007},
|
||||||
TestCase{args: vec!{"a=rwx", TEST_FILE}, before: 0o000, after: 0o777},
|
TestCase{args: vec!{"a=rwx", TEST_FILE}, before: 0o100000, after: 0o100777},
|
||||||
TestCase{args: vec!{"+rw", TEST_FILE}, before: 0o000, after: 0o644},
|
TestCase{args: vec!{"+rw", TEST_FILE}, before: 0o100000, after: 0o100644},
|
||||||
TestCase{args: vec!{"=rwx", TEST_FILE}, before: 0o000, after: 0o755},
|
TestCase{args: vec!{"=rwx", TEST_FILE}, before: 0o100000, after: 0o100755},
|
||||||
TestCase{args: vec!{"-w", TEST_FILE}, before: 0o777, after: 0o577},
|
TestCase{args: vec!{"-w", TEST_FILE}, before: 0o100777, after: 0o100577},
|
||||||
TestCase{args: vec!{"-x", TEST_FILE}, before: 0o777, after: 0o666},
|
TestCase{args: vec!{"-x", TEST_FILE}, before: 0o100777, after: 0o100666},
|
||||||
};
|
};
|
||||||
run_tests(tests);
|
run_tests(tests);
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -112,11 +112,11 @@ fn test_chmod_ugoa() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chmod_ugo_copy() {
|
fn test_chmod_ugo_copy() {
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"u=g", TEST_FILE}, before: 0o070, after: 0o770},
|
TestCase{args: vec!{"u=g", TEST_FILE}, before: 0o100070, after: 0o100770},
|
||||||
TestCase{args: vec!{"g=o", TEST_FILE}, before: 0o005, after: 0o055},
|
TestCase{args: vec!{"g=o", TEST_FILE}, before: 0o100005, after: 0o100055},
|
||||||
TestCase{args: vec!{"o=u", TEST_FILE}, before: 0o200, after: 0o202},
|
TestCase{args: vec!{"o=u", TEST_FILE}, before: 0o100200, after: 0o100202},
|
||||||
TestCase{args: vec!{"u-g", TEST_FILE}, before: 0o710, after: 0o610},
|
TestCase{args: vec!{"u-g", TEST_FILE}, before: 0o100710, after: 0o100610},
|
||||||
TestCase{args: vec!{"u+g", TEST_FILE}, before: 0o250, after: 0o750},
|
TestCase{args: vec!{"u+g", TEST_FILE}, before: 0o100250, after: 0o100750},
|
||||||
};
|
};
|
||||||
run_tests(tests);
|
run_tests(tests);
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ fn test_chmod_many_options() {
|
||||||
umask(0)
|
umask(0)
|
||||||
};
|
};
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"-r,a+w", TEST_FILE}, before: 0o444, after: 0o222},
|
TestCase{args: vec!{"-r,a+w", TEST_FILE}, before: 0o100444, after: 0o100222},
|
||||||
};
|
};
|
||||||
run_tests(tests);
|
run_tests(tests);
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -140,8 +140,8 @@ fn test_chmod_many_options() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chmod_reference_file() {
|
fn test_chmod_reference_file() {
|
||||||
let tests = vec!{
|
let tests = vec!{
|
||||||
TestCase{args: vec!{"--reference", REFERENCE_FILE, TEST_FILE}, before: 0o070, after: 0o247},
|
TestCase{args: vec!{"--reference", REFERENCE_FILE, TEST_FILE}, before: 0o100070, after: 0o100247},
|
||||||
TestCase{args: vec!{"a-w", "--reference", REFERENCE_FILE, TEST_FILE}, before: 0o070, after: 0o247},
|
TestCase{args: vec!{"a-w", "--reference", REFERENCE_FILE, TEST_FILE}, before: 0o100070, after: 0o100247},
|
||||||
};
|
};
|
||||||
let (at, ucmd) = at_and_ucmd!();
|
let (at, ucmd) = at_and_ucmd!();
|
||||||
mkfile(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS);
|
mkfile(&at.plus_as_string(REFERENCE_FILE), REFERENCE_PERMS);
|
||||||
|
|
|
@ -85,7 +85,7 @@ fn test_install_mode_numeric() {
|
||||||
assert!(at.file_exists(file));
|
assert!(at.file_exists(file));
|
||||||
assert!(at.file_exists(dest_file));
|
assert!(at.file_exists(dest_file));
|
||||||
let permissions = at.metadata(dest_file).permissions();
|
let permissions = at.metadata(dest_file).permissions();
|
||||||
assert_eq!(0o333 as u32, PermissionsExt::mode(&permissions));
|
assert_eq!(0o100333 as u32, PermissionsExt::mode(&permissions));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -103,7 +103,7 @@ fn test_install_mode_symbolic() {
|
||||||
assert!(at.file_exists(file));
|
assert!(at.file_exists(file));
|
||||||
assert!(at.file_exists(dest_file));
|
assert!(at.file_exists(dest_file));
|
||||||
let permissions = at.metadata(dest_file).permissions();
|
let permissions = at.metadata(dest_file).permissions();
|
||||||
assert_eq!(0o003 as u32, PermissionsExt::mode(&permissions));
|
assert_eq!(0o100003 as u32, PermissionsExt::mode(&permissions));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -134,5 +134,5 @@ fn test_install_mode_directories() {
|
||||||
|
|
||||||
assert!(at.dir_exists(component));
|
assert!(at.dir_exists(component));
|
||||||
let permissions = at.metadata(component).permissions();
|
let permissions = at.metadata(component).permissions();
|
||||||
assert_eq!(0o333 as u32, PermissionsExt::mode(&permissions));
|
assert_eq!(0o040333 as u32, PermissionsExt::mode(&permissions));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue