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

Bump FileWatching tolerances #27707

Merged
merged 2 commits into from
Jun 22, 2018
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
18 changes: 9 additions & 9 deletions stdlib/FileWatching/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,23 @@ file = joinpath(dir, "afile.txt")
function test_init_afile()
@test isempty(FileWatching.watched_folders)
@test @elapsed(@test(watch_folder(dir, 0) == ("" => FileWatching.FileEvent()))) <= 2
@test @elapsed(@test(watch_folder(dir, 0) == ("" => FileWatching.FileEvent()))) <= 0.3
@test @elapsed(@test(watch_folder(dir, 0) == ("" => FileWatching.FileEvent()))) <= 0.5
@test length(FileWatching.watched_folders) == 1
@test unwatch_folder(dir) === nothing
@test isempty(FileWatching.watched_folders)
@test 0.001 <= @elapsed(@test(watch_folder(dir, 0.004) == ("" => FileWatching.FileEvent()))) <= 2
@test 0.001 <= @elapsed(@test(watch_folder(dir, 0.004) == ("" => FileWatching.FileEvent()))) <= 0.3
@test 0.001 <= @elapsed(@test(watch_folder(dir, 0.004) == ("" => FileWatching.FileEvent()))) <= 0.5
@test unwatch_folder(dir) === nothing
@test 0.9 <= @elapsed(@test(watch_folder(dir, 1) == ("" => FileWatching.FileEvent()))) <= 4
@test 0.9 <= @elapsed(@test(watch_folder(dir, 1) == ("" => FileWatching.FileEvent()))) <= 1.3
@test 0.9 <= @elapsed(@test(watch_folder(dir, 1) == ("" => FileWatching.FileEvent()))) <= 1.5
# like touch, but lets the operating system update the timestamp
# for greater precision on some platforms (windows)
@test close(open(file, "w")) === nothing
@test @elapsed(@test(watch_folder(dir) == (F_PATH => FileWatching.FileEvent(FileWatching.UV_RENAME)))) <= 0.3
@test @elapsed(@test(watch_folder(dir) == (F_PATH => FileWatching.FileEvent(FileWatching.UV_RENAME)))) <= 0.5
@test close(open(file, "w")) === nothing
sleep(3)
let c
@test @elapsed(c = watch_folder(dir, 0)) <= 0.3
@test @elapsed(c = watch_folder(dir, 0)) <= 0.5
if F_GETPATH
@test c.first == F_PATH
@test c.second.changed ⊻ c.second.renamed
Expand All @@ -205,8 +205,8 @@ function test_init_afile()
end
end
@test unwatch_folder(dir) === nothing
@test @elapsed(@test(watch_folder(dir, 0) == ("" => FileWatching.FileEvent()))) <= 0.3
@test 0.9 <= @elapsed(@test(watch_folder(dir, 1) == ("" => FileWatching.FileEvent()))) <= 1.3
@test @elapsed(@test(watch_folder(dir, 0) == ("" => FileWatching.FileEvent()))) <= 0.5
@test 0.9 <= @elapsed(@test(watch_folder(dir, 1) == ("" => FileWatching.FileEvent()))) <= 1.5
@test length(FileWatching.watched_folders) == 1
nothing
end
Expand Down Expand Up @@ -321,8 +321,8 @@ function test_dirmonitor_wait2(tval)
end
@sync begin
@async begin
sleep(tval)
for i = 1:3
sleep(tval)
rm("$file$i")
end
end
Expand Down Expand Up @@ -385,7 +385,7 @@ let changes = []
while true
let c
timeout = Sys.iswindows() ? 0.1 : 0.0
@test @elapsed(c = watch_folder(dir, timeout)) < 0.3
@test @elapsed(c = watch_folder(dir, timeout)) < 0.5
push!(changes, c)
(c.second::FileWatching.FileEvent).timedout && break
end
Expand Down