From 4a12fad765c67ba18fb5e0cd15d5a7bc3898d9a5 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Thu, 8 Feb 2018 11:24:35 -0800 Subject: [PATCH] Deprecate DevNull to DEVNULL --- NEWS.md | 3 +++ base/clipboard.jl | 2 +- base/coreio.jl | 4 ++-- base/deprecated.jl | 3 +++ base/docs/basedocs.jl | 6 ++--- base/download.jl | 2 +- base/exports.jl | 2 +- base/process.jl | 24 +++++++++---------- doc/src/base/base.md | 2 +- examples/embedding/embedding-test.jl | 2 +- .../InteractiveUtils/src/InteractiveUtils.jl | 2 +- stdlib/LibGit2/test/libgit2.jl | 2 +- stdlib/Logging/test/runtests.jl | 6 ++--- stdlib/Test/test/runtests.jl | 10 ++++---- test/ccall.jl | 4 ++-- test/cmdlineargs.jl | 6 ++--- test/compiler/compiler.jl | 6 ++--- test/core.jl | 20 ++++++++-------- test/deprecation_exec.jl | 24 +++++++++---------- test/llvmcall.jl | 2 +- test/logging.jl | 6 ++--- test/read.jl | 22 ++++++++--------- test/spawn.jl | 8 +++---- 23 files changed, 87 insertions(+), 81 deletions(-) diff --git a/NEWS.md b/NEWS.md index fd68ecce6d5ed..9b9e6d957cc1c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1027,6 +1027,8 @@ Deprecated or removed * The fallback method `^(x, p::Integer)` is deprecated. If your type relied on this definition, add a method such as `^(x::MyType, p::Integer) = Base.power_by_squaring(x, p)` ([#23332]). + * The constant `DevNull` has been deprecated in favor of `DEVNULL` ([#25786]). + Command-line option changes --------------------------- @@ -1285,3 +1287,4 @@ Command-line option changes [#25654]: https://github.com/JuliaLang/julia/issues/25654 [#25655]: https://github.com/JuliaLang/julia/issues/25655 [#25745]: https://github.com/JuliaLang/julia/issues/25745 +[#25786]: https://github.com/JuliaLang/julia/issues/25786 diff --git a/base/clipboard.jl b/base/clipboard.jl index 42c753376baaf..2b3514c81b1b0 100644 --- a/base/clipboard.jl +++ b/base/clipboard.jl @@ -28,7 +28,7 @@ elseif Sys.islinux() || Sys.KERNEL === :FreeBSD global _clipboardcmd _clipboardcmd !== nothing && return _clipboardcmd for cmd in (:xclip, :xsel) - success(pipeline(`which $cmd`, DevNull)) && return _clipboardcmd = cmd + success(pipeline(`which $cmd`, DEVNULL)) && return _clipboardcmd = cmd end pkgs = @static if Sys.islinux() "xsel or xclip" diff --git a/base/coreio.jl b/base/coreio.jl index fcc6bd519e355..e3ad81dceff30 100644 --- a/base/coreio.jl +++ b/base/coreio.jl @@ -5,7 +5,7 @@ println(xs...) = println(STDOUT::IO, xs...) println(io::IO) = print(io, '\n') struct DevNullStream <: IO end -const DevNull = DevNullStream() +const DEVNULL = DevNullStream() isreadable(::DevNullStream) = false iswritable(::DevNullStream) = true isopen(::DevNullStream) = true @@ -26,6 +26,6 @@ let CoreIO = Union{Core.CoreSTDOUT, Core.CoreSTDERR} unsafe_write(io::CoreIO, x::Ptr{UInt8}, nb::UInt) = Core.unsafe_write(io, x, nb) end -STDIN = DevNull +STDIN = DEVNULL STDOUT = Core.STDOUT STDERR = Core.STDERR diff --git a/base/deprecated.jl b/base/deprecated.jl index b76b6c987cce3..793d9b3e707fa 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1355,6 +1355,9 @@ end # PR #23332 @deprecate ^(x, p::Integer) Base.power_by_squaring(x,p) +# Issue 25786 +@deprecate_binding DevNull DEVNULL + # END 0.7 deprecations # BEGIN 1.0 deprecations diff --git a/base/docs/basedocs.jl b/base/docs/basedocs.jl index 9cb15d2e43804..0df7a04e0d7c6 100644 --- a/base/docs/basedocs.jl +++ b/base/docs/basedocs.jl @@ -790,16 +790,16 @@ A variable referring to the last computed value, automatically set at the intera kw"ans" """ - DevNull + DEVNULL Used in a stream redirect to discard all data written to it. Essentially equivalent to /dev/null on Unix or NUL on Windows. Usage: ```julia -run(pipeline(`cat test.txt`, DevNull)) +run(pipeline(`cat test.txt`, DEVNULL)) ``` """ -DevNull +DEVNULL # doc strings for code in boot.jl and built-ins diff --git a/base/download.jl b/base/download.jl index be22a4aad19f3..bce6226c2c390 100644 --- a/base/download.jl +++ b/base/download.jl @@ -19,7 +19,7 @@ else global downloadcmd if downloadcmd === nothing for checkcmd in (:curl, :wget, :fetch) - if success(pipeline(`which $checkcmd`, DevNull)) + if success(pipeline(`which $checkcmd`, DEVNULL)) downloadcmd = checkcmd break end diff --git a/base/exports.jl b/base/exports.jl index e3d946d7b85dc..42dd13c1868cf 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -40,7 +40,7 @@ export DenseMatrix, DenseVecOrMat, DenseVector, - DevNull, + DEVNULL, Dict, Dims, Enum, diff --git a/base/process.jl b/base/process.jl index f04efc35eab3e..080e4e19e49c4 100644 --- a/base/process.jl +++ b/base/process.jl @@ -139,7 +139,7 @@ struct FileRedirect append::Bool function FileRedirect(filename, append) if lowercase(filename) == (@static Sys.iswindows() ? "nul" : "/dev/null") - @warn "For portability use DevNull instead of a file redirect" maxlog=1 + @warn "For portability use DEVNULL instead of a file redirect" maxlog=1 end new(filename, append) end @@ -316,13 +316,13 @@ mutable struct Process <: AbstractPipe out::Union{Redirectable, Ptr{Cvoid}}, err::Union{Redirectable, Ptr{Cvoid}}) if !isa(in, IO) - in = DevNull + in = DEVNULL end if !isa(out, IO) - out = DevNull + out = DEVNULL end if !isa(err, IO) - err = DevNull + err = DEVNULL end this = new(cmd, handle, in, out, err, typemin(fieldtype(Process, :exitcode)), @@ -539,12 +539,12 @@ end # returns stdios: # A set of up to 256 stdio instructions, where each entry can be either: # | - An IO to be passed to the child -# | - DevNull to pass /dev/null +# | - DEVNULL to pass /dev/null # | - An Filesystem.File object to redirect the output to # \ - A string specifying a filename to be opened spawn_opts_swallow(stdios::StdIOSet) = (stdios,) -spawn_opts_swallow(in::Redirectable=DevNull, out::Redirectable=DevNull, err::Redirectable=DevNull, args...) = +spawn_opts_swallow(in::Redirectable=DEVNULL, out::Redirectable=DEVNULL, err::Redirectable=DEVNULL, args...) = ((in, out, err), args...) spawn_opts_inherit(stdios::StdIOSet) = (stdios,) # pass original descriptors to child processes by default, because we might @@ -567,7 +567,7 @@ function eachline(cmd::AbstractCmd; chomp=nothing, keep::Bool=false) depwarn("The `chomp=$chomp` argument to `eachline` is deprecated in favor of `keep=$keep`.", :eachline) end stdout = Pipe() - processes = spawn(cmd, (DevNull,stdout,STDERR)) + processes = spawn(cmd, (DEVNULL,stdout,STDERR)) close(stdout.in) out = stdout.out # implicitly close after reading lines, since we opened @@ -577,7 +577,7 @@ end # return a Process object to read-to/write-from the pipeline """ - open(command, mode::AbstractString="r", stdio=DevNull) + open(command, mode::AbstractString="r", stdio=DEVNULL) Start running `command` asynchronously, and return a tuple `(stream,process)`. If `mode` is `"r"`, then `stream` reads from the process's standard output and `stdio` optionally @@ -585,9 +585,9 @@ specifies the process's standard input stream. If `mode` is `"w"`, then `stream the process's standard input and `stdio` optionally specifies the process's standard output stream. """ -function open(cmds::AbstractCmd, mode::AbstractString="r", other::Redirectable=DevNull) +function open(cmds::AbstractCmd, mode::AbstractString="r", other::Redirectable=DEVNULL) if mode == "r+" || mode == "w+" - other === DevNull || throw(ArgumentError("no other stream for mode rw+")) + other === DEVNULL || throw(ArgumentError("no other stream for mode rw+")) in = Pipe() out = Pipe() processes = spawn(cmds, (in,out,STDERR)) @@ -620,7 +620,7 @@ function open(cmds::AbstractCmd, mode::AbstractString="r", other::Redirectable=D end """ - open(f::Function, command, mode::AbstractString="r", stdio=DevNull) + open(f::Function, command, mode::AbstractString="r", stdio=DEVNULL) Similar to `open(command, mode, stdio)`, but calls `f(stream)` on the resulting process stream, then closes the input stream and waits for the process to complete. @@ -641,7 +641,7 @@ function open(f::Function, cmds::AbstractCmd, args...) end function read(cmd::AbstractCmd) - procs = open(cmd, "r", DevNull) + procs = open(cmd, "r", DEVNULL) bytes = read(procs.out) success(procs) || pipeline_error(procs) return bytes diff --git a/doc/src/base/base.md b/doc/src/base/base.md index bdb3264ba7d7f..eccd0d806cb71 100644 --- a/doc/src/base/base.md +++ b/doc/src/base/base.md @@ -230,7 +230,7 @@ Base.skipmissing ```@docs Base.run Base.spawn -Base.DevNull +Base.DEVNULL Base.success Base.process_running Base.process_exited diff --git a/examples/embedding/embedding-test.jl b/examples/embedding/embedding-test.jl index 7b991c51f9349..5043f9963e954 100644 --- a/examples/embedding/embedding-test.jl +++ b/examples/embedding/embedding-test.jl @@ -12,7 +12,7 @@ end @testset "embedding example" begin stdout = Pipe() stderr = Pipe() - p = spawn(pipeline(Cmd(ARGS), stdin=DevNull, stdout=stdout, stderr=stderr)) + p = spawn(pipeline(Cmd(ARGS), stdin=DEVNULL, stdout=stdout, stderr=stderr)) close(stdout.in) close(stderr.in) stdout_task = @async readlines(stdout) diff --git a/stdlib/InteractiveUtils/src/InteractiveUtils.jl b/stdlib/InteractiveUtils/src/InteractiveUtils.jl index aceebe84bac7a..472f79bc41607 100644 --- a/stdlib/InteractiveUtils/src/InteractiveUtils.jl +++ b/stdlib/InteractiveUtils/src/InteractiveUtils.jl @@ -67,7 +67,7 @@ function versioninfo(io::IO=STDOUT; verbose::Bool=false, packages::Bool=false) if verbose lsb = "" if Sys.islinux() - try lsb = readchomp(pipeline(`lsb_release -ds`, stderr=DevNull)) end + try lsb = readchomp(pipeline(`lsb_release -ds`, stderr=DEVNULL)) end end if Sys.iswindows() try lsb = strip(read(`$(ENV["COMSPEC"]) /c ver`, String)) end diff --git a/stdlib/LibGit2/test/libgit2.jl b/stdlib/LibGit2/test/libgit2.jl index 3ba30964f1ee2..e6ff1c7685186 100644 --- a/stdlib/LibGit2/test/libgit2.jl +++ b/stdlib/LibGit2/test/libgit2.jl @@ -2691,7 +2691,7 @@ mktempdir() do dir pem = joinpath(root, common_name * ".pem") # Generated a certificate which has the CN set correctly but no subjectAltName - run(pipeline(`openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout $key -out $cert -days 1 -subj "/CN=$common_name"`, stderr=DevNull)) + run(pipeline(`openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout $key -out $cert -days 1 -subj "/CN=$common_name"`, stderr=DEVNULL)) run(`openssl x509 -in $cert -out $pem -outform PEM`) # Find an available port by listening diff --git a/stdlib/Logging/test/runtests.jl b/stdlib/Logging/test/runtests.jl index 8419527be6c53..a655d6d1ac3fc 100644 --- a/stdlib/Logging/test/runtests.jl +++ b/stdlib/Logging/test/runtests.jl @@ -8,11 +8,11 @@ import Logging: min_enabled_level, shouldlog, handle_message @testset "ConsoleLogger" begin # First pass log limiting - @test min_enabled_level(ConsoleLogger(DevNull, Logging.Debug)) == Logging.Debug - @test min_enabled_level(ConsoleLogger(DevNull, Logging.Error)) == Logging.Error + @test min_enabled_level(ConsoleLogger(DEVNULL, Logging.Debug)) == Logging.Debug + @test min_enabled_level(ConsoleLogger(DEVNULL, Logging.Error)) == Logging.Error # Second pass log limiting - logger = ConsoleLogger(DevNull) + logger = ConsoleLogger(DEVNULL) @test shouldlog(logger, Logging.Info, Base, :group, :asdf) === true handle_message(logger, Logging.Info, "msg", Base, :group, :asdf, "somefile", 1, maxlog=2) @test shouldlog(logger, Logging.Info, Base, :group, :asdf) === true diff --git a/stdlib/Test/test/runtests.jl b/stdlib/Test/test/runtests.jl index d6f0da9cf43f7..44cda1edd7f73 100644 --- a/stdlib/Test/test/runtests.jl +++ b/stdlib/Test/test/runtests.jl @@ -547,7 +547,7 @@ end @test_throws MethodError 1 end """) - local msg = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --color=no $f`), stderr=DevNull), String) + local msg = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --color=no $f`), stderr=DEVNULL), String) # NOTE: This test depends on the code generated by @testset getting compiled, # to get good backtraces. If it fails, check the implementation of `testset_beginend`. @test !contains(msg, "do_test(") @@ -594,7 +594,7 @@ let msg = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --co @test foo(zeros(2)) == 4 @test foo(fill(1., 4)) == 15 end - end'`), stderr=DevNull), String) + end'`), stderr=DEVNULL), String) @test contains(msg, """ Test Summary: | Pass Fail Total @@ -608,7 +608,7 @@ end # 20489 let msg = split(read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --color=no -e ' - Test.print_test_results(Test.DefaultTestSet(""))'`), stderr=DevNull), String), "\n")[1] + Test.print_test_results(Test.DefaultTestSet(""))'`), stderr=DEVNULL), String), "\n")[1] @test msg == rstrip(msg) end @@ -645,7 +645,7 @@ end end """) - local msg = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --color=no $f`), stderr=DevNull), String) + local msg = read(pipeline(ignorestatus(`$(Base.julia_cmd()) --startup-file=no --color=no $f`), stderr=DEVNULL), String) @test contains(msg, "at " * f * ":" * "3") @test contains(msg, "at " * f * ":" * "4") @test contains(msg, "at " * f * ":" * "5") @@ -656,7 +656,7 @@ end # issue #24919 @testset "≈ with atol" begin local cmd = `$(Base.julia_cmd()) --startup-file=no --color=no` - f(src) = read(pipeline(ignorestatus(`$cmd -e $src`), stderr=DevNull), String) + f(src) = read(pipeline(ignorestatus(`$cmd -e $src`), stderr=DEVNULL), String) msg = f(""" using Test diff --git a/test/ccall.jl b/test/ccall.jl index d30922a33dd64..e8999dc98a346 100644 --- a/test/ccall.jl +++ b/test/ccall.jl @@ -1248,8 +1248,8 @@ end @noinline f21104at(::Type{T}) where {T} = ccall(:fn, Cvoid, (Some{T},), Some(0)) @noinline f21104rt(::Type{T}) where {T} = ccall(:fn, Some{T}, ()) -@test code_llvm(DevNull, f21104at, (Type{Float64},)) === nothing -@test code_llvm(DevNull, f21104rt, (Type{Float64},)) === nothing +@test code_llvm(DEVNULL, f21104at, (Type{Float64},)) === nothing +@test code_llvm(DEVNULL, f21104rt, (Type{Float64},)) === nothing @test_throws(ErrorException("ccall: the type of argument 1 doesn't correspond to a C type"), f21104at(Float64)) @test_throws(ErrorException("ccall: return type doesn't correspond to a C type"), diff --git a/test/cmdlineargs.jl b/test/cmdlineargs.jl index 1c8d7fdfdac0a..8fb0ce894136d 100644 --- a/test/cmdlineargs.jl +++ b/test/cmdlineargs.jl @@ -436,11 +436,11 @@ let exename = `$(Base.julia_cmd()) --sysimage-native-code=yes` end # Make sure `julia --lisp` doesn't break -run(pipeline(DevNull, `$(joinpath(Sys.BINDIR, Base.julia_exename())) --lisp`, DevNull)) +run(pipeline(DEVNULL, `$(joinpath(Sys.BINDIR, Base.julia_exename())) --lisp`, DEVNULL)) # Test that `julia [some other option] --lisp` is disallowed -@test_throws ErrorException run(pipeline(DevNull, pipeline(`$(joinpath(Sys.BINDIR, - Base.julia_exename())) -Cnative --lisp`, stderr=DevNull), DevNull)) +@test_throws ErrorException run(pipeline(DEVNULL, pipeline(`$(joinpath(Sys.BINDIR, + Base.julia_exename())) -Cnative --lisp`, stderr=DEVNULL), DEVNULL)) # --sysimage-native-code={yes|no} let exename = `$(Base.julia_cmd()) --startup-file=no` diff --git a/test/compiler/compiler.jl b/test/compiler/compiler.jl index 4a398562a708a..bb454a88b6690 100644 --- a/test/compiler/compiler.jl +++ b/test/compiler/compiler.jl @@ -169,12 +169,12 @@ mutable struct A14009{T}; end A14009(a::T) where {T} = A14009{T}() f14009(a) = rand(Bool) ? f14009(A14009(a)) : a code_typed(f14009, (Int,)) -code_llvm(DevNull, f14009, (Int,)) +code_llvm(DEVNULL, f14009, (Int,)) mutable struct B14009{T}; end g14009(a) = g14009(B14009{a}) code_typed(g14009, (Type{Int},)) -code_llvm(DevNull, f14009, (Int,)) +code_llvm(DEVNULL, f14009, (Int,)) # issue #9232 @@ -188,7 +188,7 @@ result_type9232(::Type{T1}, ::Type{T2}) where {T1<:Number,T2<:Number} = arithtyp function g10878(x; kw...); end invoke_g10878() = invoke(g10878, Tuple{Any}, 1) code_typed(invoke_g10878, ()) -code_llvm(DevNull, invoke_g10878, ()) +code_llvm(DEVNULL, invoke_g10878, ()) # issue #10930 diff --git a/test/core.jl b/test/core.jl index 64b676f3bd44a..fd3f679670dba 100644 --- a/test/core.jl +++ b/test/core.jl @@ -4372,7 +4372,7 @@ end @test f16158("abc") == "abcaba" # LLVM verifier error for noreturn function -# the `code_llvm(DevNull, ...)` tests are only meaningful on debug build +# the `code_llvm(DEVNULL, ...)` tests are only meaningful on debug build # with verifier on (but should still pass on release build). module TestSSA16244 @@ -4388,7 +4388,7 @@ function f1(a) end b[1] end -code_llvm(DevNull, f1, Tuple{Bool}) +code_llvm(DEVNULL, f1, Tuple{Bool}) @test f1(true) == 2 @test_throws DivideError f1(false) @@ -4403,7 +4403,7 @@ function f2(a) end b[1] end -code_llvm(DevNull, f2, Tuple{Bool}) +code_llvm(DEVNULL, f2, Tuple{Bool}) @test f2(true) == 2 @test_throws ErrorException f2(false) @@ -4414,7 +4414,7 @@ function f3(a) end b[1] end -code_llvm(DevNull, f3, Tuple{Bool}) +code_llvm(DEVNULL, f3, Tuple{Bool}) @test f3(true) == 2 ex = try f3(false) @@ -4433,7 +4433,7 @@ function f4(a, p) end b[1] end -code_llvm(DevNull, f4, Tuple{Bool,Ptr{Cvoid}}) +code_llvm(DEVNULL, f4, Tuple{Bool,Ptr{Cvoid}}) @test f4(true, C_NULL) == 2 @test_throws UndefRefError f4(false, C_NULL) @@ -4445,7 +4445,7 @@ function f5(a) end b[1] end -code_llvm(DevNull, f5, Tuple{Bool}) +code_llvm(DEVNULL, f5, Tuple{Bool}) @test f5(true) == 2 @test f5(false) == 1 @@ -4456,7 +4456,7 @@ function f6(a) end b[1] end -code_llvm(DevNull, f6, Tuple{Bool}) +code_llvm(DEVNULL, f6, Tuple{Bool}) @test f6(true) == 2 @test f6(false) == 1 @@ -4469,7 +4469,7 @@ function f7(a) end b[1] end -code_llvm(DevNull, f7, Tuple{Bool}) +code_llvm(DEVNULL, f7, Tuple{Bool}) @test f7(true) == 2 @test_throws TypeError f7(false) @@ -4482,7 +4482,7 @@ function f8(a, c) end b[1] end -code_llvm(DevNull, f8, Tuple{Bool,Int}) +code_llvm(DEVNULL, f8, Tuple{Bool,Int}) @test f8(true, 1) == 2 @test_throws TypeError f8(false, 1) @@ -4496,7 +4496,7 @@ function f9(a) end b[1] end -code_llvm(DevNull, f9, Tuple{Bool}) +code_llvm(DEVNULL, f9, Tuple{Bool}) @test f9(true) == 2 ex = try f9(false) diff --git a/test/deprecation_exec.jl b/test/deprecation_exec.jl index 9cf9846aa398e..dbd52686e4af2 100644 --- a/test/deprecation_exec.jl +++ b/test/deprecation_exec.jl @@ -264,17 +264,17 @@ end @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest, :bar; kind=:info) +logging(DEVNULL, LogTest, :bar; kind=:info) @test all(contains.(sprint(LogTest.bar), ["WARNING: barwarn", "ERROR: \"barerror\""])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "WARNING: poohwarn", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest; kind=:info) +logging(DEVNULL, LogTest; kind=:info) @test all(contains.(sprint(LogTest.bar), ["WARNING: barwarn", "ERROR: \"barerror\""])) @test all(contains.(sprint(LogTest.pooh), ["WARNING: poohwarn", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull; kind=:info) +logging(DEVNULL; kind=:info) @test all(contains.(sprint(LogTest.bar), ["WARNING: barwarn", "ERROR: \"barerror\""])) @test all(contains.(sprint(LogTest.pooh), ["WARNING: poohwarn", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["WARNING: foowarn", "ERROR: \"fooerror\""])) @@ -285,17 +285,17 @@ logging(kind=:info) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest, :bar; kind=:warn) +logging(DEVNULL, LogTest, :bar; kind=:warn) @test all(contains.(sprint(LogTest.bar), ["INFO: barinfo", "ERROR: \"barerror\""])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "WARNING: poohwarn", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest; kind=:warn) +logging(DEVNULL, LogTest; kind=:warn) @test all(contains.(sprint(LogTest.bar), ["INFO: barinfo", "ERROR: \"barerror\""])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull; kind=:warn) +logging(DEVNULL; kind=:warn) @test all(contains.(sprint(LogTest.bar), ["INFO: barinfo", "ERROR: \"barerror\""])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "ERROR: \"fooerror\""])) @@ -306,17 +306,17 @@ logging(kind=:warn) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest, :bar; kind=:error) +logging(DEVNULL, LogTest, :bar; kind=:error) @test all(contains.(sprint(LogTest.bar), ["INFO: barinfo", "WARNING: barwarn"])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "WARNING: poohwarn", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest; kind=:error) +logging(DEVNULL, LogTest; kind=:error) @test all(contains.(sprint(LogTest.bar), ["INFO: barinfo", "WARNING: barwarn"])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "WARNING: poohwarn"])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull; kind=:error) +logging(DEVNULL; kind=:error) @test all(contains.(sprint(LogTest.bar), ["INFO: barinfo", "WARNING: barwarn"])) @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "WARNING: poohwarn"])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn"])) @@ -327,17 +327,17 @@ logging(kind=:error) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest, :bar) +logging(DEVNULL, LogTest, :bar) @test sprint(LogTest.bar) == "" @test all(contains.(sprint(LogTest.pooh), ["INFO: poohinfo", "WARNING: poohwarn", "ERROR: \"pooherror\""])) @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull, LogTest) +logging(DEVNULL, LogTest) @test sprint(LogTest.bar) == "" @test sprint(LogTest.pooh) == "" @test all(contains.(sprint(foo), ["INFO: fooinfo", "WARNING: foowarn", "ERROR: \"fooerror\""])) -logging(DevNull) +logging(DEVNULL) @test sprint(LogTest.bar) == "" @test sprint(LogTest.pooh) == "" @test sprint(foo) == "" diff --git a/test/llvmcall.jl b/test/llvmcall.jl index 7d30ff33645ac..224db71ec1998 100644 --- a/test/llvmcall.jl +++ b/test/llvmcall.jl @@ -189,7 +189,7 @@ if Base.libllvm_version >= v"3.6" # llvm 3.6 changed the syntax for a gep, so ju ret void""", Cvoid, Tuple{}) end - code_llvm(DevNull, foo, ()) + code_llvm(DEVNULL, foo, ()) else @info "Skipping gep parentage test on llvm < 3.6" end diff --git a/test/logging.jl b/test/logging.jl index 39ed5297ec324..8beba40a01374 100644 --- a/test/logging.jl +++ b/test/logging.jl @@ -221,11 +221,11 @@ end @testset "SimpleLogger" begin # Log level limiting - @test min_enabled_level(SimpleLogger(DevNull, Debug)) == Debug - @test min_enabled_level(SimpleLogger(DevNull, Error)) == Error + @test min_enabled_level(SimpleLogger(DEVNULL, Debug)) == Debug + @test min_enabled_level(SimpleLogger(DEVNULL, Error)) == Error # Log limiting - logger = SimpleLogger(DevNull) + logger = SimpleLogger(DEVNULL) @test shouldlog(logger, Info, Base, :group, :asdf) === true handle_message(logger, Info, "msg", Base, :group, :asdf, "somefile", 1, maxlog=2) @test shouldlog(logger, Info, Base, :group, :asdf) === true diff --git a/test/read.jl b/test/read.jl index 07bad4f50607b..76ca6def37c36 100644 --- a/test/read.jl +++ b/test/read.jl @@ -398,17 +398,17 @@ end test_read_nbyte() -# DevNull -@test !isreadable(DevNull) -@test iswritable(DevNull) -@test isopen(DevNull) -@test write(DevNull, 0xff) === 1 -@test write(DevNull, Int32(1234)) === 4 -@test_throws EOFError read(DevNull, UInt8) -@test close(DevNull) === nothing -@test flush(DevNull) === nothing -@test eof(DevNull) -@test print(DevNull, "go to /dev/null") === nothing +# DEVNULL +@test !isreadable(DEVNULL) +@test iswritable(DEVNULL) +@test isopen(DEVNULL) +@test write(DEVNULL, 0xff) === 1 +@test write(DEVNULL, Int32(1234)) === 4 +@test_throws EOFError read(DEVNULL, UInt8) +@test close(DEVNULL) === nothing +@test flush(DEVNULL) === nothing +@test eof(DEVNULL) +@test print(DEVNULL, "go to /dev/null") === nothing let s = "qwerty" diff --git a/test/spawn.jl b/test/spawn.jl index f893e88544deb..5b4094c8aabb4 100644 --- a/test/spawn.jl +++ b/test/spawn.jl @@ -55,12 +55,12 @@ out = read(`$echocmd hello` & `$echocmd world`, String) @test (run(`$printfcmd " \033[34m[stdio passthrough ok]\033[0m\n"`); true) # Test for SIGPIPE being treated as normal termination (throws an error if broken) -Sys.isunix() && run(pipeline(yescmd, `head`, DevNull)) +Sys.isunix() && run(pipeline(yescmd, `head`, DEVNULL)) let a, p a = Base.Condition() @schedule begin - p = spawn(pipeline(yescmd,DevNull)) + p = spawn(pipeline(yescmd,DEVNULL)) Base.notify(a,p) @test !success(p) end @@ -414,7 +414,7 @@ end @test Base.shell_split("\"\\\\\"") == ["\\"] # issue #13616 -@test_throws ErrorException collect(eachline(pipeline(`$catcmd _doesnt_exist__111_`, stderr=DevNull))) +@test_throws ErrorException collect(eachline(pipeline(`$catcmd _doesnt_exist__111_`, stderr=DEVNULL))) # make sure windows_verbatim strips quotes if Sys.iswindows() @@ -507,7 +507,7 @@ end #let stdout = Pipe(), stdin = Pipe() # Base.link_pipe(stdout, julia_only_read=true) # Base.link_pipe(stdin, julia_only_write=true) -# p = spawn(pipeline(catcmd, stdin=stdin, stdout=stdout, stderr=DevNull)) +# p = spawn(pipeline(catcmd, stdin=stdin, stdout=stdout, stderr=DEVNULL)) # @async begin # feed cat with 2 MB of data (zeros) # write(stdin, zeros(UInt8, 1048576 * 2)) # close(stdin)