Skip to content

Commit 15d3ca5

Browse files
committed
Add test for fcntl(O_DIRECT)
1 parent 3b75fd0 commit 15d3ca5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/test/direct.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ int main(void) {
2222
ret = pread(fd, p, SIZE, 0);
2323
test_assert(ret == SIZE);
2424

25+
fd = open("test.out", O_RDWR | O_CREAT | O_TRUNC, 0600);
26+
test_assert(fd >= 0);
27+
ret = fcntl(fd, F_SETFL, O_DIRECT);
28+
test_assert(ret == 0);
29+
30+
ret = write(fd, p, SIZE);
31+
test_assert(ret == SIZE);
32+
33+
ret = pread(fd, p, SIZE, 0);
34+
test_assert(ret == SIZE);
35+
2536
atomic_puts("EXIT-SUCCESS");
2637
return 0;
2738
}

0 commit comments

Comments
 (0)