Thread: fix for pg_regress.sh on mingw

fix for pg_regress.sh on mingw

From
Andrew Dunstan
Date:
With the attached patch "make check" runs cleanly for me under MSys/Mingw.

Description of changes:

. only use the -W flag on pwd for $pkglibdir. All the other paths need
to be seen as MSys type paths, whereas $pkglibdir needs to be expressed
as a genuine windows path.
. run single tests in the background and explicitly wait for them -
solves the problem of the MSys shell not waiting properly for the copy
test to finish.
. use pg_ctl to shut down the test postmaster - no more use of ad hoc
kill programs or the task manager.

With these changes there should no longer be any need to run regression
tests from cygwin for native Windows builds - you can simply run "make
check" from the build directory in the build environment.

cheers

andrew

Index: src/test/regress/pg_regress.sh
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/test/regress/pg_regress.sh,v
retrieving revision 1.44
diff -c -w -r1.44 pg_regress.sh
*** src/test/regress/pg_regress.sh    20 May 2004 00:21:36 -0000    1.44
--- src/test/regress/pg_regress.sh    28 May 2004 20:06:01 -0000
***************
*** 208,225 ****


  # ----------
- # Set up pwd to give a win32 happy pathname
- # ----------
-
- case $host_platform in
-     *-*-mingw32*)
-         PWDFLAGS=-W;;
-     *)
-         PWDFLAGS=;;
- esac
-
-
- # ----------
  # Set backend timezone and datestyle explicitly
  #
  # To pass the horology test in its current form, the postmaster must be
--- 208,213 ----
***************
*** 306,317 ****
  if [ x"$temp_install" != x"" ]
  then
      if echo x"$temp_install" | grep -v '^x/' >/dev/null 2>&1; then
!         temp_install="`pwd $PWDFLAGS`/$temp_install"
      fi

      bindir=$temp_install/install/$bindir
      libdir=$temp_install/install/$libdir
-     pkglibdir=$temp_install/install/$pkglibdir
      datadir=$temp_install/install/$datadir
      PGDATA=$temp_install/data

--- 294,313 ----
  if [ x"$temp_install" != x"" ]
  then
      if echo x"$temp_install" | grep -v '^x/' >/dev/null 2>&1; then
!         case $host_platform in
!           *-*-mingw32*)
!                 pkglibdir="`pwd -W`/$temp_install/install/$pkglibdir"
!               temp_install="`pwd`/$temp_install"
!                 ;;
!           *)
!                 temp_install="`pwd`/$temp_install"
!                 pkglibdir=$temp_install/install/$pkglibdir
!                 ;;
!         esac
      fi

      bindir=$temp_install/install/$bindir
      libdir=$temp_install/install/$libdir
      datadir=$temp_install/install/$datadir
      PGDATA=$temp_install/data

***************
*** 602,608 ****
          # Run a single test
          formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'`
          $ECHO_N "test $formatted ... $ECHO_C"
!         $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1
      else
          # Start a parallel group
          $ECHO_N "parallel group ($# tests): $ECHO_C"
--- 598,605 ----
          # Run a single test
          formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'`
          $ECHO_N "test $formatted ... $ECHO_C"
!         ( $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1 )&
!     wait
      else
          # Start a parallel group
          $ECHO_N "parallel group ($# tests): $ECHO_C"
***************
*** 704,710 ****

  if [ -n "$postmaster_pid" ]; then
      message "shutting down postmaster"
!     kill -15 "$postmaster_pid"
      wait "$postmaster_pid"
      unset postmaster_pid
  fi
--- 701,707 ----

  if [ -n "$postmaster_pid" ]; then
      message "shutting down postmaster"
!     "$bindir/pg_ctl" -s -D "$PGDATA" stop
      wait "$postmaster_pid"
      unset postmaster_pid
  fi

Re: fix for pg_regress.sh on mingw

From
Bruce Momjian
Date:
Patch applied.  Thanks.

---------------------------------------------------------------------------


Andrew Dunstan wrote:
>
> With the attached patch "make check" runs cleanly for me under MSys/Mingw.
>
> Description of changes:
>
> . only use the -W flag on pwd for $pkglibdir. All the other paths need
> to be seen as MSys type paths, whereas $pkglibdir needs to be expressed
> as a genuine windows path.
> . run single tests in the background and explicitly wait for them -
> solves the problem of the MSys shell not waiting properly for the copy
> test to finish.
> . use pg_ctl to shut down the test postmaster - no more use of ad hoc
> kill programs or the task manager.
>
> With these changes there should no longer be any need to run regression
> tests from cygwin for native Windows builds - you can simply run "make
> check" from the build directory in the build environment.
>
> cheers
>
> andrew
>

> Index: src/test/regress/pg_regress.sh
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/test/regress/pg_regress.sh,v
> retrieving revision 1.44
> diff -c -w -r1.44 pg_regress.sh
> *** src/test/regress/pg_regress.sh    20 May 2004 00:21:36 -0000    1.44
> --- src/test/regress/pg_regress.sh    28 May 2004 20:06:01 -0000
> ***************
> *** 208,225 ****
>
>
>   # ----------
> - # Set up pwd to give a win32 happy pathname
> - # ----------
> -
> - case $host_platform in
> -     *-*-mingw32*)
> -         PWDFLAGS=-W;;
> -     *)
> -         PWDFLAGS=;;
> - esac
> -
> -
> - # ----------
>   # Set backend timezone and datestyle explicitly
>   #
>   # To pass the horology test in its current form, the postmaster must be
> --- 208,213 ----
> ***************
> *** 306,317 ****
>   if [ x"$temp_install" != x"" ]
>   then
>       if echo x"$temp_install" | grep -v '^x/' >/dev/null 2>&1; then
> !         temp_install="`pwd $PWDFLAGS`/$temp_install"
>       fi
>
>       bindir=$temp_install/install/$bindir
>       libdir=$temp_install/install/$libdir
> -     pkglibdir=$temp_install/install/$pkglibdir
>       datadir=$temp_install/install/$datadir
>       PGDATA=$temp_install/data
>
> --- 294,313 ----
>   if [ x"$temp_install" != x"" ]
>   then
>       if echo x"$temp_install" | grep -v '^x/' >/dev/null 2>&1; then
> !         case $host_platform in
> !           *-*-mingw32*)
> !                 pkglibdir="`pwd -W`/$temp_install/install/$pkglibdir"
> !               temp_install="`pwd`/$temp_install"
> !                 ;;
> !           *)
> !                 temp_install="`pwd`/$temp_install"
> !                 pkglibdir=$temp_install/install/$pkglibdir
> !                 ;;
> !         esac
>       fi
>
>       bindir=$temp_install/install/$bindir
>       libdir=$temp_install/install/$libdir
>       datadir=$temp_install/install/$datadir
>       PGDATA=$temp_install/data
>
> ***************
> *** 602,608 ****
>           # Run a single test
>           formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'`
>           $ECHO_N "test $formatted ... $ECHO_C"
> !         $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1
>       else
>           # Start a parallel group
>           $ECHO_N "parallel group ($# tests): $ECHO_C"
> --- 598,605 ----
>           # Run a single test
>           formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'`
>           $ECHO_N "test $formatted ... $ECHO_C"
> !         ( $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1 )&
> !     wait
>       else
>           # Start a parallel group
>           $ECHO_N "parallel group ($# tests): $ECHO_C"
> ***************
> *** 704,710 ****
>
>   if [ -n "$postmaster_pid" ]; then
>       message "shutting down postmaster"
> !     kill -15 "$postmaster_pid"
>       wait "$postmaster_pid"
>       unset postmaster_pid
>   fi
> --- 701,707 ----
>
>   if [ -n "$postmaster_pid" ]; then
>       message "shutting down postmaster"
> !     "$bindir/pg_ctl" -s -D "$PGDATA" stop
>       wait "$postmaster_pid"
>       unset postmaster_pid
>   fi

>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073