2 ###########################################################################
3 # This requires coverage and nosetests:
5 # pip install -r requirements.txt
7 # test_base_vcs_mercurial.py requires hg >= 1.6.0 with mq, rebase, share
8 # extensions to fully test.
9 ###########################################################################
11 COVERAGE_ARGS
="--omit='/usr/*,/opt/*'"
13 uname
-v |
grep -q Darwin
14 if [ $?
-eq 0 ] ; then
16 COVERAGE_ARGS
="--omit='/Library/*,/usr/*,/opt/*'"
18 uname
-s |
egrep -q MINGW32
# Cygwin will be linux in this case?
19 if [ $?
-eq 0 ] ; then
22 NOSETESTS
=`env which nosetests`
24 echo "### Finding mozharness/ .py files..."
25 files
=`find mozharness -name [a-z]\*.py`
26 if [ $OS_TYPE == 'windows' ] ; then
27 MOZHARNESS_PY_FILES
=""
29 file $f |
grep -q "Assembler source"
30 if [ $?
-ne 0 ] ; then
31 MOZHARNESS_PY_FILES
="$MOZHARNESS_PY_FILES $f"
35 MOZHARNESS_PY_FILES
=$files
37 echo "### Finding scripts/ .py files..."
38 files
=`find scripts -name [a-z]\*.py`
39 if [ $OS_TYPE == 'windows' ] ; then
42 file $f |
grep -q "Assembler source"
43 if [ $?
-ne 0 ] ; then
44 SCRIPTS_PY_FILES
="$SCRIPTS_PY_FILES $f"
48 SCRIPTS_PY_FILES
=$files
50 export PYTHONPATH
=`env pwd`:$PYTHONPATH
52 echo "### Running pyflakes"
53 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'"
55 echo "### Running pylint"
56 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)'
59 if [ $OS_TYPE != 'windows' ] ; then
60 echo "### Testing non-networked unit tests"
61 coverage run
-a --branch $COVERAGE_ARGS $NOSETESTS test
/test_
*.py
62 echo "### Running *.py [--list-actions]"
63 for filename
in $MOZHARNESS_PY_FILES; do
64 coverage run
-a --branch $COVERAGE_ARGS $filename
66 for filename
in $SCRIPTS_PY_FILES ; do
67 coverage run
-a --branch $COVERAGE_ARGS $filename --list-actions > /dev
/null
69 echo "### Running scripts/configtest.py --log-level warning"
70 coverage run
-a --branch $COVERAGE_ARGS scripts
/configtest.py
--log-level warning
72 echo "### Creating coverage html"
73 coverage html
$COVERAGE_ARGS -d coverage.new
74 if [ -e coverage
] ; then
75 mv coverage coverage.old
76 mv coverage.new coverage
79 mv coverage.new coverage
82 echo "### Running nosetests..."