From d6be27df1c3259c8da145b9c2ec5ba2c63fa58d6 Mon Sep 17 00:00:00 2001 From: Tyson Smith Date: Thu, 28 Sep 2023 18:09:47 -0700 Subject: [PATCH] Reduce --coverage related timeouts --- grizzly/target/puppet_target.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/grizzly/target/puppet_target.py b/grizzly/target/puppet_target.py index be241f06..7179440c 100644 --- a/grizzly/target/puppet_target.py +++ b/grizzly/target/puppet_target.py @@ -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 @@ -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 @@ -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: