Skip to content

Commit

Permalink
Write the mutated classes to the properties file; fixes issue #87.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjust committed Aug 9, 2017
1 parent bf5a6b9 commit e4124fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions framework/core/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ $CONFIG_VID
$PROP_FILE
$PROP_EXCLUDE
$PROP_INSTRUMENT
$PROP_MUTATE
$PROP_DIR_SRC_CLASSES
$PROP_DIR_SRC_TESTS
$PROP_CLASSES_MODIFIED
Expand Down
16 changes: 16 additions & 0 deletions framework/core/Project.pm
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,22 @@ Returns the number of generated mutants on success, -1 otherwise.
sub mutate {
@_ == 2 or die $ARG_ERROR;
my ($self, $instrument_classes) = @_;
my $work_dir = $self->{prog_root};

# Read all classes that should be mutated
-e $instrument_classes or die "Classes file ($instrument_classes) does not exist!";
open(IN, "<$instrument_classes") or die "Cannot read $instrument_classes";
my @classes = ();
while(<IN>) {
s/\r?\n//;
push(@classes, $_);
}
close(IN);
# Update properties
my $list = join(",", @classes);
my $config = {$PROP_MUTATE => $list};
Utils::write_config_file("$work_dir/$PROP_FILE", $config);


# Create mutation definitions (mml file)
my $mml_src = "$self->{prog_root}/.mml/default.mml";
Expand Down

0 comments on commit e4124fe

Please sign in to comment.