Skip to content

Fix tests with invalid fds #331

@Darksonn

Description

@Darksonn

A recent change in the stdlib made it so that two tests no longer pass:

#[test]
#[ignore]
fn drop_off_runtime() {
let file = tokio_uring::start(async {
let tempfile = tempfile();
File::open(tempfile.path()).await.unwrap()
});
let fd = file.as_raw_fd();
drop(file);
assert_invalid_fd(fd);
}

#[test]
#[ignore]
fn explicit_close() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
tokio_uring::start(async {
let file = File::open(tempfile.path()).await.unwrap();
let fd = file.as_raw_fd();
file.close().await.unwrap();
assert_invalid_fd(fd);
})
}

Instead, the process is killed with an error about the fd being invalid (which is correct - that's what we're testing). The tests need to be fixed, and if there is any unsoundness anywhere that needs to be fixed too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions