[Tarantool-patches] [PATCH luajit] test: adjust lua-Harness test error assertion

Igor Munkin imun at tarantool.org
Tue Dec 19 19:27:06 MSK 2023


The current pattern in 303-package.t for the test case loading invalid
Lua script is too tight for the following reasons revealed by Tarantool
testing:
* The platform might prepend the common prefix to all Lua errors, so
  anchoring the pattern to the beginning of the error message is too
  strict for matching the particular errors.
* The platform might canonicalize module names (i.e., use absolute
  paths) for searchers and loaders, so matching the current working
  directory via "./" is too straight-forward.

Hence, this patch removes the starting anchor from the pattern and fixes
the last part of it to match only the "basename" of the module being
loaded. As a result, the check is not too strict and Lua-specific but
rather starts following common sense.

Signed-off-by: Igor Munkin <imun at tarantool.org>
---

Branch: https://github.com/tarantool/luajit/tree/imun/fix-test-for-tarantool-searchers
PR: https://github.com/tarantool/tarantool/pull/9511

Integration CI is red due to exercises with automatic submodule bumps.
Testing in PR represents the integration part.

 test/lua-Harness-tests/303-package.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/lua-Harness-tests/303-package.t b/test/lua-Harness-tests/303-package.t
index ccd7c510..b5b3d9ea 100755
--- a/test/lua-Harness-tests/303-package.t
+++ b/test/lua-Harness-tests/303-package.t
@@ -199,7 +199,7 @@ return complex
     f:write [[?syntax error?]]
     f:close()
     error_matches(function () require('syntax') end,
-            "^error loading module 'syntax' from file '%.[/\\]syntax%.lua':",
+            "error loading module 'syntax' from file '.+[/\\]syntax%.lua':",
             "function require (syntax error)")
     os.remove('syntax.lua') -- clean up
 
-- 
2.39.2



More information about the Tarantool-patches mailing list