Skip to content

Commit

Permalink
Avoid triggering latent bug in deinstrumentation method (#184)
Browse files Browse the repository at this point in the history
* implemented time limit in commands

* bug fix: moved time_limit to simple test suite

* added time limits to test execution

* version bump

* fixed sed command and remove gcovr installation

* avoid deinstrument method

* tweaked compiler commands

* bumped version to 2.0.12
  • Loading branch information
ChrisTimperley authored Apr 5, 2018
1 parent 0475ceb commit 68a5489
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
10 changes: 5 additions & 5 deletions bugzoo/compiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ def from_dict(d: dict) -> 'WafCompiler':
return WafCompiler(d['time-limit'])

def __init__(self, time_limit: float) -> None:
cmd = "./waf build -j$(nproc)"
cxxflags = "--coverage -Wno-error=maybe-uninitialized -save-temps=obj"
ldflags = "--coverage"
cmdi = "./waf configure LDFLAGS='{}' CXXFLAGS='{}'; {}".format(ldflags,
cmd = './waf build -j$(nproc)'
cxxflags = '--coverage -Wno-error=maybe-uninitialized -save-temps=obj'
ldflags = '--coverage'
cmdi = './waf configure LDFLAGS="{}" CXXFLAGS="{}"; {}'.format(ldflags,
cxxflags,
cmd)
super().__init__(command=cmd,
Expand All @@ -227,7 +227,7 @@ def __init__(self, time_limit: float) -> None:
cmd = 'make -j$(nproc)'
cflags = "--coverage" # save-temps=obj"
ldflags = "--coverage"
flags = "LDFLAGS='{}' CXXFLAGS='{}' CFLAGS='{}'"
flags = 'LDFLAGS="{}" CXXFLAGS="{}" CFLAGS="{}"'
flags = flags.format(ldflags, cflags, cflags)
cmdi = "make clean; ./configure {}; {}".format(flags, cmd)

Expand Down
15 changes: 9 additions & 6 deletions bugzoo/mgr/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ def coverage(self,
instrumented_files=files_to_instrument)
cov[test.name] = TestCoverage(test.name, outcome, filelines)

self.deinstrument(container,
instrumented_files=files_to_instrument)
# FIXME deinstrument
# self.deinstrument(container,
# instrumented_files=files_to_instrument)

return TestSuiteCoverage(cov)

Expand Down Expand Up @@ -180,8 +181,8 @@ def instrument(self,

# ensure that gcovr is mounted within the container
# TODO: mount binaries
mgr_ctr.command(container,
'sudo apt-get update && sudo apt-get install -y gcovr')
# mgr_ctr.command(container,
# 'sudo apt-get update && sudo apt-get install -y gcovr')

# add instrumentation to each file
dir_source = bug.source_dir
Expand Down Expand Up @@ -215,6 +216,8 @@ def deinstrument(self,
Strips instrumentation from the source code inside a given container,
and reconfigures its program to no longer use coverage options.
"""
raise Exception("contains bug in sed command -- avoid use for now.")

mgr_ctr = self.__installation.containers
mgr_bug = self.__installation.bugs
bug = mgr_bug[container.bug]
Expand All @@ -225,8 +228,8 @@ def deinstrument(self,

# remove source code instrumentation
for fn_instrumented in instrumented_files:
cmd = "sed -i '1,{}d' '{}'"
cmd.format(num_lines_to_remove, fn_instrumented)
cmd = 'sed -i "1,{}d" "{}"'
cmd = cmd.format(num_lines_to_remove, fn_instrumented)
mgr_ctr.command(container, cmd)

# TODO recompile with standard flags
Expand Down
2 changes: 1 addition & 1 deletion bugzoo/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.11'
__version__ = '2.0.12'

0 comments on commit 68a5489

Please sign in to comment.