Skip to content

Instantly share code, notes, and snippets.

@ancho85
Last active July 18, 2016 13:48
Show Gist options
  • Save ancho85/149f38edf33789804f46159cb2649b20 to your computer and use it in GitHub Desktop.
Save ancho85/149f38edf33789804f46159cb2649b20 to your computer and use it in GitHub Desktop.
Playero Test starter
#!/bin/bash -x
#reverting changes from svn
svn revert -R .
svn status --no-ignore | grep -E '(^\?)|(^\I)' | grep -v -E '(startTest.sh|startTestDirect.sh|*.patch)' | sed -e 's/^. *//' | sed -e 's/\(.*\)/"\1"/' | xargs rm -rf
svn update --force --username USERNAMEHERE --password PASSWORDHERE --no-auth-cache
#touching files
touch force.sync
touch sforcelogin.txt
touch stdout_excluded.txt
echo "" > OpenOrange.log
tail -F -n0 OpenOrange.log &
#enable via xml the Modules. (getStriptDir() bug), later jenkinsAutoGUI enables StdPy, Flota and GasStation
sed -i '/level="1"\/>/a <scriptdir path="extra\/Develop" level="2"\/>' settings/settings.xml.example
sed -i '/level="5"\/>/a <scriptdir path="extra\/Flota" level="6"\/>' settings/settings.xml.example
sed -i '/level="15"\/>/a <scriptdir path="extra\/PayRollPy" level="16"\/>' settings/settings.xml.example
sed -i '/level="16"\/>/a <scriptdir path="extra\/ShippingAgency" level="17"\/>' settings/settings.xml.example
#init main files
mv hbsAutoLogin.sh.example hbsAutoLogin.sh 2> /dev/null
mv settings/settings.xml.example settings/settings.xml 2> /dev/null
mv local/LocalSettings.data.example local/LocalSettings.data 2> /dev/null
#insert Develop module after GasStation and before PayRollPy
sed -i "s/standard\:/\standard:extra\/Develop\:/g" hbsAutoLogin.sh
#insert ShippingAgency module after PayRollPy
sed -i "s/PayRollPy/\PayRollPy:extra\/ShippingAgency/g" hbsAutoLogin.sh
#replace strings
sed -i "s/MP3_Manager/StdPy/g" settings/settings.xml
sed -i 's/hansa/extra\/GasStation/g' settings/settings.xml
sed -i "s/127.0.0.1/REALIPADDRESSHERE/g" hbsAutoLogin.sh
sed -i "s/dbpassword=\*\*\*\*\*\*/dbpassword=DBPASSWORDHERE/g" hbsAutoLogin.sh
sed -i "s/hbsdbname/DATABASENAMEHERE/g" hbsAutoLogin.sh
sed -i "s/oouser=HBS/oouser=REALUSERNAMEHERE/g" hbsAutoLogin.sh
sed -i "s/oopassword=\*\*\*\*\*\*\*\*/oopassword=HASHPASSWORDHERE/g" hbsAutoLogin.sh
sed -i "s/Computer.*/Computer\tDontPrintTicket\tDualScreen\tOffice\tPOSNet\tUserMode\tattachFlag\tinternalId\tsyncVersion/g" local/LocalSettings.data
sed -i "s/MIPC.*/001\t0\t0\t01\t1\t1\t1/g" local/LocalSettings.data #UserMode set to 'developer' to show messages as alerts
sed -i "s/extra\/CustomerFidelity://g" hbsAutoLogin.sh #removing Fidelity. Causes changes in Flota tests
#setting executable flag
chmod +x hbsAutoLogin.sh
chmod +x inicializar.sh
#creating sym links
cd lib
ln -sf libmysqlclient.so.14.0.0 libmysqlclient.so.14
ln -sf libstdc++.so.5.0.7 libstdc++.so.5
ln -sf libssl.so.0.9.7a libssl.so.4
ln -sf libssl.so.0.9.7a libssl.so.0.9.7 #for urllib2 https support
ln -sf libcrypto.so.0.9.7a libcrypto.so.4
ln -sf libcrypto.so.0.9.7a libcrypto.so.0.9.7 #for urllib2 https support
ln -sf libfreetype.so.6.8.0 libfreetype.so.6
cd ..
echo "ASSERT:" >> stdout_excluded.txt
echo "QDate::setYMD:" >> stdout_excluded.txt
echo "QObject::connect:" >> stdout_excluded.txt
#if there is a parameter, delete all test files in base standard and extra and not from parameter
if [[ -n $1 ]]; then
find base standard extra -not -path "*$1/tests*" -name test_*.py -exec rm -rf {} \;
#if there is also another parameter, I assume it is a patch to be applied
if [[ -n $2 ]]; then
(cd $(dirname "$2") && patch -p0) < $2
#if there is a third parameter, I assume it is a single test
if [[ -n $3 ]]; then
find "$(dirname "$2")/$1/tests" -type f -not \( -name "__init__.py" -o -name "_setup_module.py" -o -name "*$3*" \) -exec rm -rf {} \;
fi
fi
fi
export PLAYERO_TESTS_PATH=""
export PLAYERO_COV_PATH=""
export PLAYERO_COV_SKIP=""
export PLAYERO_COV_CONSOLE=""
xvfb-run ./hbsAutoLogin.sh 2>&1 | grep -v -f stdout_excluded.txt
pkill tail
exit ${PIPESTATUS[0]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment