Skip to content

Commit

Permalink
tests(*) unload provider to make valgrind happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Jul 23, 2024
1 parent 7669555 commit 1f7d7b3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
35 changes: 30 additions & 5 deletions t/openssl/pkcs12.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ __DATA__
--- config
location =/t {
content_by_lua_block {
local p
if require("resty.openssl.version").OPENSSL_3X then
local pro = require "resty.openssl.provider"
myassert(pro.load("legacy"))
p = myassert(pro.load("legacy"))
end
local pkcs12 = require "resty.openssl.pkcs12"
Expand All @@ -42,6 +43,10 @@ __DATA__
ngx.say(r.key:get_parameters().d:to_hex())
ngx.say(r.cert:get_serial_number():to_hex())
if p then
myassert(p:unload())
end
}
}
--- request
Expand All @@ -59,9 +64,10 @@ __DATA__
--- config
location =/t {
content_by_lua_block {
local p
if require("resty.openssl.version").OPENSSL_3X then
local pro = require "resty.openssl.provider"
myassert(pro.load("legacy"))
p = myassert(pro.load("legacy"))
end
local pkcs12 = require "resty.openssl.pkcs12"
Expand All @@ -75,6 +81,10 @@ __DATA__
local r, err = pkcs12.decode(pp)
ngx.say(r == nil)
ngx.say(err)
if p then
myassert(p:unload())
end
}
}
--- request
Expand All @@ -95,9 +105,10 @@ pkcs12.decode.+mac verify failure.*
--- config
location =/t {
content_by_lua_block {
local p
if require("resty.openssl.version").OPENSSL_3X then
local pro = require "resty.openssl.provider"
myassert(pro.load("legacy"))
p = myassert(pro.load("legacy"))
end
local pkcs12 = require "resty.openssl.pkcs12"
Expand Down Expand Up @@ -133,6 +144,10 @@ pkcs12.decode.+mac verify failure.*
cert = cert,
}))
ngx.say(#r)
if p then
myassert(p:unload())
end
}
}
--- request
Expand All @@ -153,9 +168,10 @@ pkcs12.decode.+mac verify failure.*
--- config
location =/t {
content_by_lua_block {
local p
if require("resty.openssl.version").OPENSSL_3X then
local pro = require "resty.openssl.provider"
myassert(pro.load("legacy"))
p = myassert(pro.load("legacy"))
end
local pkcs12 = require "resty.openssl.pkcs12"
Expand Down Expand Up @@ -183,6 +199,10 @@ pkcs12.decode.+mac verify failure.*
local r, err = pkcs12.decode(p12, "extrapassword")
ngx.say(r == nil)
ngx.say(err)
if p then
myassert(p:unload())
end
}
}
--- request
Expand All @@ -205,9 +225,10 @@ pkcs12.decode.+mac verify failure.*
--- config
location =/t {
content_by_lua_block {
local p
if require("resty.openssl.version").OPENSSL_3X then
local pro = require "resty.openssl.provider"
myassert(pro.load("legacy"))
p = myassert(pro.load("legacy"))
end
local pkcs12 = require "resty.openssl.pkcs12"
Expand All @@ -221,6 +242,10 @@ pkcs12.decode.+mac verify failure.*
cacerts = { ca1, ca2 }
}, "test-pkcs12")
ngx.say(r == nil, err)
if p then
myassert(p:unload())
end
}
}
--- request
Expand Down
1 change: 1 addition & 0 deletions t/openssl/provider.t
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ true
local p = myassert(pro.load("default"))
local a = assert(p:get_params("name", "version", "buildinfo", "status"))
ngx.say(encode_sorted_json(a))
myassert(p:unload())
}
}
--- request
Expand Down

0 comments on commit 1f7d7b3

Please sign in to comment.