[postgis-tickets] r17732 - [check_all_upgrades] Test upgrades from old versions unpackaged

Sandro Santilli strk at kbt.io
Tue Aug 20 02:03:46 PDT 2019


Author: strk
Date: 2019-08-20 02:03:46 -0700 (Tue, 20 Aug 2019)
New Revision: 17732

Modified:
   trunk/utils/check_all_upgrades.sh
Log:
[check_all_upgrades] Test upgrades from old versions unpackaged

See #4485

Modified: trunk/utils/check_all_upgrades.sh
===================================================================
--- trunk/utils/check_all_upgrades.sh	2019-08-20 09:03:36 UTC (rev 17731)
+++ trunk/utils/check_all_upgrades.sh	2019-08-20 09:03:46 UTC (rev 17732)
@@ -49,6 +49,7 @@
 
 BUILDDIR=$PWD
 EXTDIR=`pg_config --sharedir`/extension/
+CTBDIR=`pg_config --sharedir`/contrib/
 
 cd $EXTDIR
 failures=0
@@ -63,10 +64,15 @@
 
 echo "INFO: installed extensions: $INSTALLED_EXTENSIONS"
 
-for EXT in ${INSTALLED_EXTENSIONS}; do
+failed()
+{
+  failures=$((failures+1))
   if test $EXIT_ON_FIRST_FAILURE != 0 -a $failures != 0; then
     exit $failures
   fi
+}
+
+for EXT in ${INSTALLED_EXTENSIONS}; do
   if test "${EXT}" = "postgis"; then
     REGDIR=${BUILDDIR}/regress
   elif test "${EXT}" = "postgis_topology"; then
@@ -76,17 +82,17 @@
   else
     echo "SKIP: don't know where to find regress tests for extension ${EXT}"
   fi
+
+  # Check extension->extension upgrades
   files=`'ls' ${EXT}--* | grep -v -- '--.*--' | sed "s/^${EXT}--\(.*\)\.sql/\1/"`
-  for fname in unpackaged $files; do
+  for fname in $files; do
     from_version="$fname"
     UPGRADE_PATH="${from_version}--${to_version}"
     # only consider versions older than ${to_version}
-    if test $fname != "unpackaged"; then # unpackaged is always older
-      cmp=`semver_compare "${from_version}" "${to_version}"`
-      if test $cmp -ge 0; then
-        echo "SKIP: upgrade $UPGRADE_PATH (target is not newer than source)"
-        continue
-      fi
+    cmp=`semver_compare "${from_version}" "${to_version}"`
+    if test $cmp -ge 0; then
+      echo "SKIP: upgrade $UPGRADE_PATH (target is not newer than source)"
+      continue
     fi
     if test -e ${EXT}--${UPGRADE_PATH}.sql; then
       echo "Testing ${EXT} upgrade $UPGRADE_PATH"
@@ -95,12 +101,26 @@
         echo "PASS: upgrade $UPGRADE_PATH"
       } || {
         echo "FAIL: upgrade $UPGRADE_PATH"
-        failures=$((failures+1))
+        failed
       }
     else
       echo "SKIP: ${EXT} upgrade $UPGRADE_PATH is missing"
     fi
   done
+
+  # Check unpackaged->extension upgrades
+  for majmin in "" `'ls' -d ${CTBDIR}/postgis-* | sed 's/.*postgis-//'`; do
+    UPGRADE_PATH="unpackaged${majmin}--${to_version}"
+    echo "Testing ${EXT} upgrade $UPGRADE_PATH"
+    export RUNTESTFLAGS="-v --extension --upgrade-path=${UPGRADE_PATH}"
+    make -C ${REGDIR} check && {
+      echo "PASS: upgrade $UPGRADE_PATH"
+    } || {
+      echo "FAIL: upgrade $UPGRADE_PATH"
+      failed
+    }
+  done
+
 done
 
 exit $failures



More information about the postgis-tickets mailing list