Squashed 'src/deps/src/lua-resty-lrucache/' changes from a79615ec9d..1293147608

1293147608 bumped version to 0.14.
ca26f4d4e8 tests: update valgrind.supress.
82b5ab467a doc: fixed typo.
c49701fe8f optimize: echo warning message when install this library to "/usr/local/lib/lua/" and copy installation guide from lua_resty_core module. (#62)
99e7578465 tests: update nginx to 1.25.3.
52f5d00403 tests: upgrade nginx to 1.25.1.
274244e0d7 tests: fixed test failures caused by using non-perlbrew cpanm in travis.

git-subtree-dir: src/deps/src/lua-resty-lrucache
git-subtree-split: 1293147608c9dfb0ee163e39a4c8997476e8f741
This commit is contained in:
Théophile Diot 2024-08-08 18:58:03 +01:00
parent c82b0bdd27
commit 0014d9625f
5 changed files with 56 additions and 9 deletions

View file

@ -1,7 +1,12 @@
# vim:st=2 sts=2 sw=2 et:
# vim: ts=2 sw=2 et:
os: linux
dist: bionic
branches:
only:
- "master"
sudo: false
language: c
@ -18,13 +23,13 @@ env:
- TEST_NGINX_SLEEP=0.006
- TEST_NGINX_RANDOMIZE=1
matrix:
- NGINX_VERSION=1.19.9
- NGINX_VERSION=1.27.0
install:
- export NGX_BUILD_CC=$CC
- export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH
- sudo apt-get install -qq -y cpanminus axel
- sudo cpanm --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1)
- sudo apt-get install -qq -y axel
- cpanm --sudo --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1)
- git clone https://github.com/openresty/openresty.git ../openresty
- git clone https://github.com/openresty/nginx-devel-utils.git
- git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module

View file

@ -5,6 +5,8 @@ LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
INSTALL ?= install
SHELL:=/bin/bash
.PHONY: all test install lint
all: ;
@ -13,6 +15,13 @@ install: all
$(INSTALL) -d $(DESTDIR)/$(LUA_LIB_DIR)/resty/lrucache
$(INSTALL) lib/resty/*.lua $(DESTDIR)/$(LUA_LIB_DIR)/resty/
$(INSTALL) lib/resty/lrucache/*.lua $(DESTDIR)/$(LUA_LIB_DIR)/resty/lrucache/
ifeq ($(LUA_LIB_DIR),/usr/local/lib/lua/)
@echo
@echo -e "\033[33mPLEASE NOTE: \033[0m"
@echo -e "\033[33mThe necessary lua_package_path directive needs to be added to nginx.conf\033[0m"
@echo -e "\033[33min the http context, because \"/usr/local/lib/lua/\" is not in LuaJITs default search path.\033[0m"
@echo -e "\033[33mRefer to the Installation section of README.markdown.\033[0m"
endif
test: all lint
PATH=$(OPENRESTY_PREFIX)/nginx/sbin:$$PATH prove -I../test-nginx/lib -r t

View file

@ -291,8 +291,31 @@ LuaJIT when building OpenResty by passing the `--with-luajit` option to its
`./configure` script. No extra Nginx configuration is required.
If you want to use this library with your own Nginx build (with ngx_lua), then
you need to ensure you are using ngx_lua 0.8.10 or greater. When not using an
OpenResty release, you also need to configure the
you need to ensure you are using ngx_lua 0.8.10 or greater.
By default, ngx_lua will search Lua files in /usr/local/share/lua/5.1/.
But `make install` will install this module to /usr/local/lib/lua.
So you may find the error like this:
```text
nginx: [alert] failed to load the 'resty.lrucache' module
```
You can install this module with the following command to resolve the above problem.
```bash
cd lua-resty-lrucache
sudo make install LUA_LIB_DIR=/usr/local/share/lua/5.1
```
You can also change the installation directory to any other directory you like with the LUA_LIB_DIR argument.
```bash
cd lua-resty-lrucache
sudo make install LUA_LIB_DIR=/opt/nginx/lualib
```
When not installed in /usr/local/share/lua/5.1, you also need to configure the
[lua_package_path](https://github.com/openresty/lua-nginx-module#lua_package_path)
directive to add the path to your lua-resty-lrucache source tree to ngx_lua's
Lua module search path, as in:
@ -301,8 +324,7 @@ Lua module search path, as in:
# nginx.conf
http {
# only if not using an official OpenResty release
lua_package_path "/path/to/lua-resty-lrucache/lib/?.lua;;";
lua_package_path "/opt/nginx/lualib/?.lua;;";
...
}
```

View file

@ -141,7 +141,7 @@ end
-- true module stuffs
local _M = {
_VERSION = '0.13'
_VERSION = '0.14'
}
local mt = { __index = _M }

View file

@ -68,3 +68,14 @@
fun:ngx_worker_process_init
fun:ngx_worker_process_cycle
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:ngx_alloc
fun:ngx_set_environment
fun:ngx_http_lua_post_init_handler
fun:ngx_cycle_post_init
fun:main
}