From: Guillaume Outters Date: Wed, 8 Apr 2026 13:48:21 +0000 (+0200) Subject: [Test] Allow running a single lua unit test X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=cb2886796fbb216e46a52b4f30e1ee3b4dcbbbdd;p=thirdparty%2Frspamd.git [Test] Allow running a single lua unit test If the env variable $TESTS is set, use it instead of *.lua as the glob for files to run. --- diff --git a/test/rspamd_lua_test.c b/test/rspamd_lua_test.c index 2e5abe37c2..86d1d4b78e 100644 --- a/test/rspamd_lua_test.c +++ b/test/rspamd_lua_test.c @@ -100,10 +100,14 @@ rspamd_lua_test_func(void) lua_newtable(L); + const char *tests_glob = "*.lua"; + if (getenv("TESTS")) { + tests_glob = getenv("TESTS"); + } globbuf.gl_offs = 0; - len = strlen(dir) + sizeof("/unit/") + sizeof("*.lua"); + len = strlen(dir) + sizeof("/unit/") + strlen(tests_glob); pattern = g_malloc(len); - rspamd_snprintf(pattern, len, "%s/unit/%s", dir, "*.lua"); + rspamd_snprintf(pattern, len, "%s/unit/%s", dir, tests_glob); int lua_test_len = 0; int inserted_file = 1;