#!/bin/bash # ./pre-post-commit-to-youtrack.py failedTests="" assert() { aType=$1 shift if [ "$aType" == "Success" ]; then validres=0 elif [ "$aType" == "Fail" ]; then validres=1 else echo "Wrong argument $aType" exit 2 fi echo "### =========== running $aType test =======" echo "### $*" $* if [ "$?" == "$validres" ]; then echo -e "\n### \e[32mTEST PASSED\e[0m" else echo -e "### \e[31mTEST FAILED !!!\e[0m" failedTests="$failedTests\n$aType $*" fi echo -e "### ==================================\n\n" } #assert Fail ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/fr-wd.com 333 #assert Fail ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/clarity 332 #assert Success ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/magento_extensions 747 assert Success ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/furniture.bento 72 #assert Fail ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/orange35.com 401 #assert Success ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/orange35.com 466 #assert Fail ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/Quick_Site_Framework 5673 #assert Fail ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/Quick_Site_Framework 5511 #assert Success ./pre-post-commit-to-youtrack.py POST-COMMIT /var/svn/repos/developer-tools 127 # add more tests here if [ "$failedTests" == "" ]; then echo -e "\n\n\nALL TESTS PASSED\n\n" else echo "=========================================================" echo "Failed tests:" echo -e "$failedTests" fi #./pre-post-commit-to-youtrack.py POST-COMMIT http://svn.adaptainc.com/fr-wd.com 333