]> granicus.if.org Git - postgis/commitdiff
[check_all_upgrades] Test upgrades from old versions unpackaged
authorSandro Santilli <strk@kbt.io>
Tue, 20 Aug 2019 09:03:46 +0000 (09:03 +0000)
committerSandro Santilli <strk@kbt.io>
Tue, 20 Aug 2019 09:03:46 +0000 (09:03 +0000)
See #4485

git-svn-id: http://svn.osgeo.org/postgis/trunk@17732 b70326c6-7e19-0410-871a-916f4a2858ee

utils/check_all_upgrades.sh

index 74d4b46d2a8a4c8b34ffd6cc0970291b0a7e8f72..3278dc4c70625f4cd85b82a7e3f42d42e3ccfc35 100755 (executable)
@@ -49,6 +49,7 @@ semver_compare()
 
 BUILDDIR=$PWD
 EXTDIR=`pg_config --sharedir`/extension/
+CTBDIR=`pg_config --sharedir`/contrib/
 
 cd $EXTDIR
 failures=0
@@ -63,10 +64,15 @@ fi
 
 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 @@ for EXT in ${INSTALLED_EXTENSIONS}; do
   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 @@ for EXT in ${INSTALLED_EXTENSIONS}; do
         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