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

Fix or suppress some noisy tests 🏌️‍♂️ #44444

Merged
merged 23 commits into from
Mar 6, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1968011
suppress time prints
IanButterworth Mar 4, 2022
3236051
avoid replacing module Foo warning
IanButterworth Mar 4, 2022
761fc2a
suppress empty info log
IanButterworth Mar 4, 2022
3f9d426
Artifacts: make test artifact downloads quiet
IanButterworth Mar 4, 2022
1040a17
LazyArtifacts: make test install quiet
IanButterworth Mar 4, 2022
f5ad556
REPL: suppress foo echo tests
IanButterworth Mar 4, 2022
375f5e8
Merge branch 'master' into ib/denoise_tests
IanButterworth Mar 4, 2022
22784d5
make GC.enable_logging test capture and test print
IanButterworth Mar 4, 2022
3dc7217
capture tested deprecation warnings
IanButterworth Mar 4, 2022
a437d7f
switch with_logger to test_logs
IanButterworth Mar 4, 2022
4d1090a
tidy up Base.active_project_callbacks earlier to avoid error log
IanButterworth Mar 4, 2022
75c98a2
FileWatching: suppress Pidfile warning logs
IanButterworth Mar 5, 2022
6f03d26
instead of suppressing empty info log, use a debug
IanButterworth Mar 5, 2022
2f21222
convert a noisy boundscheck testset to regular tests
IanButterworth Mar 5, 2022
d45b13f
add missing SecretBuffer shred!s
IanButterworth Mar 5, 2022
33184ce
remove debug-looking print
IanButterworth Mar 5, 2022
51c1346
don't use testsets in tests that are run in parallel
IanButterworth Mar 5, 2022
d090657
LibGit2: don't use testsets in subprocessed tests to prevent print leak
IanButterworth Mar 5, 2022
b4590df
avoid method redefinition in syntax tests
IanButterworth Mar 5, 2022
02c5d1d
redirect stderr around intentional method redefinition to hide warning
IanButterworth Mar 5, 2022
28901b7
add note
IanButterworth Mar 5, 2022
960eae0
🤖 Bump the SHA stdlib from 57c3a8c to 2d1f84e
DilumAluthge Mar 5, 2022
41b38d2
review suggestions
IanButterworth Mar 6, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
de53629eb0b1ce98ac6b245bdbf14e9d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
71cdc58b03cc4f42f8c4b9c2353d6f94d77b4ac5c9d374387d435c57ba85e966f3be4e8c8447b34e184cb8e665c42b3cd2c9d9742c86f7fb5c71a85df5087966

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions stdlib/Artifacts/test/refresh_artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions stdlib/FileWatching/test/pidfile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 targetted @test_log tests instead of suppressing all logs to hide the expected warnings
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do

@testset "Pidfile.jl" begin
old_umask = umask(0o002)
try
Expand Down Expand Up @@ -356,3 +360,5 @@ end; end # cd(tempdir)
finally
umask(old_umask)
end; end # testset

end # with_logger
16 changes: 10 additions & 6 deletions stdlib/LazyArtifacts/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)))
8 changes: 5 additions & 3 deletions stdlib/LibGit2/test/bad_ca_roots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 file, not using @testsets avoids
# leaking the report print into the Base test runnner 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
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
sendrepl2("""\e[200~
julia> A = 1
1
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion stdlib/SHA.version
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/backtrace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion test/boundscheck_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ 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
begin # Pass inbounds meta to getindex on CartesianIndices (#42115)
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
@inline getindex_42115(r, i) = @inbounds getindex(r, i)
@inline getindex_42115(r, i, j) = @inbounds getindex(r, i, j)

Expand Down
17 changes: 10 additions & 7 deletions test/deprecation_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 runnner report
begin # @deprecate
using .DeprecationTests
using .Foo1234
@test foo1234(3) == 4
Expand Down Expand Up @@ -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
Expand All @@ -125,18 +127,19 @@ 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
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
9 changes: 5 additions & 4 deletions test/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

Expand Down Expand Up @@ -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
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
import .Foo28190.Libdl; import Libdl
@test Foo28190.Libdl === Libdl

@testset "include with mapexpr" begin
let exprs = Any[]
Expand Down
17 changes: 14 additions & 3 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -348,6 +349,9 @@ end

after = Base.cumulative_compile_time_ns_after();
@test after >= before;
wait(t1)
wait(t2)
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
end # redirect_stdout

# interactive utilities

Expand Down Expand Up @@ -1065,9 +1069,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
Expand Down
3 changes: 2 additions & 1 deletion test/secretbuffer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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
5 changes: 5 additions & 0 deletions test/specificity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down