Make the CI test a bit more complex so we actually get some stack traceback

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2024-09-23 22:55:33 +02:00
parent 31d0684912
commit 9de2bbdad4
4 changed files with 17 additions and 7 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
<?
mg.write("Hello, world!\n")
mg.include("does_not_exist.lp", "r")
?>
mg.write("Hello, world 1!\n")
mg.include("broken_lua_2.lp", "r")
?>
+4
View File
@@ -0,0 +1,4 @@
<?
mg.write("Hello, world 2!\n")
mg.include("does_not_exist.lp", "r")
?>
+1
View File
@@ -64,6 +64,7 @@ cp test/versions /etc/pihole/versions
# Prepare Lua test script
cp test/broken_lua.lp /var/www/html/broken_lua.lp
cp test/broken_lua_2.lp /var/www/html/broken_lua_2.lp
# Prepare local powerDNS resolver
bash test/pdns/setup.sh
+9 -4
View File
@@ -1689,12 +1689,17 @@
# Run a page with a syntax error
run bash -c 'curl -s 127.0.0.1/broken_lua'
printf "%s\n" "${lines[@]}"
[[ ${lines[0]} == 'Hello, world!' ]]
[[ ${lines[1]} == '[string "/var/www/html/broken_lua.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' ]]
[[ ${lines[2]} == '' ]]
[[ ${lines[0]} == 'Hello, world 1!' ]]
[[ ${lines[1]} == 'Hello, world 2!' ]]
[[ ${lines[2]} == '[string "/var/www/html/broken_lua_2.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' ]]
[[ ${lines[3]} == 'stack traceback:' ]]
[[ ${lines[4]} == " [C]: in field 'include'" ]]
[[ ${lines[5]} == ' [string "/var/www/html/broken_lua.lp"]:4: in main chunk' ]]
[[ ${lines[6]} == 'aborting' ]]
[[ ${lines[7]} == '' ]]
# Check if the error is logged (-F = fixed string (no regex), -q = quiet)
run grep -qF 'LSP Kepler: call failed: runtime error: [string "/var/www/html/broken_lua.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' /var/log/pihole/webserver.log
run grep -qF 'LSP Kepler: call failed: runtime error: [string "/var/www/html/broken_lua_2.lp"]:4: Cannot include [/var/www/html/does_not_exist.lp]: not found' /var/log/pihole/webserver.log
[[ $status == 0 ]]
}