Squashed 'src/deps/src/lua-ffi-zlib/' changes from 1fb69ca50..61e95cb43

61e95cb43 Version 0.6
bc8e1357c rocks: 0.6
de6269575 Merge pull request #9 from Kong/upstream
27ed800b0 Run tests in docker instead of building from scratch
77a88d3a2 Add test for github actions
0e78f77eb Fix shared library loading without dev packages on Linux

git-subtree-dir: src/deps/src/lua-ffi-zlib
git-subtree-split: 61e95cb434e4047c8bc65a180c293a05bf754416
This commit is contained in:
Théophile Diot 2023-09-15 14:09:02 +02:00
parent c46cd666ab
commit d7bde18da2
3 changed files with 89 additions and 2 deletions

57
.github/workflows/tests.yml vendored Normal file
View file

@ -0,0 +1,57 @@
name: Tests
on:
pull_request:
paths-ignore:
- '*.md'
push:
branches:
- master
- release/*
paths-ignore:
- '*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
container:
image: openresty/openresty:${{ matrix.openresty }}-jammy
strategy:
fail-fast: false
matrix:
openresty: ["1.19.9.1-14", "1.21.4.1-0"]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install valgrind
run: |
apt-get update
apt-get install -y valgrind
# ensure the library works even without dev packages installed (libz.so.1 instead of libz.so)
- name: Remove dev packages
run: |
apt-get purge -y libc-dev-bin
- name: Run test with LuaJIT
run: |
luajit test.lua /usr/local/openresty/nginx/sbin/nginx 65536000
- name: Run test with resty-cli
run: |
resty --no-stream test.lua /usr/local/openresty/nginx/sbin/nginx 65536000
- name: Run test with resty-cli (valgrind)
if: contains(matrix.extras, 'valgrind')
run: |
resty --no-stream --valgrind test.lua /usr/local/openresty/nginx/sbin/nginx 65536000

View file

@ -6,7 +6,7 @@ local ffi_copy = ffi.copy
local tonumber = tonumber
local _M = {
_VERSION = '0.5.0',
_VERSION = '0.6.0',
}
local mt = { __index = _M }
@ -95,7 +95,17 @@ unsigned long crc32_combine(unsigned long, unsigned long, long);
]])
local zlib = ffi.load(ffi.os == "Windows" and "zlib1" or "z")
local zlib
if ffi.os == "Windows" then
zlib = ffi.load("zlib1")
elseif ffi.os == "OSX" then
zlib = ffi.load("z")
elseif ffi.os == "Linux" then
zlib = ffi.load("libz.so.1")
else
error("lua-ffi-zlib doesn't support platform: " .. ffi.os)
end
_M.zlib = zlib
-- Default to 16k output buffer

View file

@ -0,0 +1,20 @@
package = "lua-ffi-zlib"
version = "0.6-0"
source = {
url = "git://github.com/hamishforbes/lua-ffi-zlib",
tag = "v0.6"
}
description = {
summary = "A Lua module using LuaJIT's FFI feature to access zlib.",
homepage = "https://github.com/hamishforbes/lua-ffi-zlib",
maintainer = "Hamish Forbes"
}
dependencies = {
"lua >= 5.1",
}
build = {
type = "builtin",
modules = {
["ffi-zlib"] = "lib/ffi-zlib.lua",
}
}