~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to run_tests.sh

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-05-24 13:12:53 UTC
  • mfrom: (1.1.55)
  • Revision ID: package-import@ubuntu.com-20120524131253-ommql08fg1en06ut
Tags: 2012.2~f1-0ubuntu1
* New upstream release.
* Prepare for quantal:
  - Dropped debian/patches/upstream/0006-Use-project_id-in-ec2.cloud._format_image.patch
  - Dropped debian/patches/upstream/0005-Populate-image-properties-with-project_id-again.patch
  - Dropped debian/patches/upstream/0004-Fixed-bug-962840-added-a-test-case.patch
  - Dropped debian/patches/upstream/0003-Allow-unprivileged-RADOS-users-to-access-rbd-volumes.patch
  - Dropped debian/patches/upstream/0002-Stop-libvirt-test-from-deleting-instances-dir.patch
  - Dropped debian/patches/upstream/0001-fix-bug-where-nova-ignores-glance-host-in-imageref.patch 
  - Dropped debian/patches/0001-fix-useexisting-deprecation-warnings.patch
* debian/control: Add python-keystone as a dependency. (LP: #907197)
* debian/patches/kombu_tests_timeout.patch: Refreshed.
* debian/nova.conf, debian/nova-common.postinst: Convert to new ini
  file configuration
* debian/patches/nova-manage_flagfile_location.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
  echo "  -n, --no-recreate-db     Don't recreate the test database."
14
14
  echo "  -x, --stop               Stop running tests after the first error or failure."
15
15
  echo "  -f, --force              Force a clean re-build of the virtual environment. Useful when dependencies have been added."
16
 
  echo "  -p, --pep8               Just run pep8"
17
 
  echo "  -P, --no-pep8            Don't run pep8"
18
 
  echo "  -H, --hacking            Just run HACKING compliance testing"
 
16
  echo "  -p, --pep8               Just run PEP8 and HACKING compliance check"
 
17
  echo "  -P, --no-pep8            Don't run static code checks"
19
18
  echo "  -c, --coverage           Generate coverage report"
20
19
  echo "  -h, --help               Print this usage message"
21
20
  echo "  --hide-elapsed           Don't print the elapsed time for each test along with slow test list"
39
38
    -f|--force) force=1;;
40
39
    -p|--pep8) just_pep8=1;;
41
40
    -P|--no-pep8) no_pep8=1;;
42
 
    -H|--hacking) just_hacking=1;;
43
41
    -c|--coverage) coverage=1;;
44
42
    -*) noseopts="$noseopts $1";;
45
43
    *) noseargs="$noseargs $1"
58
56
wrapper=""
59
57
just_pep8=0
60
58
no_pep8=0
61
 
just_hacking=0
62
59
coverage=0
63
60
recreate_db=1
64
61
patch_migrate=1
78
75
 
79
76
function run_tests {
80
77
  # Cleanup *pyc
81
 
  echo "cleaning *.pyc files"
82
78
  ${wrapper} find . -type f -name "*.pyc" -delete
83
79
  # Just run the test suites in current environment
84
80
  ${wrapper} $NOSETESTS 2> run_tests.log
100
96
#                when running on devstack.
101
97
# NOTE(lzyeval): Avoid selecting *.pyc files to reduce pep8 check-up time
102
98
#                when running on devstack.
103
 
xen_api_path="plugins/xenserver/xenapi/etc/xapi.d/plugins"
 
99
# NOTE(dprince): Exclude xenapi plugins. They are Python 2.4 code and as such
 
100
#                cannot be expected to work with tools/hacking checks.
104
101
xen_net_path="plugins/xenserver/networking/etc/xensource/scripts"
105
102
srcfiles=`find nova -type f -name "*.py"`
106
103
srcfiles+=" `find bin -type f ! -name "nova.conf*" ! -name "*api-paste.ini*"`"
107
104
srcfiles+=" `find tools -type f -name "*.py"`"
108
 
srcfiles+=" `find ${xen_api_path} ${xen_net_path} -type f ! -name "*.patch" ! -name "*.pyc"`"
109
105
srcfiles+=" setup.py"
110
106
 
111
107
function run_pep8 {
112
 
  echo "Running pep8 ..."
 
108
  echo "Running PEP8 and HACKING compliance check..."
113
109
  # Just run PEP8 in current environment
114
110
  #
115
 
  # NOTE(sirp): W602 (deprecated 3-arg raise) is being ignored for the
116
 
  # following reasons:
117
 
  #
118
 
  #  1. It's needed to preserve traceback information when re-raising
119
 
  #     exceptions; this is needed b/c Eventlet will clear exceptions when
120
 
  #     switching contexts.
121
 
  #
122
 
  #  2. There doesn't appear to be an alternative, "pep8-tool" compatible way of doing this
123
 
  #     in Python 2 (in Python 3 `with_traceback` could be used).
124
 
  #
125
 
  #  3. Can find no corroborating evidence that this is deprecated in Python 2
126
 
  #     other than what the PEP8 tool claims. It is deprecated in Python 3, so,
127
 
  #     perhaps the mistake was thinking that the deprecation applied to Python 2
128
 
  #     as well.
129
 
  pep8_opts="--ignore=W602 --repeat"
130
 
  ${wrapper} pep8 ${pep8_opts} ${srcfiles}
131
 
}
132
111
 
133
 
function run_hacking {
134
 
  echo "Running hacking compliance testing..."
135
 
  hacking_opts="--ignore=E202,W602 --repeat"
136
 
  ${wrapper} python tools/hacking.py ${hacking_opts} ${srcfiles}
 
112
  # Until all these issues get fixed, ignore.
 
113
  ignore='--ignore=N4'
 
114
  ${wrapper} python tools/hacking.py ${ignore} ${srcfiles}
137
115
}
138
116
 
139
117
 
175
153
    exit
176
154
fi
177
155
 
178
 
if [ $just_hacking -eq 1 ]; then
179
 
    run_hacking
180
 
    exit
181
 
fi
182
 
 
183
 
 
184
156
if [ $recreate_db -eq 1 ]; then
185
157
    rm -f tests.sqlite
186
158
fi
199
171
 
200
172
if [ $coverage -eq 1 ]; then
201
173
    echo "Generating coverage report in covhtml/"
202
 
    ${wrapper} coverage html -d covhtml -i
 
174
    # Don't compute coverage for common code, which is tested elsewhere
 
175
    ${wrapper} coverage html --include='nova/*' --omit='nova/openstack/common/*' -d covhtml -i
203
176
fi