...
 
Commits (1)
#!/usr/bin/env python
"""
backfill.py - runs code coverage
Copyright (C) 2017 Kunal Mehta <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import datetime
import os
import subprocess
from grab_from_jenkins import strip_clover
IMAGE_NAME = 'coverage'
path = 'mediawiki'
def run(back):
name = 'backfill-%s' % back
print(name)
args = [
'docker', 'run', '--name=%s' % name,
'--env', 'BACKFILL=%s' % back,
IMAGE_NAME
]
subprocess.call(args)
subprocess.check_call([
'docker', 'cp',
'%s:/mw/git_time' % name,
'/tmp/%s' % name
])
with open('/tmp/%s' % name) as f:
git_time = int(f.read())
dt = datetime.datetime.utcfromtimestamp(git_time)
fname = os.path.join(path, 'clover-%s.xml' % str(dt).split(' ')[0])
subprocess.check_call([
'docker', 'cp',
'%s:/mw/mediawiki/log/clover.xml' % name,
fname
])
strip_clover(fname)
print('Saved %s' % fname)
if __name__ == '__main__':
start = 400
try:
while True:
run(start)
start += 25
finally:
print(start)
FROM wmfreleng/composer:latest
USER root
RUN apt-get update && \
apt-get install --yes \
php7.0-apcu php7.0-intl djvulibre-bin imagemagick libimage-exiftool-perl && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN phpenmod xdebug
RUN mkdir /mw
RUN chmod 777 -R /mw
USER nobody
RUN cd /mw && \
git clone https://gerrit.wikimedia.org/r/mediawiki/core mediawiki
RUN cd /mw/mediawiki && composer install
COPY run.sh /mw/run.sh
COPY SomeSettings.php /mw/SomeSettings.php
ENTRYPOINT ["/bin/bash"]
CMD ["/mw/run.sh"]
// Debugging: PHP
error_reporting( -1 );
ini_set( 'display_errors', 1 );
// Debugging: MediaWiki
$wgDevelopmentWarnings = true;
$wgShowDBErrorBacktrace = true;
$wgShowExceptionDetails = true;
$wgShowSQLErrors = true;
$wgDebugRawPage = true; // bug 47960
$wgDebugTimestamps = true;
// Be strict about class name letter-case.
$wgAutoloadAttemptLowercase = false;
$wgWikimediaJenkinsCI = true;
$wgDjvuDump = '/usr/bin/djvudump';
$wgDjvuRenderer = '/usr/bin/ddjvu';
$wgDjvuToXML = '/usr/bin/djvutoxml';
$wgDjvuTxt = '/usr/bin/djvutxt';
#!/bin/bash
set -e
cd /mw/mediawiki
git checkout HEAD~$BACKFILL
sed -i 's/verbose="false"/verbose="true"/' tests/phpunit/suite.xml
composer update
git log --format='%ct' -n 1 > /mw/git_time
mkdir data
php maintenance/install.php --confpath . --dbpath data --dbtype sqlite --pass password1 Coverage Administrator
cat ../SomeSettings.php >> LocalSettings.php
php -l LocalSettings.php
php maintenance/update.php --quick
php maintenance/getText.php "Main Page" | grep "MediaWiki has been installed"
mkdir -p log
time php tests/phpunit/phpunit.php \
--exclude-group Dump,Broken,ParserFuzz,Stub \
--coverage-clover log/clover.xml