Skip to content

Commit ef7731e

Browse files
committed
tests: updated the test suite so that it can be run in parallel mode.
1 parent 97299ce commit ef7731e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ src/args.[ch]
4848
echo
4949
reindex
5050
go
51-
t/servroot/
51+
t/servroot*
5252
*.plist
5353
Makefile
5454
t/*.t_

t/004-require.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ hello, foo
8787
content_by_lua_block {
8888
ngx.print(package.cpath);
8989
}
90-
--- stream_response_like: ^[^;]+/servroot/html/\?.so$
90+
--- stream_response_like: ^[^;]+/servroot(_\d+)?/html/\?\.so$
9191
--- no_error_log
9292
[error]
9393

@@ -100,7 +100,7 @@ hello, foo
100100
content_by_lua_block {
101101
ngx.print(package.path)
102102
}
103-
--- stream_response_like: ^[^;]+/servroot/html/\?.lua;.+\.lua;$
103+
--- stream_response_like: ^[^;]+/servroot(_\d+)?/html/\?\.lua;(.+\.lua)?;*$
104104
--- no_error_log
105105
[error]
106106

@@ -113,7 +113,7 @@ hello, foo
113113
content_by_lua_block {
114114
ngx.print(package.cpath)
115115
}
116-
--- stream_response_like: ^[^;]+/servroot/html/\?.so;.+\.so;$
116+
--- stream_response_like: ^[^;]+/servroot(_\d+)?/html/\?\.so;(.+\.so)?;*$
117117
--- no_error_log
118118
[error]
119119

@@ -126,7 +126,7 @@ hello, foo
126126
content_by_lua_block {
127127
ngx.print(package.path);
128128
}
129-
--- stream_response_like: ^.+\.lua;[^;]+/servroot/html/\?.lua$
129+
--- stream_response_like: ^(.+\.lua)?;*?[^;]+/servroot(_\d+)?/html/\?\.lua$
130130
--- no_error_log
131131
[error]
132132

@@ -139,7 +139,7 @@ hello, foo
139139
content_by_lua_block {
140140
ngx.print(package.cpath);
141141
}
142-
--- stream_response_like: ^.+\.so;[^;]+/servroot/html/\?.so$
142+
--- stream_response_like: ^(.+\.so)?;*?[^;]+/servroot(_\d+)?/html/\?\.so$
143143
--- no_error_log
144144
[error]
145145

t/025-codecache.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ __DATA__
2626
--- stream_server_config2
2727
content_by_lua_block {
2828
-- os.execute("(echo HERE; pwd) > /dev/stderr")
29-
local f = assert(io.open("t/servroot/html/test.lua", "w"))
29+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/test.lua", "w"))
3030
f:write("ngx.say(101)")
3131
f:close()
3232
ngx.say("updated")
@@ -58,7 +58,7 @@ updated
5858
--- stream_server_config2
5959
content_by_lua_block {
6060
-- os.execute("(echo HERE; pwd) > /dev/stderr")
61-
local f = assert(io.open("t/servroot/html/test.lua", "w"))
61+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/test.lua", "w"))
6262
f:write("ngx.say(101)")
6363
f:close()
6464
ngx.say("updated")
@@ -88,7 +88,7 @@ updated
8888
--- stream_server_config2
8989
content_by_lua_block {
9090
-- os.execute("(echo HERE; pwd) > /dev/stderr")
91-
local f = assert(io.open("t/servroot/html/test.lua", "w"))
91+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/test.lua", "w"))
9292
f:write("ngx.say(101)")
9393
f:close()
9494
ngx.say("updated")
@@ -122,7 +122,7 @@ qr/\[alert\] \S+ stream lua_code_cache is off; this will hurt performance/
122122
--- stream_server_config2
123123
content_by_lua_block {
124124
-- os.execute("(echo HERE; pwd) > /dev/stderr")
125-
local f = assert(io.open("t/servroot/html/test.lua", "w"))
125+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/test.lua", "w"))
126126
f:write("ngx.say(101)")
127127
f:close()
128128
ngx.say("updated")
@@ -155,7 +155,7 @@ qr/\[alert\] \S+ stream lua_code_cache is off; this will hurt performance/
155155
--- stream_server_config2
156156
content_by_lua_block {
157157
-- os.execute("(echo HERE; pwd) > /dev/stderr")
158-
local f = assert(io.open("t/servroot/html/test.lua", "w"))
158+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/test.lua", "w"))
159159
f:write("ngx.say(101)")
160160
f:close()
161161
ngx.say("updated")
@@ -190,7 +190,7 @@ qr/\[alert\] \S+ stream lua_code_cache is off; this will hurt performance/
190190
--- stream_server_config2
191191
content_by_lua_block {
192192
-- os.execute("(echo HERE; pwd) > /dev/stderr")
193-
local f = assert(io.open("t/servroot/html/foo.lua", "w"))
193+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/foo.lua", "w"))
194194
f:write("module(..., package.seeall); ngx.say(102);")
195195
f:close()
196196
ngx.say("updated")
@@ -225,7 +225,7 @@ qr/\[alert\] \S+ stream lua_code_cache is off; this will hurt performance/
225225
--- stream_server_config2
226226
content_by_lua_block {
227227
-- os.execute("(echo HERE; pwd) > /dev/stderr")
228-
local f = assert(io.open("t/servroot/html/foo.lua", "w"))
228+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/foo.lua", "w"))
229229
f:write("module(..., package.seeall); ngx.say(102);")
230230
f:close()
231231
ngx.say("updated")

t/081-bytecode.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ __DATA__
2121
content_by_lua_block {
2222
local f = assert(loadstring("local a = a and a + 1 or 1 ngx.say('a = ', a)", "=code"))
2323
local bc = string.dump(f)
24-
local f = assert(io.open("t/servroot/html/a.luac", "w"))
24+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/a.luac", "w"))
2525
f:write(bc)
2626
f:close()
2727
}
@@ -39,7 +39,7 @@ a = 1
3939
content_by_lua_block {
4040
local f = assert(loadstring("local a = a and a + 1 or 1 ngx.say('a = ', a)", "=code"))
4141
local bc = string.dump(f, true)
42-
local f = assert(io.open("t/servroot/html/a.luac", "w"))
42+
local f = assert(io.open("$TEST_NGINX_SERVER_ROOT/html/a.luac", "w"))
4343
f:write(bc)
4444
f:close()
4545
}

t/109-timer-hup.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ __DATA__
4444
=== TEST 1: single timer
4545
--- stream_server_config
4646
content_by_lua_block {
47-
local f, err = io.open("t/servroot/logs/nginx.pid", "r")
47+
local f, err = io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r")
4848
if not f then
4949
ngx.say("failed to open nginx.pid: ", err)
5050
return
@@ -94,7 +94,7 @@ timer prematurely expired: true
9494
=== TEST 2: multiple timers
9595
--- stream_server_config
9696
content_by_lua_block {
97-
local f, err = io.open("t/servroot/logs/nginx.pid", "r")
97+
local f, err = io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r")
9898
if not f then
9999
ngx.say("failed to open nginx.pid: ", err)
100100
return
@@ -155,7 +155,7 @@ timer prematurely expired: true
155155
=== TEST 3: trying to add new timer after HUP reload
156156
--- stream_server_config
157157
content_by_lua_block {
158-
local f, err = io.open("t/servroot/logs/nginx.pid", "r")
158+
local f, err = io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r")
159159
if not f then
160160
ngx.say("failed to open nginx.pid: ", err)
161161
return
@@ -208,7 +208,7 @@ failed to register a new timer after reload: process exiting, context: ngx.timer
208208
=== TEST 4: trying to add new timer after HUP reload
209209
--- stream_server_config
210210
content_by_lua_block {
211-
local f, err = io.open("t/servroot/logs/nginx.pid", "r")
211+
local f, err = io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r")
212212
if not f then
213213
ngx.say("failed to open nginx.pid: ", err)
214214
return
@@ -270,7 +270,7 @@ g: exiting=true
270270
=== TEST 5: HUP reload should abort pending timers
271271
--- stream_server_config
272272
content_by_lua_block {
273-
local f, err = io.open("t/servroot/logs/nginx.pid", "r")
273+
local f, err = io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r")
274274
if not f then
275275
ngx.say("failed to open nginx.pid: ", err)
276276
return
@@ -383,7 +383,7 @@ TODO
383383
end
384384
local ok, err = ngx.timer.at(1, background_thread)
385385
386-
local f, err = io.open("t/servroot/logs/nginx.pid", "r")
386+
local f, err = io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r")
387387
if not f then
388388
ngx.say("failed to open nginx.pid: ", err)
389389
return
@@ -434,7 +434,7 @@ lua found 1 pending timers
434434
end
435435
436436
if kill then
437-
local f, err = assert(io.open("t/servroot/logs/nginx.pid", "r"))
437+
local f, err = assert(io.open("$TEST_NGINX_SERVER_ROOT/logs/nginx.pid", "r"))
438438
local pid = f:read()
439439
-- ngx.say("master pid: [", pid, "]")
440440
f:close()

0 commit comments

Comments
 (0)