Re: regression script/makefile exit failure

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: regression script/makefile exit failure
Date: 2004-12-11 00:57:40
Message-ID: 41BA4604.9000109@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Further investigation has shown that the exit/trap idiom used in
pg_regress.sh is less than 100% portable.

The following shell script has been seen to produce incorrect output on
both Cygwin and FreeBSD:

#!/bin/sh

trap '
st=$?
echo status = $st
exit $st
' 0

(exit 9); exit

I'm not sure how we get a portable solution (other than maybe converting
the shell script to perl).

cheers

andrew

I wrote:

>
> I have seen several cases where either pg_regress appears not to exit
> with the expected non-zero exit status or "make check" does not
> apparently exit with the expected non-zero status.
>
> In particular, I've seen it on cygwin, windows, and have at least a
> suspicion of it happening on FreeBSD.
>
> The apparently offending code is this:
>
> message "initializing database system"
> [ "$debug" = yes ] && initdb_options='--debug'
> "$bindir/initdb" -D "$PGDATA" -L "$datadir" --noclean
> $initdb_options >"$LOGDIR/initdb.log" 2>&1
>
> if [ $? -ne 0 ]
> then
> echo
> echo "$me: initdb failed"
> echo "Examine $LOGDIR/initdb.log for the reason."
> echo
> (exit 2); exit
> fi
>
>
> and it's called from this makefile target:
>
> check: all
> -rm -rf ./testtablespace
> mkdir ./testtablespace
> $(SHELL) ./pg_regress --temp-install
> --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule
> --multibyte=$(MULTIBYTE) $(MAXCONNOPT)
>
>
> The practical consequence of this is that instead of failing at this
> stage, the buildfarm script continues on until it somewhat
> inexplicably fails at the initdb stage.
>
>
> Now, perhaps I'm calling it wrong, but I don't think so. The relevant
> perl code is this:
>
> my @makeout = `cd $pgsql/src/test/regress && $make check 2>&1`;
> my $status = $? >>8;
>
> which idiom seems to work as expected everywhere else quite happily.
> And in fact I've seen "make check" fail as expected on other failure
> paths (such as not matching the expected result.)
>
>
>
> Anyone have any penetrating thoughts?
>
> cheers
>
> andrew
>
>
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message mweilguni 2004-12-11 10:38:57 Minor Optimization?
Previous Message Andrew Dunstan 2004-12-10 23:12:33 apparent regression problems on linux/alpha

Browse pgsql-patches by date

  From Date Subject
Next Message Serguei Mokhov 2004-12-11 03:28:04 Translation updates: 8.0: pg_dump-ru, initdb-ru, psql-ru; 7.4/8.0: postgres-ru
Previous Message Andreas Pflug 2004-12-10 13:55:01 pg_get_viewdef returns one paren too much