当前位置: 首页>>代码示例>>Java>>正文


Java JPF类代码示例

本文整理汇总了Java中gov.nasa.jpf.JPF的典型用法代码示例。如果您正苦于以下问题:Java JPF类的具体用法?Java JPF怎么用?Java JPF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JPF类属于gov.nasa.jpf包,在下文中一共展示了JPF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的gov.nasa.jpf.JPF类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。