update debug logs and mutant counters

pull/2302/head
bohendo 9 months ago
parent 5d43f9e28e
commit 69748c8aa3
No known key found for this signature in database
  1. 3
      slither/tools/mutator/__main__.py
  2. 11
      slither/tools/mutator/mutators/abstract_mutator.py

@ -245,14 +245,17 @@ def main() -> (None): # pylint: disable=too-many-statements,too-many-branches,t
total_mutant_counts[0] += total_counts[0]
valid_mutant_counts[0] += valid_counts[0]
logger.info(f"Mutator {m.NAME} found {valid_counts[0]} uncaught revert mutants (out of {total_counts[0]} that compile)")
logger.info(f"Running total: found {valid_mutant_counts[0]} uncaught revert mutants (out of {total_mutant_counts[0]} that compile)")
elif m.NAME == "CR":
total_mutant_counts[1] += total_counts[1]
valid_mutant_counts[1] += valid_counts[1]
logger.info(f"Mutator {m.NAME} found {valid_counts[1]} uncaught comment mutants (out of {total_counts[1]} that compile)")
logger.info(f"Running total: found {valid_mutant_counts[1]} uncaught comment mutants (out of {total_mutant_counts[1]} that compile)")
else:
total_mutant_counts[2] += total_counts[2]
valid_mutant_counts[2] += valid_counts[2]
logger.info(f"Mutator {m.NAME} found {valid_counts[2]} uncaught tweak mutants (out of {total_counts[2]} that compile)")
logger.info(f"Running total: found {valid_mutant_counts[2]} uncaught tweak mutants (out of {total_mutant_counts[2]} that compile)")
dont_mutate_lines = lines_list
if not quick_flag:

@ -19,13 +19,6 @@ class AbstractMutator(
): # pylint: disable=too-few-public-methods,too-many-instance-attributes
NAME = ""
HELP = ""
VALID_MUTANTS_COUNT = 0
VALID_RR_MUTANTS_COUNT = 0
VALID_CR_MUTANTS_COUNT = 0
# total revert/comment/tweak mutants that were generated and compiled
total_mutant_counts = [0, 0, 0]
# total valid revert/comment/tweak mutants
valid_mutant_counts = [0, 0, 0]
def __init__( # pylint: disable=too-many-arguments
self,
@ -55,6 +48,10 @@ class AbstractMutator(
self.in_file = self.contract.source_mapping.filename.absolute
self.in_file_str = self.contract.compilation_unit.core.source_code[self.in_file]
self.dont_mutate_line = dont_mutate_line
# total revert/comment/tweak mutants that were generated and compiled
self.total_mutant_counts = [0, 0, 0]
# total valid revert/comment/tweak mutants
self.valid_mutant_counts = [0, 0, 0]
if not self.NAME:
raise IncorrectMutatorInitialization(

Loading…
Cancel
Save