This commits enables tests for all the www-nginx packages. Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com> --- www-nginx/ngx-echo/ngx-echo-0.63.ebuild | 9 +- .../ngx-encrypted-session-0.09.ebuild | 8 +- .../ngx-eval/ngx-eval-0_p20240817.ebuild | 24 ++- .../ngx-headers-more-0.37.ebuild | 12 +- .../ngx-iconv-0.14-skip-rds-json-tests.patch | 30 ++++ www-nginx/ngx-iconv/ngx-iconv-0.14.ebuild | 15 +- ...lua-upstream-0.07-skip-invalid-tests.patch | 26 ++++ .../ngx-lua-upstream-0.07.ebuild | 11 +- ...0.20-stats_t-do-not-run-timeout-test.patch | 31 ++++ www-nginx/ngx-memc/ngx-memc-0.20.ebuild | 30 +++- ...isc-0.33-skip-hashed-upstream_t-test.patch | 31 ++++ .../ngx-set-misc/ngx-set-misc-0.33.ebuild | 8 +- ...x-srcache-0.33-disable-invalid-tests.patch | 147 ++++++++++++++++++ www-nginx/ngx-srcache/ngx-srcache-0.33.ebuild | 35 ++++- www-nginx/ngx-xss/ngx-xss-0.06.ebuild | 8 +- 15 files changed, 410 insertions(+), 15 deletions(-) create mode 100644 www-nginx/ngx-iconv/files/ngx-iconv-0.14-skip-rds-json-tests.patch create mode 100644 www-nginx/ngx-lua-upstream/files/ngx-lua-upstream-0.07-skip-invalid-tests.patch create mode 100644 www-nginx/ngx-memc/files/ngx-memc-0.20-stats_t-do-not-run-timeout-test.patch create mode 100644 www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-skip-hashed-upstream_t-test.patch create mode 100644 www-nginx/ngx-srcache/files/ngx-srcache-0.33-disable-invalid-tests.patch
diff --git a/www-nginx/ngx-echo/ngx-echo-0.63.ebuild b/www-nginx/ngx-echo/ngx-echo-0.63.ebuild index 92c51003ab4d..a70da8450b25 100644 --- a/www-nginx/ngx-echo/ngx-echo-0.63.ebuild +++ b/www-nginx/ngx-echo/ngx-echo-0.63.ebuild @@ -5,6 +5,12 @@ EAPI=8 MY_PN="echo-nginx-module" NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" + +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-lua-module + www-nginx/ngx-xss +) inherit nginx-module DESCRIPTION='An NGINX module bringing the power of "echo", "sleep", "time" and more to NGINX' @@ -16,4 +22,5 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" +# Tests require NGINX to be built with debugging log enabled. +BDEPEND="test? ( www-servers/nginx[debug(-)] )" diff --git a/www-nginx/ngx-encrypted-session/ngx-encrypted-session-0.09.ebuild b/www-nginx/ngx-encrypted-session/ngx-encrypted-session-0.09.ebuild index 04d5614696b4..5538ded752bb 100644 --- a/www-nginx/ngx-encrypted-session/ngx-encrypted-session-0.09.ebuild +++ b/www-nginx/ngx-encrypted-session/ngx-encrypted-session-0.09.ebuild @@ -8,6 +8,12 @@ NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" NGINX_MOD_LINK_MODULES=( www-nginx/ngx_devel_kit ) +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-set-misc + www-nginx/ngx-echo + www-nginx/ngx-lua-module +) inherit toolchain-funcs nginx-module DESCRIPTION="An NGINX module that encrypts and decrypts NGINX variable values" @@ -19,8 +25,6 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" - BDEPEND="virtual/pkgconfig" DEPEND="dev-libs/openssl:=" RDEPEND="${DEPEND}" diff --git a/www-nginx/ngx-eval/ngx-eval-0_p20240817.ebuild b/www-nginx/ngx-eval/ngx-eval-0_p20240817.ebuild index 7a0e3097b3d5..fcfbec277d7b 100644 --- a/www-nginx/ngx-eval/ngx-eval-0_p20240817.ebuild +++ b/www-nginx/ngx-eval/ngx-eval-0_p20240817.ebuild @@ -7,6 +7,11 @@ MY_COMMIT="13425e897c19f4f4436c5ca4414dddd37fc65190" MY_P="nginx-eval-module-${MY_COMMIT}" NGINX_MOD_S="${WORKDIR}/${MY_P}" +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-memc + www-nginx/ngx-echo +) inherit nginx-module DESCRIPTION="An NGINX module that stores subrequest response bodies into variables" @@ -18,4 +23,21 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" +BDEPEND="test? ( net-misc/memcached )" + +src_test() { + # Start memcached in background on a port 11211, the default port if + # environment variable TEST_NGINX_MEMCACHED_PORT is not set. + # memcached is enclosed in braces so that the not operator properly applies + # to the asynchronous invocation of memcached. + if ! { memcached -p 11211 & } + then + die "memcached failed" + fi + # Save the PID of the launched memcached instance. + local memcached_pid=$! + + nginx-module_src_test + + kill "${memcached_pid}" || die "kill failed" +} diff --git a/www-nginx/ngx-headers-more/ngx-headers-more-0.37.ebuild b/www-nginx/ngx-headers-more/ngx-headers-more-0.37.ebuild index 606446a9641e..7084022222fe 100644 --- a/www-nginx/ngx-headers-more/ngx-headers-more-0.37.ebuild +++ b/www-nginx/ngx-headers-more/ngx-headers-more-0.37.ebuild @@ -5,6 +5,15 @@ EAPI=8 MY_PN="headers-more-nginx-module" NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" + +NGINX_MOD_OPENRESTY_TESTS=1 +# ngx-headers-more must be loaded after ngx-lua-module module for test to work. +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-lua-module + www-nginx/ngx-headers-more + www-nginx/ngx-eval + www-nginx/ngx-echo +) inherit nginx-module DESCRIPTION="Set, add, and clear arbitrary output headers in NGINX HTTP servers" @@ -16,4 +25,5 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" +# Tests require NGINX to be built with debugging log enabled. +BDEPEND="test? ( www-servers/nginx[debug(-)] )" diff --git a/www-nginx/ngx-iconv/files/ngx-iconv-0.14-skip-rds-json-tests.patch b/www-nginx/ngx-iconv/files/ngx-iconv-0.14-skip-rds-json-tests.patch new file mode 100644 index 000000000000..6194ed8608e1 --- /dev/null +++ b/www-nginx/ngx-iconv/files/ngx-iconv-0.14-skip-rds-json-tests.patch @@ -0,0 +1,30 @@ +From f9adf29df987a0c2d067e43fc4a6b43aabb42f26 Mon Sep 17 00:00:00 2001 +From: Zurab Kvachadze <zurabid2...@gmail.com> +Date: Thu, 13 Feb 2025 19:52:15 +0100 +Subject: [PATCH] bugs.t: skip test relying on rds_json + +libdrizzle, a dependency of rds-json-nginx-module, is not packaged by +Gentoo. + +This commit skips the test relying on rds-json-nginx-module. + +Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com> +--- + t/bugs.t | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/t/bugs.t b/t/bugs.t +index 8d05e43..82f846e 100644 +--- a/t/bugs.t ++++ b/t/bugs.t +@@ -16,6 +16,7 @@ run_tests(); + __DATA__ + + === TEST 1: used with rds_json ++--- SKIP + --- config + location /foo { + rds_json_ret 100 '你好'; +-- +2.45.3 + diff --git a/www-nginx/ngx-iconv/ngx-iconv-0.14.ebuild b/www-nginx/ngx-iconv/ngx-iconv-0.14.ebuild index 1d6a393bfeaf..fb53ca545aff 100644 --- a/www-nginx/ngx-iconv/ngx-iconv-0.14.ebuild +++ b/www-nginx/ngx-iconv/ngx-iconv-0.14.ebuild @@ -8,6 +8,15 @@ NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" NGINX_MOD_LINK_MODULES=( www-nginx/ngx_devel_kit ) +NGINX_MOD_OPENRESTY_TESTS=1 +# ngx-iconv must be loaded after ngx-lua-module. +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-lua-module + www-nginx/ngx-iconv + www-nginx/ngx-echo + www-nginx/ngx-set-misc + www-nginx/ngx-headers-more +) inherit nginx-module DESCRIPTION="A character conversion NGINX module using libiconv" @@ -19,7 +28,9 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" - DEPEND="virtual/libiconv" RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}/${PN}-0.14-skip-rds-json-tests.patch" +) diff --git a/www-nginx/ngx-lua-upstream/files/ngx-lua-upstream-0.07-skip-invalid-tests.patch b/www-nginx/ngx-lua-upstream/files/ngx-lua-upstream-0.07-skip-invalid-tests.patch new file mode 100644 index 000000000000..cba15cfbc7a9 --- /dev/null +++ b/www-nginx/ngx-lua-upstream/files/ngx-lua-upstream-0.07-skip-invalid-tests.patch @@ -0,0 +1,26 @@ +From 9d8b6160d92a2899e28d4a610a884d160e4a1f38 Mon Sep 17 00:00:00 2001 +From: Zurab Kvachadze <zurabid2...@gmail.com> +Date: Sat, 15 Feb 2025 17:58:35 +0100 +Subject: [PATCH] Skip invalid tests + +Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com> +--- + t/sanity.t | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/t/sanity.t b/t/sanity.t +index b913f21..f2b22b2 100644 +--- a/t/sanity.t ++++ b/t/sanity.t +@@ -1,6 +1,7 @@ + # vim:set ft= ts=4 sw=4 et fdm=marker: + +-use Test::Nginx::Socket::Lua; ++use Test::Nginx::Socket::Lua skip_all => ++ 'uses arbitrary hostname with no corresponding server directive'; + + #worker_connections(1014); + #master_on(); +-- +2.45.3 + diff --git a/www-nginx/ngx-lua-upstream/ngx-lua-upstream-0.07.ebuild b/www-nginx/ngx-lua-upstream/ngx-lua-upstream-0.07.ebuild index 5fd8aa16dac1..fb98e9684e78 100644 --- a/www-nginx/ngx-lua-upstream/ngx-lua-upstream-0.07.ebuild +++ b/www-nginx/ngx-lua-upstream/ngx-lua-upstream-0.07.ebuild @@ -11,6 +11,11 @@ NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" NGINX_MOD_LINK_MODULES=( www-nginx/ngx-lua-module ) +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-lua-module + www-nginx/ngx-echo +) inherit flag-o-matic lua-single nginx-module DESCRIPTION="An NGINX C module exposing ngx-lua-module's Lua APIs for NGINX upstreams" @@ -24,12 +29,14 @@ SLOT="0" REQUIRED_USE="${LUA_REQUIRED_USE}" -RESTRICT="test" - BDEPEND="virtual/pkgconfig" DEPEND="${LUA_DEPS}" RDEPEND="${DEPEND}" +PATCHES=( + "${FILESDIR}/${PN}-0.07-skip-invalid-tests.patch" +) + src_configure() { ngx_mod_append_libs "$(lua_get_LIBS)" append-cflags "$(lua_get_CFLAGS)" diff --git a/www-nginx/ngx-memc/files/ngx-memc-0.20-stats_t-do-not-run-timeout-test.patch b/www-nginx/ngx-memc/files/ngx-memc-0.20-stats_t-do-not-run-timeout-test.patch new file mode 100644 index 000000000000..2c783e9b0c6d --- /dev/null +++ b/www-nginx/ngx-memc/files/ngx-memc-0.20-stats_t-do-not-run-timeout-test.patch @@ -0,0 +1,31 @@ +From 8ff96cb366e1ed0a78533501b33ca29c378ca808 Mon Sep 17 00:00:00 2001 +From: Zurab Kvachadze <zurabid2...@gmail.com> +Date: Tue, 11 Feb 2025 15:35:40 +0100 +Subject: [PATCH] t/stats.t: skip broken test + +The CI utilises iptables to drop connections on hardcoded port 12345. +The drop behaviour is required by the "timeout" test. Since tests are +run unprivileged in Gentoo, iptables can not be used and the test fails. + +This commit skips the "timeout" test. + +Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com> +--- + t/stats.t | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/t/stats.t b/t/stats.t +index f412b42..39bc3dd 100644 +--- a/t/stats.t ++++ b/t/stats.t +@@ -30,6 +30,7 @@ __DATA__ + + + === TEST 2: timeout ++--- SKIP + --- config + memc_connect_timeout 10ms; + memc_send_timeout 10ms; +-- +2.45.3 + diff --git a/www-nginx/ngx-memc/ngx-memc-0.20.ebuild b/www-nginx/ngx-memc/ngx-memc-0.20.ebuild index ab186f0f0df4..2c61469c427c 100644 --- a/www-nginx/ngx-memc/ngx-memc-0.20.ebuild +++ b/www-nginx/ngx-memc/ngx-memc-0.20.ebuild @@ -6,6 +6,13 @@ EAPI=8 MY_PN="memc-nginx-module" NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-lua-module + www-nginx/ngx-eval + www-nginx/ngx-echo + www-nginx/ngx-set-misc +) inherit nginx-module DESCRIPTION="An extended version of the standard NGINX memcached module" @@ -17,4 +24,25 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" +BDEPEND="test? ( net-misc/memcached )" + +PATCHES=( + "${FILESDIR}/${PN}-0.20-stats_t-do-not-run-timeout-test.patch" +) + +src_test() { + # Start memcached in background on a port 11211, the default port if + # environment variable TEST_NGINX_MEMCACHED_PORT is not set. + # memcached is enclosed in braces so that the not operator properly applies + # to the asynchronous invocation of memcached. + if ! { memcached -p 11211 & } + then + die "memcached failed" + fi + # Save the PID of the launched memcached instance. + local memcached_pid=$! + + nginx-module_src_test + + kill "${memcached_pid}" || die "killing memcached failed" +} diff --git a/www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-skip-hashed-upstream_t-test.patch b/www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-skip-hashed-upstream_t-test.patch new file mode 100644 index 000000000000..812ddbb20f5d --- /dev/null +++ b/www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-skip-hashed-upstream_t-test.patch @@ -0,0 +1,31 @@ +From 25337a9db440d2afb406a78b113e9a8ea0f3fcde Mon Sep 17 00:00:00 2001 +From: Zurab Kvachadze <zurabid2...@gmail.com> +Date: Thu, 13 Feb 2025 19:43:54 +0100 +Subject: [PATCH] hashed-upstream.t: skip the test + +The "hashed-upstream.t" test utilises the upstream_list command. I do +not know which module provides this command and so far I have been +unsuccessful to find anything online. + +Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com> +--- + t/hashed-upstream.t | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/t/hashed-upstream.t b/t/hashed-upstream.t +index fdebd15..6e3a912 100644 +--- a/t/hashed-upstream.t ++++ b/t/hashed-upstream.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'not working at all'; + + #repeat_each(3); + +-- +2.45.3 + diff --git a/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild b/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild index c71366126ffe..2ee48f716938 100644 --- a/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild +++ b/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild @@ -8,6 +8,11 @@ NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" NGINX_MOD_LINK_MODULES=( www-nginx/ngx_devel_kit ) +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-echo + www-nginx/ngx-iconv +) inherit toolchain-funcs nginx-module DESCRIPTION="An NGINX module that adds various set_xxx directives to NGINX's rewrite module" @@ -21,14 +26,13 @@ SLOT="0" IUSE="+hmac" -RESTRICT="test" - BDEPEND="virtual/pkgconfig" DEPEND="hmac? ( dev-libs/openssl:= )" RDEPEND="${DEPEND}" PATCHES=( "${FILESDIR}/${PN}-0.33-hmac-configurable.patch" + "${FILESDIR}/${PN}-0.33-skip-hashed-upstream_t-test.patch" ) src_configure() { diff --git a/www-nginx/ngx-srcache/files/ngx-srcache-0.33-disable-invalid-tests.patch b/www-nginx/ngx-srcache/files/ngx-srcache-0.33-disable-invalid-tests.patch new file mode 100644 index 000000000000..f3db3c1637fc --- /dev/null +++ b/www-nginx/ngx-srcache/files/ngx-srcache-0.33-disable-invalid-tests.patch @@ -0,0 +1,147 @@ +From e69195edbb7c38135743c4a0c19a6d78d0e7467a Mon Sep 17 00:00:00 2001 +From: Zurab Kvachadze <zurabid2...@gmail.com> +Date: Thu, 13 Feb 2025 21:41:35 +0100 +Subject: [PATCH] t: Disable invalid tests + +Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com> +--- + t/000_init.t | 3 ++- + t/conditional-get.t | 3 ++- + t/drizzle-main.t | 3 ++- + t/eval.t | 3 ++- + t/methods.t | 3 ++- + t/postgres-main.t | 3 ++- + t/proxy.t | 3 ++- + t/redis.t | 3 ++- + t/timeout.t | 3 ++- + 9 files changed, 18 insertions(+), 9 deletions(-) + +diff --git a/t/000_init.t b/t/000_init.t +index b611e6c..06663e6 100644 +--- a/t/000_init.t ++++ b/t/000_init.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'Gentoo does not package neither ngx_postgres nor drizzle'; + + repeat_each(1); + +diff --git a/t/conditional-get.t b/t/conditional-get.t +index b652ee6..82daf84 100644 +--- a/t/conditional-get.t ++++ b/t/conditional-get.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'uses arbitrary hostname as proxy_pass'; + + #repeat_each(100); + +diff --git a/t/drizzle-main.t b/t/drizzle-main.t +index 5ff11eb..150ce52 100644 +--- a/t/drizzle-main.t ++++ b/t/drizzle-main.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'drizzle is not packaged by Gentoo'; + + #repeat_each(100); + +diff --git a/t/eval.t b/t/eval.t +index c109463..bda4dc9 100644 +--- a/t/eval.t ++++ b/t/eval.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'Gentoo does not package drizzle'; + + repeat_each(3); + +diff --git a/t/methods.t b/t/methods.t +index 9a57b38..f48e37d 100644 +--- a/t/methods.t ++++ b/t/methods.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'uses arbitrary hostname as proxy_pass'; + + #repeat_each(2); + +diff --git a/t/postgres-main.t b/t/postgres-main.t +index ccc00c4..b1e53ea 100644 +--- a/t/postgres-main.t ++++ b/t/postgres-main.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'ngx_postgres is not packaged by Gentoo'; + + #repeat_each(100); + +diff --git a/t/proxy.t b/t/proxy.t +index f3e6a31..9eb8678 100644 +--- a/t/proxy.t ++++ b/t/proxy.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'Gentoo does not package drizzle'; + + #repeat_each(100); + +diff --git a/t/redis.t b/t/redis.t +index 8af2ff0..ff10a5c 100644 +--- a/t/redis.t ++++ b/t/redis.t +@@ -1,7 +1,8 @@ + # vi:ft= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'relies on horribly outdated Redis 2.x'; + + #repeat_each(2); + +diff --git a/t/timeout.t b/t/timeout.t +index 9357658..b9a8827 100644 +--- a/t/timeout.t ++++ b/t/timeout.t +@@ -1,7 +1,8 @@ + # vi:filetype= + + use lib 'lib'; +-use Test::Nginx::Socket; ++use Test::Nginx::Socket skip_all => ++ 'uses arbitrary hostname as proxy_pass'; + + repeat_each(2); + +-- +2.45.3 + diff --git a/www-nginx/ngx-srcache/ngx-srcache-0.33.ebuild b/www-nginx/ngx-srcache/ngx-srcache-0.33.ebuild index cabc43d06fb8..4c2d85d661db 100644 --- a/www-nginx/ngx-srcache/ngx-srcache-0.33.ebuild +++ b/www-nginx/ngx-srcache/ngx-srcache-0.33.ebuild @@ -6,6 +6,17 @@ EAPI=8 MY_PN="srcache-nginx-module" NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" +NGINX_MOD_OPENRESTY_TESTS=1 +# ngx-srcache must be after ngx-xss, but before ngx-lua-module. The former might +# be due to the fact that both ngx-xss and ngx-srcache are filters. As for the +# latter, I just don't know. +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-xss + www-nginx/ngx-srcache + www-nginx/ngx-lua-module + www-nginx/ngx-echo + www-nginx/ngx-memc +) inherit nginx-module DESCRIPTION="An NGINX module enabling transparent subrequest-based caching" @@ -17,4 +28,26 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" +# Tests require NGINX to be built with debugging log enabled. +BDEPEND="test? ( www-servers/nginx[debug(-)] )" + +PATCHES=( + "${FILESDIR}/${PN}-0.33-disable-invalid-tests.patch" +) + +src_test() { + # Start memcached in background on a port 11211, the default port if + # environment variable TEST_NGINX_MEMCACHED_PORT is not set. + # memcached is enclosed in braces so that the not operator properly applies + # to the asynchronous invocation of memcached. + if ! { memcached -p 11211 & } + then + die "memcached failed" + fi + # Save the PID of the launched memcached instance. + local memcached_pid=$! + + nginx-module_src_test + + kill "${memcached_pid}" || die "killing memcached failed" +} diff --git a/www-nginx/ngx-xss/ngx-xss-0.06.ebuild b/www-nginx/ngx-xss/ngx-xss-0.06.ebuild index b190db7280f6..e73f6c7f51d4 100644 --- a/www-nginx/ngx-xss/ngx-xss-0.06.ebuild +++ b/www-nginx/ngx-xss/ngx-xss-0.06.ebuild @@ -6,6 +6,12 @@ EAPI=8 MY_PN="xss-nginx-module" NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}" +# Strangely, 10-year-old tests work perfectly. +NGINX_MOD_OPENRESTY_TESTS=1 +NGINX_MOD_TEST_LOAD_ORDER=( + www-nginx/ngx-lua-module + www-nginx/ngx-echo +) inherit nginx-module DESCRIPTION="Native support for cross-site scripting (XSS) in NGINX" @@ -17,8 +23,6 @@ SRC_URI=" LICENSE="BSD-2" SLOT="0" -RESTRICT="test" - PATCHES=( "${FILESDIR}/${PN}-0.06-add-dynamic-build-support.patch" ) -- 2.45.3