mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
Split the sync tests into sync and fsync
This commit is contained in:
parent
e747d2ba17
commit
68818983ae
@ -557,6 +557,24 @@ test "signalfd" {
|
||||
}
|
||||
|
||||
test "sync" {
|
||||
if (builtin.os.tag != .linux)
|
||||
return error.SkipZigTest;
|
||||
|
||||
var tmp = tmpDir(.{});
|
||||
defer tmp.cleanup();
|
||||
|
||||
const test_out_file = "os_tmp_test";
|
||||
const file = try tmp.dir.createFile(test_out_file, .{});
|
||||
defer {
|
||||
file.close();
|
||||
tmp.dir.deleteFile(test_out_file) catch {};
|
||||
}
|
||||
|
||||
os.sync();
|
||||
try os.syncfs(file.handle);
|
||||
}
|
||||
|
||||
test "fsync" {
|
||||
if (builtin.os.tag != .linux and builtin.os.tag != .windows)
|
||||
return error.SkipZigTest;
|
||||
|
||||
@ -570,8 +588,6 @@ test "sync" {
|
||||
tmp.dir.deleteFile(test_out_file) catch {};
|
||||
}
|
||||
|
||||
try os.syncfs(file.handle);
|
||||
try os.fsync(file.handle);
|
||||
try os.fdatasync(file.handle);
|
||||
os.sync();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user