From d9714655cab409db4d57030cb403f3f553dc6453 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Sun, 6 Mar 2022 07:59:06 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20or=20suppress=20some=20noisy=20tests=20?= =?UTF-8?q?=F0=9F=8F=8C=EF=B8=8F=E2=80=8D=E2=99=82=EF=B8=8F=20(#44444)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../md5 | 1 + .../sha512 | 1 + .../md5 | 1 - .../sha512 | 1 - stdlib/Artifacts/test/refresh_artifacts.jl | 4 ++-- stdlib/FileWatching/test/pidfile.jl | 6 ++++++ stdlib/LazyArtifacts/test/runtests.jl | 16 ++++++++++------ stdlib/LibGit2/test/bad_ca_roots.jl | 8 +++++--- stdlib/REPL/test/repl.jl | 2 ++ stdlib/SHA.version | 2 +- test/backtrace.jl | 2 +- test/boundscheck_exec.jl | 4 +++- test/deprecation_exec.jl | 17 ++++++++++------- test/loading.jl | 9 +++++---- test/misc.jl | 19 ++++++++++++++++--- test/secretbuffer.jl | 3 ++- test/specificity.jl | 5 +++++ test/syntax.jl | 10 +++++----- 18 files changed, 75 insertions(+), 36 deletions(-) create mode 100644 deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/md5 create mode 100644 deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/sha512 delete mode 100644 deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/md5 delete mode 100644 deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/sha512 diff --git a/deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/md5 b/deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/md5 new file mode 100644 index 0000000000000..f682cf3518658 --- /dev/null +++ b/deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/md5 @@ -0,0 +1 @@ +de53629eb0b1ce98ac6b245bdbf14e9d diff --git a/deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/sha512 b/deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/sha512 new file mode 100644 index 0000000000000..870098ef7aada --- /dev/null +++ b/deps/checksums/SHA-2d1f84e6f8417a1a368de48318640d948b023e7a.tar.gz/sha512 @@ -0,0 +1 @@ +71cdc58b03cc4f42f8c4b9c2353d6f94d77b4ac5c9d374387d435c57ba85e966f3be4e8c8447b34e184cb8e665c42b3cd2c9d9742c86f7fb5c71a85df5087966 diff --git a/deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/md5 b/deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/md5 deleted file mode 100644 index 1bcc55fb297fa..0000000000000 --- a/deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -96d57bc32f4f9bb8c66117c96e6243fc diff --git a/deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/sha512 b/deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/sha512 deleted file mode 100644 index 7f6c994b2fbb7..0000000000000 --- a/deps/checksums/SHA-57c3a8c8358021b7a58526364e6885768fd95de2.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -7243eddcccb634910f35252f30b29fe44c348955039bea56546765ab828bddb575a87603e91c89bee2619ea6e45b606c23fab2c8f4fc28c910571800732201a9 diff --git a/stdlib/Artifacts/test/refresh_artifacts.jl b/stdlib/Artifacts/test/refresh_artifacts.jl index a70e13db1ee93..7078912c00072 100644 --- a/stdlib/Artifacts/test/refresh_artifacts.jl +++ b/stdlib/Artifacts/test/refresh_artifacts.jl @@ -12,11 +12,11 @@ let if meta isa Array for meta in meta get(meta, "lazy", false) && continue - ensure_artifact_installed(name, meta, toml; platform=unused) + ensure_artifact_installed(name, meta, toml; platform=unused, io = devnull) end else; meta::Dict get(meta, "lazy", false) && continue - ensure_artifact_installed(name, meta, toml; platform=unused) + ensure_artifact_installed(name, meta, toml; platform=unused, io = devnull) end end end diff --git a/stdlib/FileWatching/test/pidfile.jl b/stdlib/FileWatching/test/pidfile.jl index 757b0b20bdfb7..febc082518edf 100644 --- a/stdlib/FileWatching/test/pidfile.jl +++ b/stdlib/FileWatching/test/pidfile.jl @@ -20,6 +20,10 @@ Base.Filesystem.mtime(io::MemoryFile) = io.mtime # open mask without interference from parent's state # and create a test environment temp directory umask(new_mask) = ccall((@static iswindows() ? :_umask : :umask), Cint, (Cint,), new_mask) + +# TODO: Use targeted @test_log tests instead of suppressing all logs to hide the expected warnings +Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do + @testset "Pidfile.jl" begin old_umask = umask(0o002) try @@ -356,3 +360,5 @@ end; end # cd(tempdir) finally umask(old_umask) end; end # testset + +end # with_logger diff --git a/stdlib/LazyArtifacts/test/runtests.jl b/stdlib/LazyArtifacts/test/runtests.jl index 5e3850caecf4c..53898082cd346 100644 --- a/stdlib/LazyArtifacts/test/runtests.jl +++ b/stdlib/LazyArtifacts/test/runtests.jl @@ -5,8 +5,10 @@ using Test mktempdir() do tempdir LazyArtifacts.Artifacts.with_artifacts_directory(tempdir) do - socrates_dir = artifact"socrates" - @test isdir(socrates_dir) + redirect_stderr(devnull) do + socrates_dir = artifact"socrates" + @test isdir(socrates_dir) + end ex = @test_throws ErrorException artifact"HelloWorldC" @test startswith(ex.value.msg, "Artifact \"HelloWorldC\" was not installed correctly. ") end @@ -18,10 +20,12 @@ end using Test mktempdir() do tempdir Artifacts.with_artifacts_directory(tempdir) do - socrates_dir = @test_logs( - (:warn, "using Pkg instead of using LazyArtifacts is deprecated"), - artifact"socrates") - @test isdir(socrates_dir) + redirect_stderr(devnull) do + socrates_dir = @test_logs( + (:warn, "using Pkg instead of using LazyArtifacts is deprecated"), + artifact"socrates") + @test isdir(socrates_dir) + end end end'`, dir=@__DIR__))) diff --git a/stdlib/LibGit2/test/bad_ca_roots.jl b/stdlib/LibGit2/test/bad_ca_roots.jl index e4ebdc709637a..4882065167bdb 100644 --- a/stdlib/LibGit2/test/bad_ca_roots.jl +++ b/stdlib/LibGit2/test/bad_ca_roots.jl @@ -9,7 +9,9 @@ using Test, LibGit2, NetworkOptions # if that changes, this may need to be adjusted const CAN_SET_CA_ROOTS_PATH = !Sys.isapple() && !Sys.iswindows() -@testset "empty CA roots file" begin +# Given this is a sub-processed test file, not using @testsets avoids +# leaking the report print into the Base test runner report +begin # empty CA roots file # these fail for different reasons on different platforms: # - on Apple & Windows you cannot set the CA roots path location # - on Linux & FreeBSD you you can but these are invalid files @@ -29,14 +31,14 @@ const CAN_SET_CA_ROOTS_PATH = !Sys.isapple() && !Sys.iswindows() end if CAN_SET_CA_ROOTS_PATH - @testset "non-empty but bad CA roots file" begin + begin # non-empty but bad CA roots file # should still be possible to initialize ENV["JULIA_SSL_CA_ROOTS_PATH"] = joinpath(@__DIR__, "bad_ca_roots.pem") @test LibGit2.ensure_initialized() === nothing end mktempdir() do dir repo_url = "https://github.com/JuliaLang/Example.jl" - @testset "HTTPS clone with bad CA roots fails" begin + begin # HTTPS clone with bad CA roots fails repo_path = joinpath(dir, "Example.HTTPS") c = LibGit2.CredentialPayload(allow_prompt=false, allow_git_helpers=false) redirect_stderr(devnull) diff --git a/stdlib/REPL/test/repl.jl b/stdlib/REPL/test/repl.jl index d711d0be5e243..05f583c807165 100644 --- a/stdlib/REPL/test/repl.jl +++ b/stdlib/REPL/test/repl.jl @@ -751,6 +751,7 @@ fake_repl() do stdin_write, stdout_read, repl @test readuntil(stdout_read, "end", keep=true) == "\n\r\e[7C α=1\n\r\e[7C β=2\n\r\e[7Cend" # Test switching repl modes + redirect_stdout(devnull) do # to suppress "foo" echoes sendrepl2("""\e[200~ julia> A = 1 1 @@ -775,6 +776,7 @@ fake_repl() do stdin_write, stdout_read, repl wait(c) @test Main.A == 1 @test Main.B == 2 + end # redirect_stdout # Close repl write(stdin_write, '\x04') diff --git a/stdlib/SHA.version b/stdlib/SHA.version index 312fbc55ea97c..f2242a336c6fe 100644 --- a/stdlib/SHA.version +++ b/stdlib/SHA.version @@ -1,4 +1,4 @@ SHA_BRANCH = master -SHA_SHA1 = 57c3a8c8358021b7a58526364e6885768fd95de2 +SHA_SHA1 = 2d1f84e6f8417a1a368de48318640d948b023e7a SHA_GIT_URL := https://github.com/JuliaCrypto/SHA.jl.git SHA_TAR_URL = https://api.github.com/repos/JuliaCrypto/SHA.jl/tarball/$1 diff --git a/test/backtrace.jl b/test/backtrace.jl index 3aebfec410f34..35b607137a5c2 100644 --- a/test/backtrace.jl +++ b/test/backtrace.jl @@ -184,7 +184,7 @@ end # issue 28618 let bt, found = false - @info "" + @debug "" bt = backtrace() for frame in map(lookup, bt) if frame[1].line == @__LINE__() - 2 && frame[1].file == Symbol(@__FILE__) diff --git a/test/boundscheck_exec.jl b/test/boundscheck_exec.jl index 71690c55faeca..715700e00378f 100644 --- a/test/boundscheck_exec.jl +++ b/test/boundscheck_exec.jl @@ -259,7 +259,9 @@ if bc_opt == bc_default || bc_opt == bc_off @test !occursin("arrayref(true", typed_40281) end -@testset "pass inbounds meta to getindex on CartesianIndices (#42115)" begin +# Given this is a sub-processed test file, not using @testsets avoids +# leaking the report print into the Base test runner report +begin # Pass inbounds meta to getindex on CartesianIndices (#42115) @inline getindex_42115(r, i) = @inbounds getindex(r, i) @inline getindex_42115(r, i, j) = @inbounds getindex(r, i, j) diff --git a/test/deprecation_exec.jl b/test/deprecation_exec.jl index de5acf977ba82..194632279397c 100644 --- a/test/deprecation_exec.jl +++ b/test/deprecation_exec.jl @@ -46,7 +46,9 @@ end # Create a consistent call frame for nowarn tests @noinline call(f, args...) = @noinline f(args...) -@testset "@deprecate" begin +# Given this is a sub-processed test file, not using @testsets avoids +# leaking the report print into the Base test runner report +begin # @deprecate using .DeprecationTests using .Foo1234 @test foo1234(3) == 4 @@ -99,7 +101,7 @@ f24658() = depwarn24658() depwarn24658() = Base.firstcaller(backtrace(), :_func_not_found_) -@testset "firstcaller" begin +begin # firstcaller # issue #24658 @test eval(:(if true; f24658(); end)) == (Ptr{Cvoid}(0),StackTraces.UNKNOWN) end @@ -125,7 +127,7 @@ global_logger(prev_logger) #------------------------------------------------------------------------------- # BEGIN 0.7 deprecations -@testset "parser syntax deprecations" begin +begin # parser syntax deprecations # #15524 # @test (@test_deprecated Meta.parse("for a=b f() end")) == :(for a=b; f() end) @test_broken length(Test.collect_test_logs(()->Meta.parse("for a=b f() end"))[1]) > 0 @@ -133,10 +135,11 @@ end # END 0.7 deprecations -@testset "tuple indexed by float deprecation" begin +begin # tuple indexed by float deprecation @test_deprecated getindex((1,), 1.0) === 1 @test_deprecated getindex((1,2), 2.0) === 2 - @test_throws Exception getindex((), 1.0) - @test_throws Exception getindex((1,2), 0.0) - @test_throws Exception getindex((1,2), -1.0) + @test Base.JLOptions().depwarn == 1 + @test_throws Exception @test_warn r"`getindex(t::Tuple, i::Real)` is deprecated" getindex((), 1.0) + @test_throws Exception @test_warn r"`getindex(t::Tuple, i::Real)` is deprecated" getindex((1,2), 0.0) + @test_throws Exception @test_warn r"`getindex(t::Tuple, i::Real)` is deprecated" getindex((1,2), -1.0) end diff --git a/test/loading.jl b/test/loading.jl index 5ee20bfb07fca..930894bebc8ab 100644 --- a/test/loading.jl +++ b/test/loading.jl @@ -234,6 +234,7 @@ append!(empty!(DEPOT_PATH), [mktempdir(), joinpath(@__DIR__, "depot")]) @test watcher_counter[] == 0 @test_logs (:error, r"active project callback .* failed") Base.set_active_project(nothing) @test watcher_counter[] == 1 +pop!(Base.active_project_callbacks) @test load_path() == [joinpath(@__DIR__, "project", "Project.toml")] @@ -732,14 +733,14 @@ end append!(empty!(LOAD_PATH), saved_load_path) append!(empty!(DEPOT_PATH), saved_depot_path) -for _ = 1:2 pop!(Base.active_project_callbacks) end +pop!(Base.active_project_callbacks) Base.set_active_project(saved_active_project) @test watcher_counter[] == 3 # issue #28190 -module Foo; import Libdl; end -import .Foo.Libdl; import Libdl -@test Foo.Libdl === Libdl +module Foo28190; import Libdl; end +import .Foo28190.Libdl; import Libdl +@test Foo28190.Libdl === Libdl @testset "include with mapexpr" begin let exprs = Any[] diff --git a/test/misc.jl b/test/misc.jl index 9a92d0fda0076..efc647667f4b6 100644 --- a/test/misc.jl +++ b/test/misc.jl @@ -283,6 +283,7 @@ v11801, t11801 = @timed sin(1) @test names(@__MODULE__, all = true) == names_before_timing +redirect_stdout(devnull) do # suppress time prints # Accepted @time argument formats @test @time true @test @time "message" true @@ -349,6 +350,11 @@ end after = Base.cumulative_compile_time_ns_after(); @test after >= before; +# wait for completion of these tasks before restoring stdout, to suppress their @time prints. +wait(t1); wait(t2) + +end # redirect_stdout + # interactive utilities struct ambigconvert; end # inject a problematic `convert` method to ensure it still works @@ -1065,9 +1071,16 @@ end GC.safepoint() - GC.enable_logging(true) - GC.gc() - GC.enable_logging(false) + mktemp() do tmppath, _ + open(tmppath, "w") do tmpio + redirect_stderr(tmpio) do + GC.enable_logging(true) + GC.gc() + GC.enable_logging(false) + end + end + @test occursin("GC: pause", read(open(tmppath), String)) + end end @testset "fieldtypes Module" begin diff --git a/test/secretbuffer.jl b/test/secretbuffer.jl index aea2a662766c9..df67204dd63ba 100644 --- a/test/secretbuffer.jl +++ b/test/secretbuffer.jl @@ -99,6 +99,7 @@ using Test @test position(sb) == 0 skip(sb, sb.size) @test position(sb) == sb.size + shred!(sb) end @testset "seekend" begin sb = SecretBuffer("hello") @@ -108,7 +109,6 @@ using Test end @testset "position" begin sb = SecretBuffer("Julia") - println("testing position") initial_pos = (position(sb)) seek(sb,2) mid_pos = position(sb) @@ -120,5 +120,6 @@ using Test sb1 = SecretBuffer("hello") sb2 = SecretBuffer("juliaisawesome") @test hash(sb1, UInt(5)) === hash(sb2, UInt(5)) + shred!(sb1); shred!(sb2) end end diff --git a/test/specificity.jl b/test/specificity.jl index de65c289be02a..1a5c117ce5d9d 100644 --- a/test/specificity.jl +++ b/test/specificity.jl @@ -90,7 +90,12 @@ begin @test f((1,2,3), A) == 3 @test f((1,2), A) == 2 @test f((), reshape([1])) == 1 + + oldstderr = stderr + newstderr = redirect_stderr() # redirect stderr to avoid method definition overwrite warning f(dims::NTuple{N,Int}, A::AbstractArray{T,N}) where {T,N} = 4 + redirect_stderr(oldstderr) + @test f((1,2), A) == 4 @test f((1,2,3), A) == 3 end diff --git a/test/syntax.jl b/test/syntax.jl index 99430f90ce5f6..6a4b97ec79518 100644 --- a/test/syntax.jl +++ b/test/syntax.jl @@ -2981,15 +2981,15 @@ end end @testset "slurping into function def" begin - x, f()... = [1, 2, 3] + x, f1()... = [1, 2, 3] @test x == 1 - @test f() == [2, 3] + @test f1() == [2, 3] # test that call to `Base.rest` is outside the definition of `f` - @test f() === f() + @test f1() === f1() - x, f()... = 1, 2, 3 + x, f2()... = 1, 2, 3 @test x == 1 - @test f() == (2, 3) + @test f2() == (2, 3) end @testset "long function bodies" begin