1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package dexfuzz.listeners; 18 19 import dexfuzz.ExecutionResult; 20 import dexfuzz.executors.Executor; 21 import dexfuzz.program.Mutation; 22 23 import java.util.List; 24 import java.util.Map; 25 26 /** 27 * Base class for Listeners, who are notified about certain events in dexfuzz's execution. 28 */ 29 public abstract class BaseListener { setup()30 public void setup() { } 31 shutdown()32 public void shutdown() { } 33 handleSuccessfulHostVerification()34 public void handleSuccessfulHostVerification() { } 35 handleFailedHostVerification(ExecutionResult verificationResult)36 public void handleFailedHostVerification(ExecutionResult verificationResult) { } 37 handleFailedTargetVerification()38 public void handleFailedTargetVerification() { } 39 handleIterationStarted(int iteration)40 public void handleIterationStarted(int iteration) { } 41 handleIterationFinished(int iteration)42 public void handleIterationFinished(int iteration) { } 43 handleTimeouts(List<Executor> timedOut, List<Executor> didNotTimeOut)44 public void handleTimeouts(List<Executor> timedOut, List<Executor> didNotTimeOut) { } 45 handleDivergences(Map<String, List<Executor>> outputMap)46 public void handleDivergences(Map<String, List<Executor>> outputMap) { } 47 handleFuzzingFile(String inputFile)48 public void handleFuzzingFile(String inputFile) { } 49 handleSeed(long seed)50 public void handleSeed(long seed) { } 51 handleHostVerificationSigabort(ExecutionResult verificationResult)52 public void handleHostVerificationSigabort(ExecutionResult verificationResult) { } 53 handleSuccess(Map<String, List<Executor>> outputMap)54 public void handleSuccess(Map<String, List<Executor>> outputMap) { } 55 handleDumpOutput(String outputLine, Executor executor)56 public void handleDumpOutput(String outputLine, Executor executor) { } 57 handleDumpVerify(String verifyLine)58 public void handleDumpVerify(String verifyLine) { } 59 handleMutationStats(String statsString)60 public void handleMutationStats(String statsString) { } 61 handleTiming(String name, float elapsedTime)62 public void handleTiming(String name, float elapsedTime) { } 63 handleMutationFail()64 public void handleMutationFail() { } 65 handleSummary()66 public void handleSummary() { } 67 handleSuccessfullyFuzzedFile(String programName)68 public void handleSuccessfullyFuzzedFile(String programName) { } 69 handleSelfDivergence()70 public void handleSelfDivergence() { } 71 handleMessage(String msg)72 public void handleMessage(String msg) { } 73 handleMutations(List<Mutation> mutations)74 public void handleMutations(List<Mutation> mutations) { } 75 handleArchitectureSplit()76 public void handleArchitectureSplit() { } 77 } 78