]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Allow running a single lua unit test 5972/head
authorGuillaume Outters <guillaume-installs@outters.eu>
Wed, 8 Apr 2026 13:48:21 +0000 (15:48 +0200)
committerGuillaume Outters <guillaume-installs@outters.eu>
Wed, 8 Apr 2026 14:16:46 +0000 (16:16 +0200)
If the env variable $TESTS is set, use it instead of *.lua as the glob for files to run.

test/rspamd_lua_test.c

index 2e5abe37c2404f42afa97936b31f170c067fcb36..86d1d4b78e480ea2ccec7e8d293a6779ef78d8c5 100644 (file)
@@ -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;