Skip to content

Commit fc3c086

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

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,26 @@ 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

0 commit comments

Comments
 (0)