Skip to content

Commit 8c9cfa9

Browse files
committed
Merge remote-tracking branch 'openresty/master' into lua-ffi-api-sslctx
2 parents eae3453 + b46a48f commit 8c9cfa9

22 files changed

+332
-329
lines changed

.luacheckrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
std = 'ngx_lua'
22
unused_args = false
3+
read_globals = {
4+
"coroutine._yield"
5+
}

t/count.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ my $pwd = cwd();
1515

1616
our $HttpConfig = <<_EOC_;
1717
lua_package_path "$pwd/lib/?.lua;../lua-resty-lrucache/lib/?.lua;;";
18-
init_by_lua '
18+
init_by_lua_block {
1919
-- local verbose = true
2020
local verbose = false
2121
local outfile = "$Test::Nginx::Util::ErrLogFile"
@@ -32,7 +32,7 @@ our $HttpConfig = <<_EOC_;
3232
-- jit.opt.start("hotloop=1")
3333
-- jit.opt.start("loopunroll=1000000")
3434
-- jit.off()
35-
';
35+
}
3636
_EOC_
3737

3838
#no_diff();
@@ -46,14 +46,14 @@ __DATA__
4646
--- config
4747
location = /re {
4848
access_log off;
49-
content_by_lua '
49+
content_by_lua_block {
5050
local base = require "resty.core.base"
5151
local n = 0
5252
for _, _ in pairs(base) do
5353
n = n + 1
5454
end
5555
ngx.say("base size: ", n)
56-
';
56+
}
5757
}
5858
--- request
5959
GET /re

t/ctx.t

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ my $pwd = cwd();
1616

1717
our $HttpConfig = <<_EOC_;
1818
lua_package_path "$pwd/lib/?.lua;\$prefix/html/?.lua;../lua-resty-lrucache/lib/?.lua;;";
19-
init_by_lua '
19+
init_by_lua_block {
2020
local verbose = false
2121
if verbose then
2222
local dump = require "jit.dump"
@@ -28,7 +28,7 @@ our $HttpConfig = <<_EOC_;
2828
2929
require "resty.core"
3030
-- jit.off()
31-
';
31+
}
3232
_EOC_
3333
3434
#no_diff();
@@ -42,12 +42,12 @@ __DATA__
4242
--- http_config eval: $::HttpConfig
4343
--- config
4444
location = /t {
45-
content_by_lua '
45+
content_by_lua_block {
4646
for i = 1, 100 do
4747
ngx.ctx.foo = i
4848
end
4949
ngx.say("ctx.foo = ", ngx.ctx.foo)
50-
';
50+
}
5151
}
5252
--- request
5353
GET /t
@@ -66,12 +66,12 @@ qr/\[TRACE\s+\d+\s+content_by_lua\(nginx\.conf:\d+\):2 loop\]/
6666
--- http_config eval: $::HttpConfig
6767
--- config
6868
location = /t {
69-
content_by_lua '
69+
content_by_lua_block {
7070
for i = 1, 100 do
7171
ngx.ctx = {foo = i}
7272
end
7373
ngx.say("ctx.foo = ", ngx.ctx.foo)
74-
';
74+
}
7575
}
7676
--- request
7777
GET /t

t/decode-base64.t

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ my $pwd = cwd();
1515

1616
our $HttpConfig = <<_EOC_;
1717
lua_package_path "$pwd/lib/?.lua;../lua-resty-lrucache/lib/?.lua;;";
18-
init_by_lua '
18+
init_by_lua_block {
1919
local verbose = false
2020
if verbose then
2121
local dump = require "jit.dump"
@@ -27,7 +27,7 @@ our $HttpConfig = <<_EOC_;
2727
2828
require "resty.core"
2929
-- jit.off()
30-
';
30+
}
3131
_EOC_
3232
3333
#no_diff();
@@ -41,13 +41,13 @@ __DATA__
4141
--- http_config eval: $::HttpConfig
4242
--- config
4343
location = /base64 {
44-
content_by_lua '
44+
content_by_lua_block {
4545
local s
4646
for i = 1, 100 do
4747
s = ngx.decode_base64("aGVsbG8=")
4848
end
4949
ngx.say(s)
50-
';
50+
}
5151
}
5252
--- request
5353
GET /base64
@@ -65,13 +65,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
6565
--- http_config eval: $::HttpConfig
6666
--- config
6767
location = /base64 {
68-
content_by_lua '
68+
content_by_lua_block {
6969
local s
7070
for i = 1, 100 do
7171
s = ngx.decode_base64("")
7272
end
7373
ngx.say(s)
74-
';
74+
}
7575
}
7676
--- request
7777
GET /base64
@@ -88,13 +88,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
8888
--- http_config eval: $::HttpConfig
8989
--- config
9090
location = /base64 {
91-
content_by_lua '
91+
content_by_lua_block {
9292
local s
9393
for i = 1, 100 do
9494
s = ngx.decode_base64("My4xNA==")
9595
end
9696
ngx.say(s)
97-
';
97+
}
9898
}
9999
--- request
100100
GET /base64
@@ -112,13 +112,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
112112
--- http_config eval: $::HttpConfig
113113
--- config
114114
location = /base64 {
115-
content_by_lua '
115+
content_by_lua_block {
116116
local s
117117
for i = 1, 100 do
118118
s = ngx.decode_base64("dHJ1ZQ==")
119119
end
120120
ngx.say(s)
121-
';
121+
}
122122
}
123123
--- request
124124
GET /base64
@@ -136,7 +136,7 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
136136
--- http_config eval: $::HttpConfig
137137
--- config
138138
location = /base64 {
139-
content_by_lua '
139+
content_by_lua_block {
140140
local s
141141
for i = 1, 100 do
142142
s = ngx.decode_base64(string.rep("a", 5460))
@@ -146,7 +146,7 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
146146
else
147147
ngx.say(string.len(s))
148148
end
149-
';
149+
}
150150
}
151151
--- request
152152
GET /base64
@@ -164,7 +164,7 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
164164
--- http_config eval: $::HttpConfig
165165
--- config
166166
location = /base64 {
167-
content_by_lua '
167+
content_by_lua_block {
168168
local s
169169
for i = 1, 100 do
170170
s = ngx.decode_base64(string.rep("a", 5462))
@@ -174,7 +174,7 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
174174
else
175175
ngx.say(string.len(s))
176176
end
177-
';
177+
}
178178
}
179179
--- request
180180
GET /base64

t/encode-base64.t

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ my $pwd = cwd();
1515

1616
our $HttpConfig = <<_EOC_;
1717
lua_package_path "$pwd/lib/?.lua;../lua-resty-lrucache/lib/?.lua;;";
18-
init_by_lua '
18+
init_by_lua_block {
1919
local verbose = false
2020
if verbose then
2121
local dump = require "jit.dump"
@@ -27,7 +27,7 @@ our $HttpConfig = <<_EOC_;
2727
2828
require "resty.core"
2929
-- jit.off()
30-
';
30+
}
3131
_EOC_
3232
3333
#no_diff();
@@ -41,13 +41,13 @@ __DATA__
4141
--- http_config eval: $::HttpConfig
4242
--- config
4343
location = /base64 {
44-
content_by_lua '
44+
content_by_lua_block {
4545
local s
4646
for i = 1, 100 do
4747
s = ngx.encode_base64("hello")
4848
end
4949
ngx.say(s)
50-
';
50+
}
5151
}
5252
--- request
5353
GET /base64
@@ -65,13 +65,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
6565
--- http_config eval: $::HttpConfig
6666
--- config
6767
location = /base64 {
68-
content_by_lua '
68+
content_by_lua_block {
6969
local s
7070
for i = 1, 100 do
7171
s = ngx.encode_base64(nil)
7272
end
7373
ngx.say(s)
74-
';
74+
}
7575
}
7676
--- request
7777
GET /base64
@@ -88,13 +88,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
8888
--- http_config eval: $::HttpConfig
8989
--- config
9090
location = /base64 {
91-
content_by_lua '
91+
content_by_lua_block {
9292
local s
9393
for i = 1, 100 do
9494
s = ngx.encode_base64(3.14)
9595
end
9696
ngx.say(s)
97-
';
97+
}
9898
}
9999
--- request
100100
GET /base64
@@ -112,13 +112,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
112112
--- http_config eval: $::HttpConfig
113113
--- config
114114
location = /base64 {
115-
content_by_lua '
115+
content_by_lua_block {
116116
local s
117117
for i = 1, 100 do
118118
s = ngx.encode_base64(true)
119119
end
120120
ngx.say(s)
121-
';
121+
}
122122
}
123123
--- request
124124
GET /base64
@@ -136,13 +136,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
136136
--- http_config eval: $::HttpConfig
137137
--- config
138138
location = /base64 {
139-
content_by_lua '
139+
content_by_lua_block {
140140
local s
141141
for i = 1, 100 do
142142
s = ngx.encode_base64(string.rep("a", 3073))
143143
end
144144
ngx.say(string.len(s))
145-
';
145+
}
146146
}
147147
--- request
148148
GET /base64
@@ -160,13 +160,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
160160
--- http_config eval: $::HttpConfig
161161
--- config
162162
location = /base64 {
163-
content_by_lua '
163+
content_by_lua_block {
164164
local s
165165
for i = 1, 100 do
166166
s = ngx.encode_base64(string.rep("a", 3071))
167167
end
168168
ngx.say(string.len(s))
169-
';
169+
}
170170
}
171171
--- request
172172
GET /base64
@@ -184,13 +184,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
184184
--- http_config eval: $::HttpConfig
185185
--- config
186186
location = /base64 {
187-
content_by_lua '
187+
content_by_lua_block {
188188
local s
189189
for i = 1, 200 do
190190
s = ngx.encode_base64(3.14, true)
191191
end
192192
ngx.say(s)
193-
';
193+
}
194194
}
195195
--- request
196196
GET /base64
@@ -208,13 +208,13 @@ qr/\[TRACE \d+ content_by_lua\(nginx\.conf:\d+\):3 loop\]/
208208
--- http_config eval: $::HttpConfig
209209
--- config
210210
location = /base64 {
211-
content_by_lua '
211+
content_by_lua_block {
212212
local s
213213
for i = 1, 200 do
214214
s = ngx.encode_base64(3.14, false)
215215
end
216216
ngx.say(s)
217-
';
217+
}
218218
}
219219
--- request
220220
GET /base64

t/exit.t

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ my $pwd = cwd();
1616

1717
our $HttpConfig = <<_EOC_;
1818
lua_package_path "$pwd/lib/?.lua;\$prefix/html/?.lua;../lua-resty-lrucache/lib/?.lua;;";
19-
init_by_lua '
19+
init_by_lua_block {
2020
local verbose = false
2121
if verbose then
2222
local dump = require "jit.dump"
@@ -28,7 +28,7 @@ our $HttpConfig = <<_EOC_;
2828
2929
require "resty.core"
3030
-- jit.off()
31-
';
31+
}
3232
_EOC_
3333

3434
#no_diff();
@@ -41,9 +41,9 @@ __DATA__
4141
--- http_config eval: $::HttpConfig
4242
--- config
4343
location = /t {
44-
content_by_lua '
44+
content_by_lua_block {
4545
ngx.exit(403)
46-
';
46+
}
4747
}
4848
--- request
4949
GET /t
@@ -60,10 +60,10 @@ qr/ -- NYI: (?!FastFunc coroutine.yield)/,
6060
--- http_config eval: $::HttpConfig
6161
--- config
6262
location = /t {
63-
content_by_lua '
63+
content_by_lua_block {
6464
local foo = require "foo"
6565
foo.go()
66-
';
66+
}
6767
}
6868
--- user_files
6969
>>> foo.lua

0 commit comments

Comments
 (0)