postgis.git / summary / log / commit / refs
commit ba3c19f9e35d16e5a20954a4e63d6e50bb145f0f
Author: Sandro Santilli <strk@kbt.io>
Date: Tue Aug 26 09:55:00 2025 +0000
Have downgrades be also tested with standard conforming strings off
Confirms bug #5977
utils/check_all_downgrades.sh | 112 ++++++------------------------------------
1 file changed, 15 insertions(+), 97 deletions(-)
diff --git a/utils/check_all_downgrades.sh b/utils/check_all_downgrades.sh
index b5a766e2a..a437cace5 100755
--- a/utils/check_all_downgrades.sh
+++ b/utils/check_all_downgrades.sh
@@ -15,6 +15,8 @@ cd $(dirname $0)/..
SRCDIR=$PWD # TODO: allow override ?
cd - > /dev/null
+MAKE_ARGS="TESTS=${SRCDIR}/regress/core/regress.sql"
+
# This is useful to run database queries
export PGDATABASE=template1
@@ -161,41 +163,29 @@ is_downgrade()
return 0
}
-check_path()
+check_downgrade()
{
RUNTESTFLAGS="-v --extension --upgrade-path=${UPGRADE_PATH} ${USERTESTFLAGS}" \
${MAKE} -C ${REGDIR} check ${MAKE_ARGS} > ${TMPDIR}/log 2>&1
if test $? = 0; then
- echo "FAIL: ${test_label} did not error out"
- cat ${TMPDIR}/log
+ echo "FAIL: ${test_label} did not error out:"
+ tail ${TMPDIR}/log
failed
else
ERR=$( grep 'Downgrade .* forbidden' ${TMPDIR}/log )
test -n "$ERR" && {
echo "PASS: ${test_label} gave $ERR"
} || {
- echo "FAIL: ${test_label} gave some other error"
- cat ${TMPDIR}/log
+ echo "FAIL: ${test_label} gave some other error:"
+ tail ${TMPDIR}/log
failed
}
fi
}
-report_missing_versions()
-{
- if test -n "${MISSING_EXT_UPGRADES}"; then
- echo "INFO: missing downgrade scripts: ${MISSING_EXT_UPGRADES}"
- echo "HINT: use 'postgis install-extension-upgrades' to install them"
- fi
- cleanup
-}
-
-
to_version=$to_version_param
if expr $to_version : ':auto' >/dev/null; then
to_version=`psql -XAtc "select default_version from pg_available_extensions where name = 'postgis'"` || exit 1
- MISSING_EXT_UPGRADES=
- trap report_missing_versions EXIT
elif expr $to_version : '.*!$' >/dev/null; then
to_version=$(echo "${to_version}" | sed 's/\!$//')
fi
@@ -223,14 +213,6 @@ echo "INFO: installed extensions: $INSTALLED_EXTENSIONS"
USERTESTFLAGS=${RUNTESTFLAGS}
-# Make use of all public functions defined by source version
-# and use double-upgrade
-USERTESTFLAGS="\
- ${USERTESTFLAGS} \
- --before-upgrade-script ${SRCDIR}/regress/hooks/use-all-functions.sql \
- --after-upgrade-script ${SRCDIR}/regress/hooks/hook-after-upgrade.sql \
-"
-
for EXT in ${INSTALLED_EXTENSIONS}; do #{
if test "${EXT}" = "postgis"; then
REGDIR=${BUILDDIR}/regress
@@ -244,7 +226,7 @@ for EXT in ${INSTALLED_EXTENSIONS}; do #{
echo "SKIP: don't know where to find regress tests for extension ${EXT}"
fi
- # Check extension->extension upgrades
+ # Check extension->extension downgrades
files=`'ls' ${EXT}--* | grep -v -- '--.*--' | sed "s/^${EXT}--\(.*\)\.sql/\1/"`
for fname in $files; do
from_version="$fname"
@@ -267,84 +249,20 @@ for EXT in ${INSTALLED_EXTENSIONS}; do #{
" ) || exit 1
if test -z "${path}"; then
echo "SKIP: ${test_label} (no downgrade path from ${from_version} to ${to_version} known by postgresql)"
- MISSING_EXT_UPGRADES="${from_version} ${MISSING_EXT_UPGRADES}"
continue
fi
echo "Testing ${test_label}"
- check_path
- done
+ check_downgrade
- if ! kept_label "unpackaged"; then
- echo "SKIP: ${EXT} script-based upgrades (disabled by commandline)"
- continue;
- fi
-
- # Check unpackaged->extension upgrades
- for majmin in `'ls' -d ${CTBDIR}/postgis-* | sed 's/.*postgis-//'`; do
- UPGRADE_PATH="unpackaged${majmin}--${to_version_param}"
- test_label="${EXT} extension downgrade ${UPGRADE_PATH}"
- if expr $to_version_param : ':auto' >/dev/null; then
- test_label="${test_label} ($to_version)"
- fi
- kept_label "${test_label}" || continue
- is_downgrade "${test_label}" ${majmin} ${to_version} || continue
- path=$( psql -XAtc "
- SELECT path
- FROM pg_catalog.pg_extension_update_paths('${EXT}')
- WHERE source = 'unpackaged'
- AND target = '${to_version}'
- " ) || exit 1
- if test -z "${path}"; then
- echo "SKIP: ${test_label} (no downgrade path from unpackaged to ${to_version} known by postgresql)"
- continue
- fi
+ test_label="${test_label} with standard-conforming-strings off"
echo "Testing ${test_label}"
- check_path
+ USERTESTFLAGS="\
+ ${USERTESTFLAGS} \
+ --before-upgrade-script ${SRCDIR}/regress/hooks/standard-conforming-strings-off.sql \
+ " check_downgrade
done
- # Check unpackaged->unpackaged upgrades (if target version == current version)
-# CURRENTVERSION=`grep '^POSTGIS_' ${SRCDIR}/Version.config | cut -d= -f2 | paste -sd '.'`
- CURRENTVERSION=$(grep '^POSTGIS_' ${SRCDIR}/Version.config | cut -d= -f2 | tr '\n' '.' | sed 's/\.$//')
-
- if test "${to_version}" != "${CURRENTVERSION}"; then #{
- echo "SKIP: ${EXT} script-based upgrades (${to_version_param} [${to_version}] does not match built version ${CURRENTVERSION})"
- continue
- fi #}
-
- for majmin in `'ls' -d ${CTBDIR}/postgis-* | sed 's/.*postgis-//'`
- do #{
- UPGRADE_PATH="unpackaged${majmin}--:auto"
- test_label="${EXT} script soft downgrade ${UPGRADE_PATH}"
- if expr $to_version_param : ':auto' >/dev/null; then
- test_label="${test_label} ($to_version)"
- fi
-
- compatible_upgrade "${test_label}" ${majmin} ${to_version} || continue
-
- if kept_label "${test_label}"; then #{
- echo "Testing ${test_label}"
- RUNTESTFLAGS="-v --upgrade-path=${UPGRADE_PATH} ${USERTESTFLAGS}" \
- ${MAKE} -C ${REGDIR} check ${MAKE_ARGS} && {
- echo "PASS: ${test_label}"
- } || {
- echo "FAIL: ${test_label}"
- failed
- }
- fi #}
-
- test_label="${EXT} script hard downgrade ${UPGRADE_PATH}"
- if kept_label "${test_label}"; then #{
- echo "Testing ${test_label}"
- RUNTESTFLAGS="-v --dumprestore --upgrade-path=${UPGRADE_PATH} ${USERTESTFLAGS}" \
- ${MAKE} -C ${REGDIR} check ${MAKE_ARGS} && {
- echo "PASS: ${test_label}"
- } || {
- echo "FAIL: ${test_label}"
- failed
- }
- fi #}
-
- done #}
+ # TODO: Check unpackaged->unpackaged downgrades (if target version == current version)
done #}
[parent: b96e13bedc3f]