From e3dfc5ef8281725e5ef95a0e744129c62b7ed09d Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 5 Oct 2025 13:50:19 +0200 Subject: [PATCH] Add test for invalid block too --- util/ci/test.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/util/ci/test.sh b/util/ci/test.sh index 18455ee..8469ebf 100755 --- a/util/ci/test.sh +++ b/util/ci/test.sh @@ -13,7 +13,7 @@ encodepos () { echo "$(($1 + 0x1000 * $2 + 0x1000000 * $3))" } -# create map file with sql statements +# create map file using SQL statements writemap () { rm -rf $mapdir mkdir $mapdir @@ -42,6 +42,17 @@ checkmap () { echo "Passed." } +# check that invocation returned an error +checkerr () { + local r=0 + ./minetestmapper --noemptyimage -v -i ./testmap -o map.png "$@" || r=1 + if [ $r -eq 0 ]; then + echo "Did not return error!" + exit 1 + fi + echo "Passed." +} + # this is missing the indices and primary keys but that doesn't matter schema_old="CREATE TABLE blocks(pos INT, data BLOB);" schema_new="CREATE TABLE blocks(x INT, y INT, z INT, data BLOB);" @@ -114,3 +125,17 @@ mkdir $mapdir/players printf '%s\n' "name = cat" "position = (80,0,80)" >$mapdir/players/cat # we can't check that it actually worked, however checkmap 1 --drawplayers --zoom 4 + +msg "block error (wrong version)" +writemap " +$schema_new +INSERT INTO blocks VALUES (0, 0, 0, x'150000'); +" +checkerr + +msg "block error (invalid zstd)" +writemap " +$schema_new +INSERT INTO blocks VALUES (0, 0, 0, x'1d28b52ffd2001090000'); +" +checkerr