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

SF.net SVN: ledger-smb: [1680] branches/1.2/utils/devel/chart-load-test.sh



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

Log Message:
-----------
Adding CoA load test script (1.2 variant)

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

Added: branches/1.2/utils/devel/chart-load-test.sh
===================================================================
--- branches/1.2/utils/devel/chart-load-test.sh	                        (rev 0)
+++ branches/1.2/utils/devel/chart-load-test.sh	2007-09-30 15:04:58 UTC (rev 1680)
@@ -0,0 +1,64 @@
+#!/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$$"
+
+if [ -f "$sqldir" ] ; then
+	chart=`basename $sqldir`
+	sqldir=`dirname $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 "${sqldir}/$chart" ] ; then
+	echo "chart-load-test.sh: Chart '$chart' cannot be accessed" 1>&2
+	exit 1
+fi
+
+pushd $sqldir > /dev/null
+( for i in ${chart:-*-chart.sql}; do
+	createdb $db
+	psql -f Pg-database.sql $db > /dev/null
+	sleep 3
+	psql -f "$i" $db > /dev/null
+	j="${i/chart.sql/gifi.sql}"
+	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: branches/1.2/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.