~jocave/checkbox/hybrid-amd-gpu-mods

« back to all changes in this revision

Viewing changes to support/test-with-coverage

  • Committer: Zygmunt Krynicki
  • Date: 2014-02-24 20:36:43 UTC
  • mto: This revision was merged to the branch mainline in revision 2710.
  • Revision ID: zygmunt.krynicki@canonical.com-20140224203643-rntaae2va1sjfqdw
support: beef up test-with-coverage

This patch makes test-with-coverage work in practice in various situations
and makes it generic (well, almost) to other parts of checkbox.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# This file is part of Checkbox.
 
3
#
 
4
# Copyright 2013 Canonical Ltd.
 
5
# Written by:
 
6
#   Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
 
7
#
 
8
# Checkbox is free software: you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation, either version 3 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# Checkbox is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
 
20
 
 
21
# Helper script to run coverage testing
 
22
# =====================================
 
23
 
 
24
# XXX: Requires activated virtualenv with coverage
 
25
# It *may* work in other situations so this is not enforced
 
26
 
 
27
# Disable all kinds of locale support
 
28
export LANG=
 
29
export LANGUAGE=
 
30
export LC_ALL=C.UTF-8
 
31
 
 
32
# On recent enough Debian/Ubuntu you can run this with python3-coverage (or
 
33
# python3.4-coverage) to run coverage with standard packages, without
 
34
# virtualenv. Everywhere else the default 'coverage3' should work fine.
 
35
#
 
36
# Because python3-coverage is still broken
 
37
coverage=${1:-coverage3}
 
38
 
 
39
# Run plainbox self-test, pass --after-reexec to fake the internal re-exec that
 
40
# it performs (this seems to fail when invoked this way as it assumes it knows
 
41
# to run plainbox self-test which we are not doing here)
 
42
$coverage run --branch --module plainbox self-test \
 
43
    --after-reexec \
 
44
    --fail-fast \
 
45
    --quiet \
 
46
    --unit-tests
 
47
 
 
48
# Run integrations tests as well, unless --skip-integration
 
49
if [ "$1" != "--skip-integration" ]; then
 
50
    $coverage run --append --branch $(which plainbox) self-test \
 
51
        --after-reexec \
 
52
        --integration-tests \
 
53
        --fail-fast \
 
54
        --quiet
 
55
fi
 
56
 
 
57
# Display the non-html report
 
58
$coverage report
 
59
 
 
60
# Generate the HTML report
 
61
rm -rf htmlcov
 
62
$coverage html
 
63
echo "The HTML report is now ready in htmlcov"