[postgis-tickets] r17363 - Add -s switch to check_all_upgrades to stop on first failure

Sandro Santilli strk at kbt.io
Thu Mar 28 09:51:59 PDT 2019


Author: strk
Date: 2019-03-28 09:51:58 -0700 (Thu, 28 Mar 2019)
New Revision: 17363

Modified:
   trunk/.drone-1.0.yml
   trunk/utils/check_all_upgrades.sh
Log:
Add -s switch to check_all_upgrades to stop on first failure

Also have Dronie use that switch.
Closes #4360

Modified: trunk/.drone-1.0.yml
===================================================================
--- trunk/.drone-1.0.yml	2019-03-28 16:36:53 UTC (rev 17362)
+++ trunk/.drone-1.0.yml	2019-03-28 16:51:58 UTC (rev 17363)
@@ -24,7 +24,7 @@
       - psql -c "select version()" template1
       - make check RUNTESTFLAGS=-v
       - make install
-      - utils/check_all_upgrades.sh
+      - utils/check_all_upgrades.sh -s
         `grep '^POSTGIS_' Version.config | cut -d= -f2 | paste -sd '.'`
 ---
 test-image: &test-image docker.kbt.io/postgis/build-test:trisquel2
@@ -47,7 +47,7 @@
       - psql -c "select version()" template1
       - make check RUNTESTFLAGS=-v
       - make install
-      - utils/check_all_upgrades.sh
+      - utils/check_all_upgrades.sh -s
         `grep '^POSTGIS_' Version.config | cut -d= -f2 | paste -sd '.'`
 ---
 test-image: &test-image docker.kbt.io/postgis/build-test:trisquel2
@@ -70,6 +70,6 @@
       - psql -c "select version()" template1
       - make check RUNTESTFLAGS=-v
       - make install
-      - utils/check_all_upgrades.sh
+      - utils/check_all_upgrades.sh -s
         `grep '^POSTGIS_' Version.config | cut -d= -f2 | paste -sd '.'`
 ...

Modified: trunk/utils/check_all_upgrades.sh
===================================================================
--- trunk/utils/check_all_upgrades.sh	2019-03-28 16:36:53 UTC (rev 17362)
+++ trunk/utils/check_all_upgrades.sh	2019-03-28 16:51:58 UTC (rev 17363)
@@ -1,11 +1,20 @@
 #!/bin/sh
 
 if test -z "$1"; then
-  echo "Usage: $0 <to_version>" >&2
+  echo "Usage: $0 [-s] <to_version>" >&2
+  echo "Options:" >&2
+  echo "\t-s  Stop on first failure" >&2
   exit 1
 fi
+EXIT_ON_FIRST_FAILURE=0
+
+if test "$1" = "-s"; then
+  EXIT_ON_FIRST_FAILURE=1
+  shift
+fi
 to_version="$1"
 
+
 # Return -1, 1 or 0 if the first version
 # is respectively smaller, greater or equal
 # to the second version
@@ -53,6 +62,9 @@
 echo "INFO: installed extensions: $INSTALLED_EXTENSIONS"
 
 for EXT in ${INSTALLED_EXTENSIONS}; do
+  if test $EXIT_ON_FIRST_FAILURE != 0 -a $failures != 0; then
+    exit $failures
+  fi
   if test "${EXT}" = "postgis"; then
     REGDIR=${BUILDDIR}/regress
   elif test "${EXT}" = "postgis_topology"; then



More information about the postgis-tickets mailing list