fn test_attr_fs_to_fuse_directory()

in src/nodes/conv.rs [298:332]


    fn test_attr_fs_to_fuse_directory() {
        let dir = tempdir().unwrap();
        let path = dir.path().join("root");
        fs::create_dir(&path).unwrap();
        fs::create_dir(path.join("subdir1")).unwrap();
        fs::create_dir(path.join("subdir2")).unwrap();

        fs::set_permissions(&path, fs::Permissions::from_mode(0o750)).unwrap();
        sys::stat::utimes(&path, &sys::time::TimeVal::seconds(12345),
            &sys::time::TimeVal::seconds(678)).unwrap();

        let exp_attr = fuse::FileAttr {
            ino: 1234,  // Ensure underlying inode is not propagated.
            kind: fuse::FileType::Directory,
            nlink: 56, // TODO(jmmv): Should this account for subdirs?
            size: 2,
            blocks: 0,
            atime: Timespec { sec: 12345, nsec: 0 },
            mtime: Timespec { sec: 678, nsec: 0 },
            ctime: BAD_TIME,
            crtime: BAD_TIME,
            perm: 0o750,
            uid: unistd::getuid().as_raw(),
            gid: unistd::getgid().as_raw(),
            rdev: 0,
            flags: 0,
        };

        let mut attr = attr_fs_to_fuse(&path, 1234, 56, &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));
    }