Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moar bootstrap functionality.

  • Loading branch information...
commit a65f65c119e301d19c538ed9116d21e07f6b6835 1 parent 56cd972
@sbisbee sbisbee authored
Showing with 39 additions and 12 deletions.
  1. +39 −12 tests/bootstrap.bsh
View
51 tests/bootstrap.bsh
@@ -19,19 +19,46 @@
# Assumes that tests are independent from each another. That is, if one step
# fails then the other steps should still run.
+numSteps=0
failures=0
-echo -e -n "Checking for phpunit...\t\t\t\t" &&
- which phpunit > /dev/null &&
- echo "done." ||
- (
- echo "FAIL!" &&
- failures=1
- )
-
-echo -e -n "Deleting the sag_tests database...\t\t" &&
- curl -s -X DELETE http://admin:passwd@localhost:5984/sag_tests > /dev/null &&
+function success
+{
echo "done."
+}
+
+function failure
+{
+ echo "FAIL!"
+ ((failures++))
+}
+
+for cmd in curl phpunit
+do
+ ((numSteps++))
+ echo -e -n "checking for $cmd...\t\t\t\t"
+
+ which $cmd > /dev/null
+
+ [ $? -eq 0 ] && success || failure
+done
+
+((numSteps++))
+echo -e -n "Checking for admin:passwd credentials...\t"
+curl -s http://admin:passwd@localhost:5984/_session | grep 'name":"admin' > /dev/null
+[ $? -eq 0 ] && success || failure
+
+((numSteps++))
+echo -e -n "Deleting the sag_tests database...\t\t"
+curl -s -X DELETE http://admin:passwd@localhost:5984/sag_tests > /dev/null
+[ $? -eq 0 ] && success || failure
+
+echo -e "\n"
-[ $failures > 0 ] &&
- echo -e "\n!!! One or more steps failed. Please resolve and re-run. !!!"
+if [ $failures -gt 0 ]
+then
+ echo "!!! $failures/$numSteps failed. Please resolve and re-run. !!!"
+ exit 1
+else
+ echo "Success!"
+fi
Please sign in to comment.
Something went wrong with that request. Please try again.