From b411724abfa051993e76a302e73a24ff440ff409 Mon Sep 17 00:00:00 2001 From: Hessam Mehr Date: Fri, 16 Oct 2015 23:09:52 -0400 Subject: [PATCH] Unit test for #13559. Uses the qualified path to launch julia (cherry picked from commit 0a79189a1ea287586056dbafe55859bbe0a7ac97) --- test/file.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/file.jl b/test/file.jl index ed3a385229bbd..d359eb7ace627 100644 --- a/test/file.jl +++ b/test/file.jl @@ -922,3 +922,25 @@ test_12992() test2_12992() test2_12992() test2_12992() + +# issue 13559 + +function test_13559() + fn = tempname() + run(`mkfifo $fn`) + # use subprocess to write 127 bytes to FIFO + writer_cmds = "x=open(\"$fn\", \"w\"); for i=1:127 write(x,0xaa); flush(x); sleep(0.1) end; close(x); quit()" + open(`$(Base.julia_cmd()) -e $writer_cmds`) + #quickly read FIFO, draining it and blocking but not failing with EOFError yet + r = open(fn, "r") + # 15 proper reads + for i=1:15 + @test read(r, Int64) == -6148914691236517206 + end + # last read should throw EOFError when FIFO closes, since there are only 7 bytes available. + @test_throws EOFError read(r, Int64) + close(r) + rm(fn) +end + +@unix_only test_13559()