Exemple #1
0
 function reduce_failure($reason, $bundle)
 {
     inst("reduce failure: {$reason}, {$bundle->subject}");
     global $phc;
     $subject = $bundle->subject;
     if (isset($this->is_special_reduction[$subject])) {
         // Found: we're already reducing, and the bug is kept in
         $this->reduction_result[$subject] = true;
     } else {
         // Start reducing
         try {
             $reduce = new Reduce();
             $this->reductions[$subject] = $reduce;
             $reduce->set_checking_function(array($this, "reduce_checking_function"));
             $reduce->set_run_command_function(array($this, "reduce_run_function"));
             $reduce->set_phc($phc);
             $reduce->set_debug_function(array($this, "reduce_debug_function"));
             // Get the file, and send it to the reducer
             $contents = file_get_contents($subject);
             if (!$reduce->has_syntax_errors($contents)) {
                 $final_contents = $reduce->run_on_php($contents);
                 file_put_contents("{$subject}.{$this->get_name()}_reduced", $final_contents);
             }
         } catch (ReduceException $e) {
             // There can be lots of reasons for this, many benign. Ignore it.
         }
         $this->mark_failure($bundle->subject, $bundle->commands, $bundle->outs, $bundle->errs, $bundle->exits, $reason);
     }
 }
Exemple #2
0
    -u     Used with -i, 'upper's before dumping (not related to -U)
    -F     Mnemonic: Failure. Used for plugins which print "Failure" to
           indicate error. Run phc with the plugin to determine failure.
    -Z     Require script to return zero when run through interpreter

Sample commands:
    reduce -v test/subjects/codegen/0001.php
    reduce "-c--run=plugins/tools/debug_zval.la -dump-xml=plugins/tools/debug_zval.la" test/subjects/codegen/0001.php
    reduce -v 0001.uhir.php
    reduce -F plugins/tests/limit_assignments.la test/subjects/codegen/bench_simple.php

EOL
);
}
$filename = $arguments[0];
$reduce = new Reduce($filename);
$reduce->set_phc("src/phc");
$reduce->set_comment($command_line);
$reduce->set_plugin_path($opt_phc_prefix);
$reduce->set_run_command_function("myrun");
$reduce->set_debug_function("mydebug");
$reduce->set_dump_function("mydump");
// Checking functions
$reduce->set_checking_function("check_against_compiled");
if ($opt_failure) {
    $reduce->set_checking_function("check_for_failure_string");
}
if ($opt_interpret) {
    $reduce->set_checking_function("check_against_interpreted");
}
$input = file_get_contents($filename);
Exemple #3
0
 public static function reduce($xf, $init, $coll)
 {
     if (is_callable($xf)) {
         $xf = self::wrap($xf);
     }
     return Reduce::reduce($coll, $xf, $init);
 }