diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/mozharness/unit.sh | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/mozharness/unit.sh')
-rwxr-xr-x | testing/mozharness/unit.sh | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/testing/mozharness/unit.sh b/testing/mozharness/unit.sh new file mode 100755 index 000000000..a4a27a837 --- /dev/null +++ b/testing/mozharness/unit.sh @@ -0,0 +1,85 @@ +#!/bin/bash +########################################################################### +# This requires coverage and nosetests: +# +# pip install -r requirements.txt +# +# test_base_vcs_mercurial.py requires hg >= 1.6.0 with mq, rebase, share +# extensions to fully test. +########################################################################### + +COVERAGE_ARGS="--omit='/usr/*,/opt/*'" +OS_TYPE='linux' +uname -v | grep -q Darwin +if [ $? -eq 0 ] ; then + OS_TYPE='osx' + COVERAGE_ARGS="--omit='/Library/*,/usr/*,/opt/*'" +fi +uname -s | egrep -q MINGW32 # Cygwin will be linux in this case? +if [ $? -eq 0 ] ; then + OS_TYPE='windows' +fi +NOSETESTS=`env which nosetests` + +echo "### Finding mozharness/ .py files..." +files=`find mozharness -name [a-z]\*.py` +if [ $OS_TYPE == 'windows' ] ; then + MOZHARNESS_PY_FILES="" + for f in $files; do + file $f | grep -q "Assembler source" + if [ $? -ne 0 ] ; then + MOZHARNESS_PY_FILES="$MOZHARNESS_PY_FILES $f" + fi + done +else + MOZHARNESS_PY_FILES=$files +fi +echo "### Finding scripts/ .py files..." +files=`find scripts -name [a-z]\*.py` +if [ $OS_TYPE == 'windows' ] ; then + SCRIPTS_PY_FILES="" + for f in $files; do + file $f | grep -q "Assembler source" + if [ $? -ne 0 ] ; then + SCRIPTS_PY_FILES="$SCRIPTS_PY_FILES $f" + fi + done +else + SCRIPTS_PY_FILES=$files +fi +export PYTHONPATH=`env pwd`:$PYTHONPATH + +echo "### Running pyflakes" +pyflakes $MOZHARNESS_PY_FILES $SCRIPTS_PY_FILES | grep -v "local variable 'url' is assigned to" | grep -v "redefinition of unused 'json'" | egrep -v "mozharness/mozilla/testing/mozpool\.py.*undefined name 'requests'" + +echo "### Running pylint" +pylint -E -e F -f parseable $MOZHARNESS_PY_FILES $SCRIPTS_PY_FILES 2>&1 | egrep -v '(No config file found, using default configuration|Instance of .* has no .* member|Unable to import .devicemanager|Undefined variable .DMError|Module .hashlib. has no .sha512. member)' + +rm -rf build logs +if [ $OS_TYPE != 'windows' ] ; then + echo "### Testing non-networked unit tests" + coverage run -a --branch $COVERAGE_ARGS $NOSETESTS test/test_*.py + echo "### Running *.py [--list-actions]" + for filename in $MOZHARNESS_PY_FILES; do + coverage run -a --branch $COVERAGE_ARGS $filename + done + for filename in $SCRIPTS_PY_FILES ; do + coverage run -a --branch $COVERAGE_ARGS $filename --list-actions > /dev/null + done + echo "### Running scripts/configtest.py --log-level warning" + coverage run -a --branch $COVERAGE_ARGS scripts/configtest.py --log-level warning + + echo "### Creating coverage html" + coverage html $COVERAGE_ARGS -d coverage.new + if [ -e coverage ] ; then + mv coverage coverage.old + mv coverage.new coverage + rm -rf coverage.old + else + mv coverage.new coverage + fi +else + echo "### Running nosetests..." + nosetests test/ +fi +rm -rf build logs |