commit c3f47a7d857ee053b8b2c7c5de40b8ab9cb6bae7 Author: Anton A. Melnikov Date: Sat Jun 4 12:49:55 2022 +0300 Fix test for pg_upgrade from 10x versions. diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh index d4c4320a04..cc710633fb 100644 --- a/src/bin/pg_upgrade/test.sh +++ b/src/bin/pg_upgrade/test.sh @@ -23,7 +23,14 @@ standard_initdb() { # To increase coverage of non-standard segment size and group access # without increasing test runtime, run these tests with a custom setting. # Also, specify "-A trust" explicitly to suppress initdb's warning. - "$1" -N --wal-segsize 1 -g -A trust + # --allow-group-access and --wal-segsize have been added in v11. + initdbopt="-N -A trust" + if [ $OLD_PG_VERSION_NUM -ge 110000 ]; then + initdbopt="$initdbopt --wal-segsize 1 --allow-group-access" + fi + + "$1" $initdbopt + if [ -n "$TEMP_CONFIG" -a -r "$TEMP_CONFIG" ] then cat "$TEMP_CONFIG" >> "$PGDATA/postgresql.conf" @@ -145,6 +152,7 @@ PGHOSTADDR=""; unset PGHOSTADDR # Select a non-conflicting port number, similarly to pg_regress.c PG_VERSION_NUM=`grep '#define PG_VERSION_NUM' "$newsrc"/src/include/pg_config.h | awk '{print $3}'` +OLD_PG_VERSION_NUM=`grep '#define PG_VERSION_NUM' "$oldsrc"/src/include/pg_config.h | awk '{print $3}'` PGPORT=`expr $PG_VERSION_NUM % 16384 + 49152` export PGPORT @@ -237,18 +245,26 @@ pg_upgrade $PG_UPGRADE_OPTS -d "${PGDATA}.old" -D "$PGDATA" -b "$oldbindir" -B " # make sure all directories and files have group permissions, on Unix hosts # Windows hosts don't support Unix-y permissions. +if [ $OLD_PG_VERSION_NUM -lt 110000 ]; then + NEW_DIR_PERM=700 + NEW_FILE_PERM=600 +else + NEW_DIR_PERM=750 + NEW_FILE_PERM=640 +fi + case $testhost in MINGW*) ;; - *) if [ `find "$PGDATA" -type f ! -perm 640 | wc -l` -ne 0 ]; then - echo "files in PGDATA with permission != 640"; + *) if [ `find "$PGDATA" -type f ! -perm $NEW_FILE_PERM | wc -l` -ne 0 ]; then + echo "files in PGDATA with permission != $NEW_FILE_PERM"; exit 1; fi ;; esac case $testhost in MINGW*) ;; - *) if [ `find "$PGDATA" -type d ! -perm 750 | wc -l` -ne 0 ]; then - echo "directories in PGDATA with permission != 750"; + *) if [ `find "$PGDATA" -type d ! -perm $NEW_DIR_PERM | wc -l` -ne 0 ]; then + echo "directories in PGDATA with permission != $NEW_DIR_PERM"; exit 1; fi ;; esac