Skip to content

Commit 8605a05

Browse files
committed
add quick mutation testing to travis
1 parent 89de714 commit 8605a05

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

.travis.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ addons:
1212
- libmpc-dev
1313
before_cache:
1414
- rm -f $HOME/.cache/pip/log/debug.log
15-
# place the slowest (instrumental and py2.6) first
15+
# place the slowest (instrumental, mutation and py2.6) first
1616
matrix:
1717
include:
18+
- python: 3.7
19+
dist: xenial
20+
sudo: true
21+
env: MUTATION=yes
1822
- python: 2.7
1923
env: INSTRUMENTAL=yes
2024
- python: 2.6
@@ -100,12 +104,13 @@ install:
100104
- if [[ $TOX_ENV =~ gmpy2 ]]; then travis_retry pip install gmpy2; fi
101105
- if [[ $TOX_ENV =~ gmpyp ]]; then travis_retry pip install gmpy; fi
102106
- if [[ $INSTRUMENTAL ]]; then travis_retry pip install instrumental; fi
107+
- if [[ $MUTATION ]]; then travis_retry pip install cosmic-ray gmpy2; fi
103108
- pip list
104109
script:
105110
- if [[ $TOX_ENV ]]; then tox -e $TOX_ENV; fi
106-
- if [[ $TOX_ENV =~ gmpy2 ]]; then tox -e speedgmpy2; fi
107-
- if [[ $TOX_ENV =~ gmpyp ]]; then tox -e speedgmpy; fi
108-
- if ! [[ $TOX_ENV =~ gmpy ]]; then tox -e speed; fi
111+
- if [[ $TOX_ENV =~ gmpy2 ]] && [[ -z $MUTATION ]]; then tox -e speedgmpy2; fi
112+
- if [[ $TOX_ENV =~ gmpyp ]] && [[ -z $MUTATION ]]; then tox -e speedgmpy; fi
113+
- if ! [[ $TOX_ENV =~ gmpy ]] && [[ -z $MUTATION ]]; then tox -e speed; fi
109114
- |
110115
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
111116
git checkout $PR_FIRST^
@@ -129,6 +134,26 @@ script:
129134
if [[ $INSTRUMENTAL && $TRAVIS_PULL_REQUEST != "false" ]]; then
130135
instrumental -f .instrumental.cov -s | python diff-instrumental.py --read .diff-instrumental --fail-under 70 --max-difference -0.1
131136
fi
137+
# cosmic-ray (mutation testing) runs
138+
- if [[ $MUTATION ]]; then cosmic-ray init cosmic-ray.toml session.sqlite; fi
139+
- if [[ $MUTATION ]]; then cosmic-ray baseline --report session.sqlite; fi
140+
- if [[ $MUTATION ]]; then cr-report --show-output session.baseline.sqlite; fi
141+
- |
142+
if [[ $MUTATION ]]; then
143+
cosmic-ray exec session.sqlite &
144+
COSMIC_PID=$!
145+
# make sure that we output something every 5 minutes (otherwise travis will kill us)
146+
while kill -s 0 $COSMIC_PID; do
147+
sleep 300
148+
cr-report session.sqlite | tail -n 3;
149+
done &
150+
REPORT_PID=$!
151+
# kill exec after 25 minutes
152+
(sleep $((60*25)); kill $COSMIC_PID) &
153+
fi
154+
- if [[ $MUTATION ]]; then wait $COSMIC_PID ; kill $REPORT_PID ; true; fi
155+
- if [[ $MUTATION ]]; then cr-report --show-output session.sqlite | tail -n 40; fi
156+
- if [[ $MUTATION ]]; then cr-rate --estimate --fail-over 25 --confidence 99.9 session.sqlite; fi
132157
after_success:
133-
- if [[ -z $INSTRUMENTAL ]]; then coveralls; fi
158+
- if [[ -z $INSTRUMENTAL && -z $MUTATION ]]; then coveralls; fi
134159

cosmic-ray.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ cr-report --show-output session.baseline.sqlite
77
cosmic-ray exec session.sqlite
88
cr-report session.sqlite
99
cr-html session.sqlite > session.html
10+
cr-rate --estimate --fail-over 25 --confidence 99.9 session.sqlite

cosmic-ray.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[cosmic-ray]
22
module-path = "src"
33
python-version = ""
4-
timeout = 120.0
4+
timeout = 30.0
55
exclude-modules = ['src/ecdsa/_version.py', 'src/ecdsa/test*']
66
test-command = "pytest -x src/"
77

0 commit comments

Comments
 (0)