[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1681] trunk/utils/devel/chart-load-test.sh



Revision: 1681
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1681&view=rev
Author:   tetragon
Date:     2007-09-30 16:08:36 -0700 (Sun, 30 Sep 2007)

Log Message:
-----------
Adding more complex 1.3-variant CoA load test script

Added Paths:
-----------
    trunk/utils/devel/chart-load-test.sh

Added: trunk/utils/devel/chart-load-test.sh
===================================================================
--- trunk/utils/devel/chart-load-test.sh	                        (rev 0)
+++ trunk/utils/devel/chart-load-test.sh	2007-09-30 23:08:36 UTC (rev 1681)
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# chart-load-test.sh [SQLDIR] [CHARTFILE]
+#
+# Attempts to load the charts and associated GIFI sets.  Expected output is
+# discarded.  Normally run from the top-level LSMB directory to check charts in
+# the directory 'sql', a chart directory or file can be given.  When passed a
+# directory name, it checks all charts in that directory provided that a copy
+# of Pg-database.sql is present.
+#
+# This test script requires that plpgsql have been loaded to template1 and that
+# the running user has the ability to create and drop databases.  Additionally,
+# this copy of chart-load-test.sh will not work with LedgerSMB < 1.3.
+#
+#######################################################################
+# Copyright 2007, The LedgerSMB Core Team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#######################################################################
+
+sqldir="${1:-sql}"
+chart="$2"
+db="charttest$$"
+
+# Adjust before using
+tsearch="/opt/pgsql813-ppc/share/contrib/tsearch2.sql"
+tablefunc="/opt/pgsql813-ppc/share/contrib/tablefunc.sql"
+
+if [ -f "$sqldir" ] ; then
+	chart=`basename $sqldir`
+	chartdir=`dirname $sqldir`
+	sqldir="${chartdir/%\/*\/*\/*/}"
+else
+	chartdir="$sqldir"
+fi
+if [ ! -d "$sqldir" ] ; then
+	echo "chart-load-test.sh: Directory '$sqldir' cannot be accessed" 1>&2
+	exit 1
+elif [ ! -f "${sqldir}/Pg-database.sql" ] ; then
+	echo "chart-load-test.sh: Directory '$sqldir' does not contain Pg-database.sql" 1>&2
+elif [ "$chart" -a ! -f "${chartdir}/$chart" ] ; then
+	echo "chart-load-test.sh: Chart '$chart' cannot be accessed" 1>&2
+	exit 1
+fi
+
+chartdir=${chartdir/#$sqldir/}
+chartdir=${chartdir/#\//}
+pushd $sqldir > /dev/null
+( for i in `find "${chartdir:-.}" -name "${chart:-*.sql}" -path '*/chart/*' -print`; do
+	createdb $db
+	psql -f $tablefunc $db > /dev/null
+	psql -f $tsearch $db > /dev/null
+	psql -f Pg-database.sql $db > /dev/null
+	sleep 3
+	psql -f "$i" $db > /dev/null
+	j="${i/chart/gifi}"
+	if [ -x "$j" ] ; then
+		psql -f "$j" $db > /dev/null
+	fi
+	sleep 3
+	dropdb $db
+done ) 2>&1 | grep -v 'NOTICE' | grep -v '^CREATE' |grep -v '^DROP'
+popd > /dev/null


Property changes on: trunk/utils/devel/chart-load-test.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.