Skip to content

Commit e0c8f90

Browse files
committed
tests: added a test case for interrupted file I/O during readall.
1 parent b055efb commit e0c8f90

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ install:
4444
- git clone https://github.com/openresty/nginx-devel-utils.git
4545
- git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module
4646
- git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx
47-
- git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git
47+
- git clone -b fix/eintr https://github.com/thibaultcha/luajit2.git
4848

4949
script:
5050
- cd luajit2/

t/resty/sanity.t

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,36 @@ hello
7171
world
7272
--- err
7373
--- ret: 0
74+
75+
76+
77+
=== TEST 6: catch interrupted fread during file readall (GH issue #35)
78+
--- src
79+
local ffi = require "ffi"
80+
81+
ffi.cdef [[
82+
int getpid(void);
83+
]]
84+
85+
local pid = ffi.C.getpid()
86+
87+
local signal = 17
88+
local platform = assert(io.popen("uname"):read("*l"))
89+
if platform == "Darwin" then
90+
signal = 0
91+
end
92+
93+
local cmd = string.format("kill -%d %d && sleep 0.1", signal, pid)
94+
assert(io.popen(cmd):read("*a"))
95+
--- err
96+
--- ret: 0
97+
98+
99+
100+
=== TEST 7: file readall returns syscall errno when not EINTR (GH issue #35)
101+
--- src
102+
local f = assert(io.open("/"))
103+
assert(f:read("*a"))
104+
--- err_like chomp
105+
^ERROR:.*?\.lua:2: Is a directory$
106+
--- ret: 1

0 commit comments

Comments
 (0)