fn test_attr_fs_to_fuse_regular()

in src/nodes/conv.rs [335:369]


    fn test_attr_fs_to_fuse_regular() {
        let dir = tempdir().unwrap();
        let path = dir.path().join("file");

        let content = "Some text\n";
        create_file(&path, content);

        fs::set_permissions(&path, fs::Permissions::from_mode(0o640)).unwrap();
        sys::stat::utimes(&path, &sys::time::TimeVal::seconds(54321),
            &sys::time::TimeVal::seconds(876)).unwrap();

        let exp_attr = fuse::FileAttr {
            ino: 42,  // Ensure underlying inode is not propagated.
            kind: fuse::FileType::RegularFile,
            nlink: 50,
            size: content.len() as u64,
            blocks: 0,
            atime: Timespec { sec: 54321, nsec: 0 },
            mtime: Timespec { sec: 876, nsec: 0 },
            ctime: BAD_TIME,
            crtime: BAD_TIME,
            perm: 0o640,
            uid: unistd::getuid().as_raw(),
            gid: unistd::getgid().as_raw(),
            rdev: 0,
            flags: 0,
        };

        let mut attr = attr_fs_to_fuse(&path, 42, 50, &fs::symlink_metadata(&path).unwrap());
        // We cannot really make any useful assertions on ctime and crtime as these cannot be
        // modified and may not be queryable, so stub them out.
        attr.ctime = BAD_TIME;
        attr.crtime = BAD_TIME;
        assert!(fileattrs_eq(&exp_attr, &attr));
    }