From 61186d8837509b46548084bea56f4c1f7f1953bb Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Wed, 20 Jun 2018 23:27:57 -0700 Subject: [PATCH 1/2] Sleep between all filesystem operations Attempt to fix https://github.com/JuliaLang/julia/issues/26725 --- stdlib/FileWatching/test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/FileWatching/test/runtests.jl b/stdlib/FileWatching/test/runtests.jl index 42d8db1bfb7b8..f1552a1571c86 100644 --- a/stdlib/FileWatching/test/runtests.jl +++ b/stdlib/FileWatching/test/runtests.jl @@ -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 From 1d6d5a485086fc6f80d59f0a84ace52a278127a6 Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Wed, 20 Jun 2018 23:36:13 -0700 Subject: [PATCH 2/2] Increase filesystem timeouts from `0.3` to `0.5` seconds This is to account for the abysmal fs performance we get on our windows buildbots. --- stdlib/FileWatching/test/runtests.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/stdlib/FileWatching/test/runtests.jl b/stdlib/FileWatching/test/runtests.jl index f1552a1571c86..53ca249a968fe 100644 --- a/stdlib/FileWatching/test/runtests.jl +++ b/stdlib/FileWatching/test/runtests.jl @@ -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 @@ -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 @@ -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