Skip to content

Commit

Permalink
Unit test for #13559.
Browse files Browse the repository at this point in the history
Uses the qualified path to launch julia

(cherry picked from commit 0a79189)
  • Loading branch information
hessammehr authored and tkelman committed Nov 29, 2015
1 parent 8662eec commit b411724
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit b411724

Please sign in to comment.