Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable some FileWatching tests on x86_64 apple #46384

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 49 additions & 47 deletions stdlib/FileWatching/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -369,60 +369,62 @@ test_monitor_wait_poll()
test_monitor_wait_poll()
test_watch_file_timeout(0.2)
test_watch_file_change(6)
test_dirmonitor_wait2(0.2)
test_dirmonitor_wait2(0.2)

mv(file, file * "~")
mv(file * "~", file)
let changes = []
while true
let c
Sys.iswindows() && sleep(0.1)
@test @elapsed(c = watch_folder(dir, 0.0)) < 0.5
push!(changes, c)
(c.second::FileWatching.FileEvent).timedout && break
end
end
if F_GETPATH
@test 12 < length(changes) < 48
else
@test 5 < length(changes) < 16
end
@test pop!(changes) == ("" => FileWatching.FileEvent())
if F_GETPATH
Sys.iswindows() && @test pop!(changes) == (F_PATH => FileWatching.FileEvent(FileWatching.UV_CHANGE))
p = pop!(changes)
if !Sys.isapple()
@test p == (F_PATH => FileWatching.FileEvent(FileWatching.UV_RENAME))
end
while changes[end][1] == F_PATH
@test pop!(changes)[2] == FileWatching.FileEvent(FileWatching.UV_RENAME)
end
p = pop!(changes)
if !Sys.isapple()
@test p == (F_PATH * "~" => FileWatching.FileEvent(FileWatching.UV_RENAME))
end
while changes[end][1] == F_PATH * "~"
@test pop!(changes)[2] == FileWatching.FileEvent(FileWatching.UV_RENAME)

if !((Sys.ARCH == :x86_64) && (Sys.isapple())) #These tests tend to fail a lot on x86-apple
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I may have been a little overeager. These fail on aarch64 also, so should be disabled everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually haven't seen this fail in FileWatching in aarch64, the only one I've seen was a failure in the PIDFile test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but the moment we see it, the test is gone ;)

test_dirmonitor_wait2(0.2) #because the os can reorder the events
test_dirmonitor_wait2(0.2) #see https://github.com/dotnet/runtime/issues/30415

mv(file, file * "~")
mv(file * "~", file)
let changes = []
while true
let c
Sys.iswindows() && sleep(0.1)
@test @elapsed(c = watch_folder(dir, 0.0)) < 0.5
push!(changes, c)
(c.second::FileWatching.FileEvent).timedout && break
end
end
if changes[end][1] == F_PATH
@test pop!(changes)[2] == FileWatching.FileEvent(FileWatching.UV_RENAME)
if F_GETPATH
@test 12 < length(changes) < 48
else
@test 5 < length(changes) < 16
end
for j = 1:4
for i = 3:-1:1
while changes[end - 1][1] == "$F_PATH$i"
@test let x = pop!(changes)[2]; x.changed ⊻ x.renamed; end
end
p = pop!(changes)
if !Sys.isapple()
@test p == ("$F_PATH$i" => FileWatching.FileEvent(FileWatching.UV_RENAME))
@test pop!(changes) == ("" => FileWatching.FileEvent())
if F_GETPATH
Sys.iswindows() && @test pop!(changes) == (F_PATH => FileWatching.FileEvent(FileWatching.UV_CHANGE))
p = pop!(changes)
if !Sys.isapple()
@test p == (F_PATH => FileWatching.FileEvent(FileWatching.UV_RENAME))
end
while changes[end][1] == F_PATH
@test pop!(changes)[2] == FileWatching.FileEvent(FileWatching.UV_RENAME)
end
p = pop!(changes)
if !Sys.isapple()
@test p == (F_PATH * "~" => FileWatching.FileEvent(FileWatching.UV_RENAME))
end
while changes[end][1] == F_PATH * "~"
@test pop!(changes)[2] == FileWatching.FileEvent(FileWatching.UV_RENAME)
end
if changes[end][1] == F_PATH
@test pop!(changes)[2] == FileWatching.FileEvent(FileWatching.UV_RENAME)
end
for j = 1:4
for i = 3:-1:1
while changes[end - 1][1] == "$F_PATH$i"
@test let x = pop!(changes)[2]; x.changed ⊻ x.renamed; end
end
p = pop!(changes)
if !Sys.isapple()
@test p == ("$F_PATH$i" => FileWatching.FileEvent(FileWatching.UV_RENAME))
end
end
end
end
@test all(x -> (isa(x, Pair) && x[1] == F_PATH && (x[2].changed ⊻ x[2].renamed)), changes) || changes
end
@test all(x -> (isa(x, Pair) && x[1] == F_PATH && (x[2].changed ⊻ x[2].renamed)), changes) || changes
end

@test_throws(Base._UVError("FileMonitor (start)", Base.UV_ENOENT),
watch_file("____nonexistent_file", 10))
@test_throws(Base._UVError("FolderMonitor (start)", Base.UV_ENOENT),
Expand Down