本文整理汇总了C++中CKernel::getTestSuiteReductionPluginManager方法的典型用法代码示例。如果您正苦于以下问题:C++ CKernel::getTestSuiteReductionPluginManager方法的具体用法?C++ CKernel::getTestSuiteReductionPluginManager怎么用?C++ CKernel::getTestSuiteReductionPluginManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKernel
的用法示例。
在下文中一共展示了CKernel::getTestSuiteReductionPluginManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
cout << "test-suite-reduction (SoDA tool)" << endl;
options_description desc("Options");
desc.add_options()
("help,h", "Prints help message")
("create-json-file,j", "Creates a sample json file")
("list-algorithms,l", "Lists the reduction algorithms");
variables_map vm;
store(parse_command_line(argc, argv, desc), vm);
notify(vm);
if (argc < 2) {
cerr << "[ERROR] There are no arguments!" << endl;
printHelp();
return 1;
}
if (vm.count("help")) {
printHelp();
cout << desc << endl;
return 0;
}
if (vm.count("list-algorithms")) {
printPluginNames(kernel.getTestSuiteReductionPluginManager().getPluginNames());
return 0;
}
if (vm.count("create-json-file")) {
createJsonFile();
return 0;
}
return loadJsonFiles(String(argv[1]));
}
示例2: registerPlugin
extern "C" void registerPlugin(CKernel &kernel)
{
kernel.getTestSuiteReductionPluginManager().addPlugin(new RandomReductionPlugin());
}
示例3: processJsonFiles
void processJsonFiles(String path)
{
try {
std::cout << "[INFO] Processing " << path << " configuration file." << endl;
boost::filesystem::path jsonPath(path);
CSelectionData selectionData;
CJsonReader reader = CJsonReader(path);
String programName = reader.getStringFromProperty("program-name");
if (programName.empty()) {
std::cerr << "[ERROR] Program name is missing in configuration file:" << path << std::endl;
return;
}
StringVector reductionList = reader.getStringVectorFromProperty("reduction-method");
if (reductionList.empty()) {
std::cerr << "[ERROR] reduction-algorithm is missing from the configuration file("
<< path << ")." << std::endl;
printPluginNames(kernel.getTestSuiteReductionPluginManager().getPluginNames());
return;
} else {
int iteration = reader.getIntFromProperty("iteration");
for (StringVector::const_iterator it = reductionList.begin(); it != reductionList.end(); ++it) {
if (*it == "duplation" && !iteration) {
std::cerr << "[ERROR] Missing iteration parameter for duplation reduction method in configuration file: "
<< path << "." << std::endl;
return;
}
if (*it == "random" && !iteration && reader.getIntVectorFromProperty("reduction-sizes").empty()) {
std::cerr << "[ERROR] Missing iteration or reduction-sizes parameter for random reduction method in configuration file: "
<< path << "." << std::endl;
return;
}
try {
kernel.getTestSuiteReductionPluginManager().getPlugin(*it);
} catch (std::out_of_range &e) {
std::cerr << "[ERROR] Invalid reduction algorithm name(" << *it
<< ") in configuration file: " << path << "." << std::endl;
return;
}
}
}
String covPath = reader.getStringFromProperty("coverage-data");
if (covPath[0] == '.') {
covPath = jsonPath.parent_path().string() + "/" + covPath;
}
String resPath = reader.getStringFromProperty("results-data");
if (resPath[0] == '.') {
resPath = jsonPath.parent_path().string() + "/" + resPath;
}
if (exists(covPath)
&& exists(resPath)) {
(std::cerr << "[INFO] loading coverage from " << covPath << " ...").flush();
selectionData.loadCoverage(covPath);
(std::cerr << " done\n[INFO] loading results from " << resPath << " ...").flush();
selectionData.loadResults(resPath);
(std::cerr << " done" << std::endl).flush();
} else {
std::cerr << "[ERROR] Missing or invalid input files in config file " << path << "." << std::endl;
return;
}
if (reader.getBoolFromProperty("globalize")) {
// Globalize data.
(std::cerr << "[INFO] Globalizing ... ").flush();
selectionData.globalize();
selectionData.filterToCoverage();
(std::cerr << " done" << std::endl).flush();
}
String dirPath = reader.getStringFromProperty("output-dir");
if (dirPath[0] == '.') {
dirPath = jsonPath.parent_path().string() + "/" + dirPath;
reader.setProperty("output-dir", dirPath);
}
if (!(boost::filesystem::exists(dirPath))) {
boost::filesystem::create_directory(dirPath);
}
boost::filesystem::path p = boost::filesystem::path(covPath).filename();
while (!reductionList.empty()) {
string reductionMethod = reductionList.back();
reductionList.pop_back();
ITestSuiteReductionPlugin *plugin = NULL;
std::ofstream outStream((dirPath + "/" + reductionMethod + "-" + p.string() + ".reduced").c_str());
if (!outStream.good()) {
throw CException("Reduction output file error.", reader.getStringFromProperty("coverage-data") + ".reduced");
}
try {
plugin = kernel.getTestSuiteReductionPluginManager().getPlugin(reductionMethod);
//.........这里部分代码省略.........