From 25fd0ebfa0f2d58badd839ead518824043ee2374 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 18 Sep 2007 23:24:12 +1200 Subject: [PATCH] Some minor changes. One day this might work elsewhere. --- testing/run_regressions.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/testing/run_regressions.sh b/testing/run_regressions.sh index 59c0e1f7..389a97aa 100755 --- a/testing/run_regressions.sh +++ b/testing/run_regressions.sh @@ -34,14 +34,25 @@ check_result() { fi } -# Restart PGPool to ensure we can drop and recreate the database -# FIXME: We should really drop everything *from* the database and create it -# from that, so we don't need to do this. -sudo /etc/init.d/pgpool restart -if ! dropdb ${DBNAME}; then - echo "Unable to drop existing database" - exit -fi +drop_database() { + dropdb $1 + if psql -ltA | cut -f1 -d'|' | grep "^$1$" >/dev/null ; then + # Restart PGPool to ensure we can drop and recreate the database + # FIXME: We should really drop everything *from* the database and create it + # from that, so we don't need to do this. + sudo /etc/init.d/pgpool restart + dropdb $1 + if psql -ltA | cut -f1 -d'|' | grep "^$1$" >/dev/null ; then + echo "Failed to drop $1 database" + exit 1 + fi + fi +} + +drop_database ${DBNAME} + +mkdir -p "${RESULTS}" +mkdir -p "${REGRESSION}/diffs" TEST="Create-Database" ../dba/create-database.sh ${DBNAME} 'nimda' >"${RESULTS}/${TEST}" 2>&1