-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
What kind of io
is allowed for Pkg.test
?
#3430
Comments
Being able to run two Pkg commands with an |
This is an issue with one package command, |
For example: (@v1.9) pkg> generate TestPkg
Generating project TestPkg:
TestPkg/Project.toml
TestPkg/src/TestPkg.jl
shell> cd TestPkg
/Users/eph/TestPkg
(@v1.9) pkg> activate .
Activating project at `~/TestPkg`
julia> io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)
julia> using Pkg
shell> mkdir test
shell> touch test/runtests.jl
julia> io = IOBuffer()
IOBuffer(data=UInt8[...], readable=true, writable=true, seekable=true, append=false, size=0, maxsize=Inf, ptr=1, mark=-1)
julia> Pkg.test(; io)
Precompiling environment...
1 dependency successfully precompiled in 0 seconds
ERROR: ArgumentError: ensureroom failed, IOBuffer is not writeable
Stacktrace:
[1] ensureroom_slowpath(io::IOBuffer, nshort::UInt64)
@ Base ./iobuffer.jl:303
[2] ensureroom
@ ./iobuffer.jl:325 [inlined]
[3] unsafe_write(to::IOBuffer, p::Ptr{UInt8}, nb::UInt64)
@ Base ./iobuffer.jl:424
[4] write
@ ./strings/io.jl:244 [inlined]
[5] print
@ ./strings/io.jl:246 [inlined]
[6] with_output_color(f::Function, color::Symbol, io::IOBuffer, args::String; bold::Bool, underline::Bool, blink::Bool, reverse::Bool, hidden::Bool)
@ Base ./util.jl:80
[7] #printstyled#963
@ ./util.jl:130 [inlined]
[8] printpkgstyle(io::IOBuffer, cmd::Symbol, text::String, ignore_indent::Bool; color::Symbol)
@ Pkg ~/.julia/juliaup/julia-1.9.0-beta4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.9/Pkg/src/utils.jl:5
... |
I guess we have to make a new |
That sounds like it would work to me (though I can't find any docs to say if |
Yeah, the follow-up question is indeed why |
If you have a test environment that hasn't been precompiled, then as of #3281, running
Pkg.test(; io)
will call two commands likewith the same
IO
object. This doesn't work well for a lot of common IO objects likeIOBuffer
,Base.BufferStream
,Base.PipeBuffer
, etc, since they will haveeof(stream) == true
after the first command finishes, and some of them will error on the second command.What happens for these IO types?
For
IOBuffer
andBase.PipeBuffer
, this will showFor
Base.BufferStream
, it will "seem" to work, but you get strange behavior if you test it like this:since it shows
eof(io) == true
but then still displays"bye\n"
later.However
devnull
andstdout
work fine, which my guess is what was tested here. So is there a particular restriction on what kinds of IO are allowed? Or is the change in #3281 a regression?The context for me is I wrote some code to try to parse Pkg.jl test results "live" during GitHub Actions CI runs to re-emit test failures as logs which can then show up as annotations in GitHub PRs. It's actually fairly handy when it works (annotations only show up in-line on the diff, so you have to have changed those tests), but this was broken by #3281: julia-actions/julia-runtest#76.
The text was updated successfully, but these errors were encountered: