Skip to content

Commit

Permalink
Add observeGuidance
Browse files Browse the repository at this point in the history
  • Loading branch information
vasumv committed Sep 5, 2024
1 parent 4786c1f commit 6309564
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ public void finalize() {
}
}

@Override
public String observeGuidance() {
return "AFL";
}


/**
* Returns an input stream containing the bytes that AFL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,14 @@ protected void appendLineToFile(File file, String line) throws GuidanceException

}

@Override
public String observeGuidance() {
if (blind) {
return "Random";
}
return "Zest";
}

/* Writes a line of text to the log file. */
protected void infoLog(String str, Object... args) {
if (verbose) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ default void observeGeneratedArgs(Object[] args) {
// Do nothing
}

/**
* <p>This method is only invoked during optional observability
* logging to provide the type of guidance used for input generation.</p>
*/
default String observeGuidance() {
return "";
}

/**
* Handles the end of a fuzzing trial.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,7 @@ public void evaluate() throws Throwable {
observability.addTiming(startTrialTime, endGenerationTime, endTrialTime);
}
observability.addArgs(args);

if (guidance instanceof ZestGuidance) {
observability.add("how_generated", "Zest");
} else if (guidance instanceof NoGuidance) {
observability.add("how_generated", "random");
} else if (guidance instanceof ReproGuidance) {
observability.add("how_generated", "repro");
} else {
observability.add("how_generated", "unknown");
}
observability.add("how_generated", guidance.observeGuidance());

observability.writeToFile();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ public void observeGeneratedArgs(Object[] args) {
}
}

@Override
public String observeGuidance() {
return "Repro";
}

/**
* Writes an object to a file
*
Expand Down

0 comments on commit 6309564

Please sign in to comment.