Skip to content

Commit

Permalink
Reduce --coverage related timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
tysmith committed Sep 29, 2023
1 parent f049c51 commit d6be27d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions grizzly/target/puppet_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def handle_hang(self, ignore_idle=True, ignore_timeout=False):
self.close()
return was_idle

def dump_coverage(self, timeout=90):
def dump_coverage(self, timeout=5):
if system() != "Linux":
LOG.debug("dump_coverage() only supported on Linux")
return
Expand Down Expand Up @@ -276,6 +276,7 @@ def dump_coverage(self, timeout=90):
and any(x.path.endswith(".gcda") for x in proc.info["open_files"])
):
gcda_found = True
# TODO: collect all process with open files
# collect pid of process with open .gcda file
gcda_open = proc.info["pid"]
break
Expand All @@ -288,20 +289,21 @@ def dump_coverage(self, timeout=90):
LOG.debug("gcda dump took %0.2fs", elapsed)
break
if elapsed >= timeout:
# timeout waiting for .gnco file to be written
# timeout waiting for .gcda file to be written
LOG.warning(
"gcda file open by pid %d after %0.2fs", gcda_open, elapsed
)
try:
kill(gcda_open, SIGABRT)
wait_procs([Process(gcda_open)], timeout=15)
# wait for logs
wait_procs([Process(gcda_open)], timeout=5)
except (AccessDenied, NoSuchProcess, OSError): # pragma: no cover
pass
self.close()
break
if delay < 1.0:
# increase delay to a maximum of 1 second
# it is increased when waiting for the .gcno files to be written
# it is increased when waiting for the .gcda files to be written
# this decreases the number of calls to process_iter()
delay = min(1.0, delay + 0.1)
elif elapsed >= 10:
Expand Down

0 comments on commit d6be27d

Please sign in to comment.