Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions php/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
TEST_DIRS = [
"Zend/tests",
"tests",
"ext/date/tests"
"ext/dom/tests"
"ext/date/tests",
"ext/dom/tests",
"ext/libxml/tests",
"ext/json/tests",
"ext/phar/tests",
Expand All @@ -47,14 +47,13 @@ def cmd(cmd):

if __name__ == "__main__":
bug_rev = os.environ.get('BUG_REVISION')
fix_rev = os.environ.get('FIX_REVISION')

with open('/experiment/manifest.txt', 'r') as f:
buggy_files = [l.strip() for l in f]

# handle nasty scenarios
if bug_rev in NASTY_REVISIONS:
cmd('cd /experiment/src && git reset --hard && git clean -fd')
cmd('cd /experiment/src && git checkout "{}"'.format(bug_rev))
cmd('cd /experiment/src && git reset --hard && git clean -fd')
cmd('cd /experiment/src && git checkout "{}"'.format(bug_rev))

# apply libxml fix
cmd('cd /experiment/src && cat ../libxml.patch | patch -p0')
Expand All @@ -63,19 +62,23 @@ def cmd(cmd):
cmd('cd /experiment/src && ./buildconf')

# preprocess
if bug_rev in NASTY_REVISIONS:
cmd('cd /experiment/src && ./configure CFLAGS="-save-temps=obj"')
cmd('cd /experiment/src && make -j{}'.format(multiprocessing.cpu_count()))
cmd('cd /experiment/src && ./configure CFLAGS="-save-temps=obj"')
cmd('cd /experiment/src && make -j{}'.format(multiprocessing.cpu_count()))

for fn in buggy_files:
source_fn = fn.replace('.c', '.i').replace('.h', '.i')
source_fn = os.path.join('/experiment/src', source_fn)
target_fn = os.path.join('/experiment/preprocessed', fn)
os.remove(target_fn)
os.rename(source_fn, target_fn)

for fn in buggy_files:
source_fn = fn.replace('.c', '.i').replace('.h', '.i')
source_fn = os.path.join('/experiment/src', source_fn)
target_fn = os.path.join('/experiment/preprocessed', fn)
os.remove(target_fn)
os.rename(source_fn, target_fn)
cmd('cd /experiment/src && make distclean')

cmd('cd /experiment/src && make distclean')
cmd('cd /experiment/src && find . -name tests -type d -exec git checkout {} {{}} \;'.format(fix_rev))

# configure and build source code
cmd('cd /experiment/src && ./configure')
if bug_rev in ['74343ca506', '8138f7de40']:
cmd('cd /experiment/src && ./configure --disable-phar "CFLAGS=-fprofile-arcs -ftest-coverage" "CXXFLAGS=-fprofile-arcs -ftest-coverage" "LDFLAGS=-lgcov"')
else:
cmd('cd /experiment/src && ./configure "CFLAGS=-fprofile-arcs -ftest-coverage" "CXXFLAGS=-fprofile-arcs -ftest-coverage" "LDFLAGS=-lgcov"')
cmd('cd /experiment/src && make -j{}'.format(multiprocessing.cpu_count()))
4 changes: 3 additions & 1 deletion php/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import subprocess
import signal

from subprocess import Popen, PIPE

Expand Down Expand Up @@ -79,7 +80,8 @@ def run(identifier, exe=None):
return outcome in ["PASS", "SKIP"]

except subprocess.TimeoutExpired:
os.killpg(p.pid, signal.SIGKILL)
os.system("killall -9 php")
os.kill(p.pid, signal.SIGTERM)
return False

except:
Expand Down