forked from UCSBarchlab/PyRTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkcode
executable file
·61 lines (47 loc) · 1.52 KB
/
checkcode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
echo
echo
echo "!!!This script is deprecated, moving to 'tox'!!!"
echo "just run 'tox' to check code against python 2.7 and 3.4"
echo "'tox -e py2.7-test' will run just original 2.7 test, and "
echo "'tox -e pep8' will just run the pep8 check."
echo
echo
# Packages required (and Ubuntu/Debian style packages)
# Python nose tests (apt-get install python-nose)
# Python pep8 style checker (apt-get install pep8)
# Pylint error checker (apt-get install pylint)
# check exit code
function check_exit_code {
exit_status=$1
if [[ $exit_status != 0 ]]; then
echo $2
exit $exit_status
fi
}
echo
echo ===== Running NoseTests ==============================================
nosetests -x --with-coverage
check_exit_code $? 'PyRTL core nose tests failed. Exiting'
echo
echo ===== Checking Core =====================================
pylint -E pyrtl.
check_exit_code $? 'PyRTL core lint check failed. Exiting.'
pep8 --max-line-length=100 pyrtl/
check_exit_code $? 'PyRTL core pep8 check failed. Exiting.'
echo
echo ===== Checking Examples =====================================
pylint -E examples/*.py
check_exit_code $? 'PyRTL example link check failed. Exiting.'
pep8 --max-line-length=100 examples/*.py
check_exit_code $? 'PyRTL examples pep8 check failed. Exiting.'
echo
echo 'Tests passed.'
echo
echo ===== Building documentation =====================================
cd docs
make html
cd ..
check_exit_code $? "Docs failed to build. Exiting."
#nosetests --with-coverage --cover-erase --cover-html
exit 0