本文整理汇总了Java中gov.nasa.jpf.JPF类的典型用法代码示例。如果您正苦于以下问题:Java JPF类的具体用法?Java JPF怎么用?Java JPF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JPF类属于gov.nasa.jpf包,在下文中一共展示了JPF类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: HeuristicListener
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public HeuristicListener(Config jpfConf, JPF jpf) {
super(jpfConf, jpf);
policiesEnabled = jpfConf.getBoolean(WorstCaseAnalyzer.ENABLE_POLICIES, WorstCaseAnalyzer.ENABLE_POLICIES_DEF);
if (policiesEnabled) {
PolicyManager policyManager = new PolicyManager(new File(getSerializedInputDir(jpfConf)));
try {
this.heuristicPolicy = policyManager.loadPolicy(measuredMethods, Policy.class);
} catch (IOException | PolicyManagerException e) {
logger.severe(e.getMessage());
throw new RuntimeException(e);
}
}
// Set termination strategy
this.terminationStrategy = jpfConf.getInstance(TERMINATION_STRATEGY_CONF,
TerminationStrategy.class, DEFAULT_TERMINATION_STRATEGY);
}
开发者ID:isstac,项目名称:spf-wca,代码行数:20,代码来源:HeuristicListener.java
示例2: generateJPFConfig
import gov.nasa.jpf.JPF; //导入依赖的package包/类
/**
* generates a jpf config corresponding to this configuration
*
* @param conf
* @return
*/
public Config generateJPFConfig(Config conf) {
Config newConf = new Config("");
if(conf != null) {
newConf.putAll(conf);
newConf.setClassLoader(conf.getClassLoader());
}
else {
newConf.initClassLoader(JPF.class.getClassLoader());
}
StringBuilder sb = new StringBuilder();
boolean first = true;
for(ConcolicMethodConfig mc : concolicMethods.values()) {
generatePerturbConfig(mc, newConf);
if(first)
first = false;
else
sb.append(',');
sb.append(mc.getId());
}
newConf.setProperty("perturb.params", sb.toString());
return newConf;
}
开发者ID:psycopaths,项目名称:jdart,代码行数:32,代码来源:ConcolicConfig.java
示例3: log__Ljava_lang_String_2ILjava_lang_String_2_3Ljava_lang_Object_2__V
import gov.nasa.jpf.JPF; //导入依赖的package包/类
@MJI
public static void log__Ljava_lang_String_2ILjava_lang_String_2_3Ljava_lang_Object_2__V (MJIEnv env, int clsObjRef,
int loggerIdRef, int logLevel, int fmtRef, int argsRef){
String loggerId = env.getStringObject(loggerIdRef);
String fmt = env.getStringObject(fmtRef);
JPFLogger logger = JPF.getLogger(loggerId);
int[] argRefs = env.getReferenceArrayObject( argsRef);
Object[] args = new Object[argRefs.length];
for (int i=0; i<args.length; i++){
ElementInfo eiArg = env.getElementInfo(argRefs[i]);
if (eiArg.isStringObject()){
args[i] = env.getStringObject(argRefs[i]);
} else if (eiArg.isBoxObject()){
args[i] = eiArg.asBoxObject();
} else {
args[i] = eiArg.toString();
}
}
String msg = String.format(fmt, args);
log( logger, logLevel, msg);
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:25,代码来源:JPF_gov_nasa_jpf_vm_Verify.java
示例4: CoverageAnalyzer
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public CoverageAnalyzer(Config conf, JPF jpf) {
includes = StringSetMatcher.getNonEmpty(conf.getStringArray("coverage.include"));
excludes = StringSetMatcher.getNonEmpty(conf.getStringArray("coverage.exclude"));
showMethods = conf.getBoolean("coverage.show_methods", false);
showMethodBodies = conf.getBoolean("coverage.show_bodies", false);
excludeHandlers = conf.getBoolean("coverage.exclude_handlers", false);
showBranchCoverage = conf.getBoolean("coverage.show_branches", true);
loadedOnly = conf.getBoolean("coverage.loaded_only", true);
showRequirements = conf.getBoolean("coverage.show_requirements", false);
if (!loadedOnly) {
getCoverageCandidates(); // this might take a little while
}
jpf.addPublisherExtension(ConsolePublisher.class, this);
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:18,代码来源:CoverageAnalyzer.java
示例5: PathOutputMonitor
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public PathOutputMonitor (Config config, JPF jpf) {
vm = jpf.getVM();
vm.storePathOutput();
jpf.addPublisherExtension(ConsolePublisher.class, this);
printOutput = config.getBoolean("pom.print_output", true);
deferOutput = config.getBoolean("pom.defer_output", true);
psClass = config.getClass("pom.output_spec.class", PathOutputSpec.class);
if (psClass == null) {
psClass = RegexOutputSpec.class;
}
anySpecs = loadSpecs(config, "pom.any");
allSpecs = loadSpecs(config, "pom.all");
noneSpecs = loadSpecs(config, "pom.none");
violatedSpecs = new ArrayList<PathOutputSpec>();
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:22,代码来源:PathOutputMonitor.java
示例6: SimpleDot
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public SimpleDot( Config config, JPF jpf){
graphAttrs = config.getString("dot.graph_attr", GRAPH_ATTRS);
genericNodeAttrs = config.getString("dot.node_attr", GENERIC_NODE_ATTRS);
genericEdgeAttrs = config.getString("dot.edge_attr", GENERIC_EDGE_ATTRS);
newEdgeAttrs = config.getString("dot.new_edge_attr", NEW_EDGE_ATTRS);
visitedEdgeAttrs = config.getString("dot.visited_edge_attr", VISITED_EDGE_ATTRS);
startNodeAttrs = config.getString("dot.start_node_attr", START_NODE_ATTRS);
endNodeAttrs = config.getString("dot.end_node_attr", END_NODE_ATTRS);
errorNodeAttrs = config.getString("dot.error_node_attr", ERROR_NODE_ATTRS);
backtrackEdgeAttrs = config.getString("dot.bt_edge_attr", BACKTRACK_EDGE_ATTRS);
restoreEdgeAttrs = config.getString("dot.restore_edge_attr", RESTORED_EDGE_ATTRS);
printFile = config.getBoolean("dot.print_file", false);
showTarget = config.getBoolean("dot.show_target", false);
// app and filename are not known until the search is started
jpf.addPublisherExtension(ConsolePublisher.class, this);
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:21,代码来源:SimpleDot.java
示例7: ChoiceTracker
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public ChoiceTracker (Config config, JPF jpf) {
this.config = config;
vm = jpf.getVM();
search = jpf.getSearch();
String fname = config.getString("choice.trace");
if (fname == null) {
isReportExtension = true;
jpf.addPublisherExtension(ConsolePublisher.class, this);
// pw is going to be set later
} else {
try {
pw = new PrintWriter(fname);
} catch (FileNotFoundException fnfx) {
System.err.println("cannot write choice trace to file: " + fname);
pw = new PrintWriter(System.out);
}
}
excludes = config.getStringArray("choice.exclude");
cgClasses = config.getClasses("choice.class");
format = config.getEnum("choice.format", Format.values(), Format.CG);
showLocation = config.getBoolean("choice.show_location", true);
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:26,代码来源:ChoiceTracker.java
示例8: ObjectTracker
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public ObjectTracker (Config conf, JPF jpf) {
includeClasses = StringSetMatcher.getNonEmpty(conf.getStringArray("ot.include"));
excludeClasses = StringSetMatcher.getNonEmpty(conf.getStringArray("ot.exclude", new String[] { "*" }));
trackedRefs = new SortedArrayIntSet();
int[] refs = conf.getIntArray("ot.refs");
if (refs != null){
for (int i=0; i<refs.length; i++){
trackedRefs.add(refs[i]);
}
}
logCalls = conf.getBoolean("ot.log_calls", true);
logFieldAccess = conf.getBoolean("ot.log_fields", true);
registerListener(jpf);
jpf.addPublisherExtension(ConsolePublisher.class, this);
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:20,代码来源:ObjectTracker.java
示例9: BudgetChecker
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public BudgetChecker (Config conf, JPF jpf) {
//--- get the configured budget limits (0 means not set)
maxTime = conf.getDuration("budget.max_time", 0);
maxHeap = conf.getMemorySize("budget.max_heap", 0);
maxDepth = conf.getInt("budget.max_depth", 0);
maxInsn = conf.getLong("budget.max_insn", 0);
maxState = conf.getInt("budget.max_state", 0);
maxNewStates = conf.getInt("budget.max_new_states", 0);
tStart = System.currentTimeMillis();
if (maxHeap > 0) {
mxb = ManagementFactory.getMemoryMXBean();
muStart = mxb.getHeapMemoryUsage();
mStart = muStart.getUsed();
}
search = jpf.getSearch();
vm = jpf.getVM();
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:22,代码来源:BudgetChecker.java
示例10: TraceStorer
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public TraceStorer (Config config, JPF jpf){
traceFileName = config.getString("trace.file", "trace");
storeMultiple = config.getBoolean("trace.multiple", false);
storeDepth = config.getInt("trace.depth", Integer.MAX_VALUE);
verbose = config.getBoolean("trace.verbose", false);
terminateOnStore = config.getBoolean("trace.terminate", false);
storeOnConstraintHit = config.getBoolean("trace.store_constraint", false);
storeCalls = StringSetMatcher.getNonEmpty(config.getStringArray("trace.store_calls"));
storeThreads = StringSetMatcher.getNonEmpty(config.getStringArray("trace.store_threads"));
vm = jpf.getVM();
search = jpf.getSearch();
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:17,代码来源:TraceStorer.java
示例11: getRevision
import gov.nasa.jpf.JPF; //导入依赖的package包/类
protected String getRevision() {
try {
InputStream is = JPF.class.getResourceAsStream(".version");
if (is != null){
int len = is.available();
byte[] data = new byte[len];
is.read(data);
is.close();
return new String(data).trim();
} else {
return null;
}
} catch (Throwable t){
return null;
}
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:19,代码来源:Reporter.java
示例12: getRepositoryInfo
import gov.nasa.jpf.JPF; //导入依赖的package包/类
protected String getRepositoryInfo() {
try {
InputStream is = JPF.class.getResourceAsStream("build.properties");
if (is != null){
Properties revInfo = new Properties();
revInfo.load(is);
StringBuffer sb = new StringBuffer();
String date = revInfo.getProperty("date");
String author = revInfo.getProperty("author");
String rev = revInfo.getProperty("rev");
String machine = revInfo.getProperty("hostname");
String loc = revInfo.getProperty("location");
String upstream = revInfo.getProperty("upstream");
return String.format("%s %s %s %s %s", date,author,rev,machine,loc);
}
} catch (IOException iox) {
return null;
}
return null;
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:24,代码来源:Reporter.java
示例13: noPropertyViolation
import gov.nasa.jpf.JPF; //导入依赖的package包/类
/**
* run JPF expecting no SuT property violations
*/
protected JPF noPropertyViolation (StackTraceElement testMethod, String... args) {
JPF jpf = null;
report(args);
try {
jpf = createAndRunJPF( testMethod, args);
} catch (Throwable t) {
// we get as much as one little hickup and we declare it failed
t.printStackTrace();
fail("JPF internal exception executing: ", args, t.toString());
return jpf;
}
List<Error> errors = jpf.getSearchErrors();
if ((errors != null) && (errors.size() > 0)) {
fail("JPF found unexpected errors: " + (errors.get(0)).getDescription());
}
return jpf;
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:25,代码来源:TestJPF.java
示例14: jpfException
import gov.nasa.jpf.JPF; //导入依赖的package包/类
/**
* run JPF expecting it to throw an exception
* NOTE - xClassName needs to be the concrete exception, not a super class
* @param args JPF main() arguments
*/
protected JPF jpfException (StackTraceElement testMethod, Class<? extends Throwable> xCls, String... args) {
JPF jpf = null;
Throwable exception = null;
report(args);
try {
jpf = createAndRunJPF( testMethod, args);
} catch (JPF.ExitException xx) {
exception = xx.getCause();
} catch (Throwable x) {
exception = x;
}
if (exception != null){
if (!xCls.isAssignableFrom(exception.getClass())){
fail("JPF produced wrong exception: " + exception + ", expected: " + xCls.getName());
}
} else {
fail("JPF failed to produce exception, expected: " + xCls.getName());
}
return jpf;
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:30,代码来源:TestJPF.java
示例15: propertyViolation
import gov.nasa.jpf.JPF; //导入依赖的package包/类
/**
* run JPF expecting a property violation of the SuT
* @param args JPF main() arguments
*/
protected JPF propertyViolation (StackTraceElement testMethod, Class<? extends Property> propertyCls, String... args ){
JPF jpf = null;
report(args);
try {
jpf = createAndRunJPF( testMethod, args);
} catch (Throwable t) {
t.printStackTrace();
fail("JPF internal exception executing: ", args, t.toString());
}
List<Error> errors = jpf.getSearchErrors();
if (errors != null) {
for (Error e : errors) {
if (propertyCls == e.getProperty().getClass()) {
return jpf; // success, we got the sucker
}
}
}
fail("JPF failed to detect error: " + propertyCls.getName());
return jpf;
}
开发者ID:grzesuav,项目名称:gjpf-core,代码行数:29,代码来源:TestJPF.java
示例16: getJPFBanner
import gov.nasa.jpf.JPF; //导入依赖的package包/类
public String getJPFBanner () {
StringBuilder sb = new StringBuilder();
sb.append("JavaPathfinder core system v");
sb.append(JPF.VERSION);
String rev = getRevision();
if (rev != null){
sb.append(" (rev ");
sb.append(rev);
sb.append(')');
}
sb.append(" - (C) 2005-2014 United States Government. All rights reserved.");
if (conf.getBoolean("report.show_repository", false)) {
String repInfo = getRepositoryInfo();
if (repInfo != null) {
sb.append( repInfo);
}
}
return sb.toString();
}
开发者ID:grzesuav,项目名称:jpf-core,代码行数:25,代码来源:Reporter.java
示例17: performAnalysis
import gov.nasa.jpf.JPF; //导入依赖的package包/类
private DataCollection performAnalysis(Config jpfConf) {
boolean noSolver = jpfConf.getBoolean(NO_SOLVER_HEURISTIC_CONF, false);
if (noSolver) {
jpfConf.setProperty("symbolic.dp", "no_solver");
}
int maxInput = jpfConf.getInt(MAX_INPUT_CONF);
jpfConf.setProperty("report.console.class", HeuristicResultsPublisher.class.getName());
DataCollection dataCollection = new DataCollection();
for (int inputSize = this.startAt; inputSize <= maxInput; inputSize += this.incr) {//TODO: should maxInput be included?
logger.info("Exploring with heuristic input size " + inputSize + "...");
jpfConf.setProperty("target.args", "" + inputSize);
JPF jpf = new JPF(jpfConf);
HeuristicListener heuristic = new HeuristicListener(jpfConf, jpf);
jpf.addListener(heuristic); //weird instantiation...
//explore guided by policy
long start = System.currentTimeMillis();
runJPF(jpf);
long end = System.currentTimeMillis();
logger.info("Heuristic exploration at input size " + inputSize + " done. Took " + ((end - start) / 1000) + "s");
WorstCasePath wcPath = heuristic.getWcPath();
if (wcPath == null) {
logger.severe("No worst case path found for input size " + inputSize);
} else {
State wcState = wcPath.getWCState();
dataCollection.addDatapoint(inputSize, wcState.getWC());
}
}
return dataCollection;
}
开发者ID:isstac,项目名称:spf-wca,代码行数:36,代码来源:WorstCaseAnalyzer.java
示例18: runJPF
import gov.nasa.jpf.JPF; //导入依赖的package包/类
private void runJPF(JPF jpf) {
try {
jpf.run();
} catch (Exception e) {
throw new WCAException("jpf-core threw exception", e);
}
}
开发者ID:isstac,项目名称:spf-wca,代码行数:8,代码来源:WorstCaseAnalyzer.java
示例19: start
import gov.nasa.jpf.JPF; //导入依赖的package包/类
@Override
public void start(String[] args) {
this.conf.setProperty("report.console.class", PolicyResultsPublisher.class.getName());
for(int i = this.from; i <= this.to; i++) {
this.conf.setProperty("target.args", ""+i);
JPF jpf = new JPF(this.conf);
jpf.addListener(new PolicyGeneratorListener(this.conf, jpf)); //weird instantiation...
//get policy
jpf.run();
}
}
开发者ID:isstac,项目名称:spf-wca,代码行数:12,代码来源:AllPoliciesExtractor.java
示例20: JDart
import gov.nasa.jpf.JPF; //导入依赖的package包/类
/**
* Constructor. Initializes JDart from a JPF config only.
*
* @param conf the JPF config
*/
public JDart(Config conf) {
//this(conf, true);
// due to some bug the log manager has to be initialized first.
LogManager.init(conf);
this.config = conf;
this.cc = new ConcolicConfig(conf);
logger = JPF.getLogger("jdart");
}
开发者ID:psycopaths,项目名称:jdart,代码行数:14,代码来源:JDart.java
注:本文中的gov.nasa.jpf.JPF类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论