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 even more FileWatching tests #46497

Merged
merged 6 commits into from
Aug 31, 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
37 changes: 22 additions & 15 deletions stdlib/FileWatching/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ using Base: uv_error, Experimental
# Odd numbered pipes are tested for reads
# Even numbered pipes are tested for timeouts
# Writable ends are always tested for write-ability before a write
ismacos_arm = ((Sys.ARCH == :aarch64) && (Sys.isapple())) #https://github.com/JuliaLang/julia/issues/46185
ismacos_x86 = ((Sys.ARCH == :x86_64) && (Sys.isapple())) #Used to disable the unreliable macos tests

n = 20
intvls = [2, .2, .1, .005, .00001]

pipe_fds = fill((Base.INVALID_OS_HANDLE, Base.INVALID_OS_HANDLE), n)

for i in 1:n
if Sys.iswindows() || i > n ÷ 2
uv_error("socketpair", ccall(:uv_socketpair, Cint, (Cint, Cint, Ptr{NTuple{2, Base.OS_HANDLE}}, Cint, Cint), 1, (Sys.iswindows() ? 6 : 0), Ref(pipe_fds, i), 0, 0))
Expand All @@ -32,7 +34,9 @@ for i in 1:n
if !fd_in_limits && Sys.islinux()
run(`ls -la /proc/$(getpid())/fd`)
end
@test fd_in_limits
if !ismacos_arm
@test fd_in_limits
end
Comment on lines +37 to +39
Copy link
Contributor

Choose a reason for hiding this comment

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

Can also use

@test fd_in_limits skip=ismacos_arm

which marks the test as broken, which I guess is a useful reminder

Copy link
Member Author

Choose a reason for hiding this comment

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

Those tests are probably never going to be reliable on macos anyhow, I guess setting them as broken is cleaner. Not sure

end

function pfd_tst_reads(idx, intvl)
Expand Down Expand Up @@ -183,16 +187,19 @@ function test_init_afile()
@test(watch_folder(dir) == (F_PATH => FileWatching.FileEvent(FileWatching.UV_RENAME)))
@test close(open(file, "w")) === nothing
sleep(3)
let c
c = watch_folder(dir, 0)
if F_GETPATH
@test c.first == F_PATH
@test c.second.changed ⊻ c.second.renamed
@test !c.second.timedout
else # we don't expect to be able to detect file changes in this case
@test c.first == ""
@test !c.second.changed && !c.second.renamed
@test c.second.timedout
if !ismacos_x86
let c
c = watch_folder(dir, 0)

if F_GETPATH
@test c.first == F_PATH
@test c.second.changed ⊻ c.second.renamed
@test !c.second.timedout
else # we don't expect to be able to detect file changes in this case
@test c.first == ""
@test !c.second.changed && !c.second.renamed
@test c.second.timedout
end
end
end
@test unwatch_folder(dir) === nothing
Expand Down Expand Up @@ -370,9 +377,9 @@ test_monitor_wait_poll()
test_watch_file_timeout(0.2)
test_watch_file_change(6)

if !((Sys.ARCH == :x86_64) && (Sys.isapple())) #These tests tend to fail a lot on x86-apple
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
if !ismacos_x86
test_dirmonitor_wait2(0.2)
test_dirmonitor_wait2(0.2)

mv(file, file * "~")
mv(file * "~", file)
Expand Down