diff options
Diffstat (limited to 'FS-Test/bin')
-rwxr-xr-x | FS-Test/bin/freeside-test-fetch | 8 | ||||
-rwxr-xr-x[-rw-r--r--] | FS-Test/bin/freeside-test-run | 14 | ||||
-rwxr-xr-x | FS-Test/bin/freeside-test-start | 7 | ||||
-rwxr-xr-x | FS-Test/bin/freeside-test-stop | 3 |
4 files changed, 20 insertions, 12 deletions
diff --git a/FS-Test/bin/freeside-test-fetch b/FS-Test/bin/freeside-test-fetch index ccc8528ff..953005704 100755 --- a/FS-Test/bin/freeside-test-fetch +++ b/FS-Test/bin/freeside-test-fetch @@ -1,8 +1,14 @@ #!/usr/bin/perl use strict; -use FS::Test; use Getopt::Std; +use File::Spec; + +my @dirs = File::Spec->splitdir(File::Spec->rel2abs(__FILE__)); +splice @dirs, -2; # bin/freeside-test-run +push @INC, File::Spec->catdir( @dirs, 'lib' ); +eval "use FS::Test;"; +die $@ if $@; my %opt; diff --git a/FS-Test/bin/freeside-test-run b/FS-Test/bin/freeside-test-run index add1e9b25..853bdc9a8 100644..100755 --- a/FS-Test/bin/freeside-test-run +++ b/FS-Test/bin/freeside-test-run @@ -2,18 +2,20 @@ set -ae -tempdir=$( mktemp -d freeside-test.XXXX ) -sharedir=$(perl -MFS::Test -e "print FS::Test::share_dir()") +tempdir=$( mktemp -d --tmpdir freeside-test.XXXX ) +# get the parent directory of bin/(this script) +testroot=$( dirname ${BASH_SOURCE[0]} ) +testroot=$( cd $testroot; cd ..; pwd ) echo "Starting test mode." -freeside-test-start +$testroot/bin/freeside-test-start echo "Saving results to $tempdir." -freeside-test-fetch -d $tempdir +$testroot/bin/freeside-test-fetch -d $tempdir echo "Exiting test mode." -freeside-test-stop || true +$testroot/bin/freeside-test-stop || true diffname=freeside-test.`date +%Y%m%d`.diff echo "Writing diff to $diffname." -diff -urb "$sharedir/output" "$tempdir" > $diffname +diff -urb "$testroot/share/output" "$tempdir" > $diffname diffstat -C $diffname diff --git a/FS-Test/bin/freeside-test-start b/FS-Test/bin/freeside-test-start index 4f12e325b..ed8e131a9 100755 --- a/FS-Test/bin/freeside-test-start +++ b/FS-Test/bin/freeside-test-start @@ -4,12 +4,15 @@ VERSION='5.0.1' set -ae +# get the parent directory of bin/(this script) +testroot=$( dirname ${BASH_SOURCE[0]} ) +testroot=$( cd $testroot; cd ..; pwd ) + echo "Stopping services." sudo service freeside stop sudo service apache2 stop newname=freeside_`date +%Y%m%d` -sharedir=$(perl -MFS::Test -e "print FS::Test::share_dir()") # get company_name from existing DB, strip whitespace # (if there is no existing DB, continue anyway) @@ -34,7 +37,7 @@ fi if [ $createdb = YES ]; then echo "Creating new database from stock schema." createdb --owner=freeside freeside - sudo -u freeside psql freeside -q -f $sharedir/test.sql > /dev/null + sudo -u freeside psql freeside -q -f $testroot/share/test.sql > /dev/null fi newtime=$(sudo -u freeside \ diff --git a/FS-Test/bin/freeside-test-stop b/FS-Test/bin/freeside-test-stop index 7c67f54ec..6ec505a1f 100755 --- a/FS-Test/bin/freeside-test-stop +++ b/FS-Test/bin/freeside-test-stop @@ -24,9 +24,6 @@ oldname=$( psql -tl | \ if [ -n "$oldname" ]; then echo "Renaming $oldname to freeside." psql postgres -c "ALTER DATABASE $oldname RENAME TO freeside" - echo "Restarting services." - sudo service apache2 restart - sudo service freeside restart fi echo "Done." |