1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-19 14:06:20 +02:00

Merge pull request #1676 from Overflow0xFFFF/fix/is-executable-test

fix(libcontainer): Run test_is_executable with a more common file
This commit is contained in:
Yashodhan 2023-03-23 18:04:17 +05:30 committed by GitHub
commit 1f2eeadeda
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -556,11 +556,13 @@ mod tests {
#[test]
fn test_is_executable() {
let executable_path = PathBuf::from("/bin/sh");
let directory_path = PathBuf::from("/tmp");
// a file guaranteed to be on linux and not executable
let non_executable_path = PathBuf::from("/boot/initrd.img");
let directory_path =
create_temp_dir("test_is_executable").expect("create temp directory for test");
let non_executable_path = directory_path.join("non_executable_file");
let non_existent_path = PathBuf::from("/some/non/existent/path");
File::create(non_executable_path.as_path()).unwrap();
assert!(is_executable(&non_existent_path).is_err());
assert!(is_executable(&executable_path).unwrap());
assert!(!is_executable(&non_executable_path).unwrap());