Skip to content

Commit

Permalink
Merge pull request #27707 from JuliaLang/sf/filewatching
Browse files Browse the repository at this point in the history
Bump FileWatching tolerances
  • Loading branch information
mbauman authored Jun 22, 2018
2 parents 63e7fae + 1d6d5a4 commit dd49081
Showing 1 changed file with 9 additions and 9 deletions.
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

0 comments on commit dd49081

Please sign in to comment.