use of com.dat3m.dartagnan.parsers.program.ProgramParser in project Dat3M by hernanponcedeleon.
the class PrinterTest method PrintPPC.
@Test()
public void PrintPPC() throws Exception {
Program p = new ProgramParser().parse(new File(ResourceHelper.TEST_RESOURCE_PATH + "litmus/MP+lwsync+data-wsi-rfi-ctrlisync.litmus"));
assertNotNull(new Printer().print(p));
assertNotNull(p.getAss().toString());
}
use of com.dat3m.dartagnan.parsers.program.ProgramParser in project Dat3M by hernanponcedeleon.
the class PrinterTest method PrintLinux2.
@Test()
public void PrintLinux2() throws Exception {
Program p = new ProgramParser().parse(new File(ResourceHelper.LITMUS_RESOURCE_PATH + "litmus/C/dart/C-atomic-fetch-simple-01.litmus"));
assertNotNull(new Printer().print(p));
assertNotNull(p.getAss().toString());
}
use of com.dat3m.dartagnan.parsers.program.ProgramParser in project Dat3M by hernanponcedeleon.
the class PrinterTest method PrintBpl2.
@Test()
public void PrintBpl2() throws Exception {
Program p = new ProgramParser().parse(new File(ResourceHelper.TEST_RESOURCE_PATH + "locks/linuxrwlock-3.bpl"));
assertNotNull(new Printer().print(p));
LoopUnrolling.newInstance().run(p);
Compilation.newInstance().run(p);
assertNotNull(new Printer().print(p));
}
use of com.dat3m.dartagnan.parsers.program.ProgramParser in project Dat3M by hernanponcedeleon.
the class BuildWitnessTest method BuildWriteEncode.
@Test
public void BuildWriteEncode() throws Exception {
Configuration config = Configuration.builder().setOption(WITNESS_ORIGINAL_PROGRAM_PATH, ResourceHelper.TEST_RESOURCE_PATH + "witness/lazy01-for-witness.bpl").setOption(BOUND, "1").build();
Program p = new ProgramParser().parse(new File(ResourceHelper.TEST_RESOURCE_PATH + "witness/lazy01-for-witness.bpl"));
Wmm wmm = new ParserCat().parse(new File(ResourceHelper.CAT_RESOURCE_PATH + "cat/svcomp.cat"));
VerificationTask task = VerificationTask.builder().withConfig(config).build(p, wmm, EnumSet.of(Property.getDefault()));
try (SolverContext ctx = TestHelper.createContext();
ProverEnvironment prover = ctx.newProverEnvironment(ProverOptions.GENERATE_MODELS)) {
Result res = IncrementalSolver.run(ctx, prover, task);
WitnessBuilder witnessBuilder = new WitnessBuilder(task, ctx, prover, res);
config.inject(witnessBuilder);
WitnessGraph graph = witnessBuilder.build();
File witnessFile = new File(System.getenv("DAT3M_HOME") + "/output/lazy01-for-witness.graphml");
// The file should not exist
assertFalse(witnessFile.exists());
// Write to file
graph.write();
// The file should exist now
assertTrue(witnessFile.exists());
// Delete the file
witnessFile.delete();
// Create encoding
BooleanFormula enc = graph.encode(p, ctx);
BooleanFormulaManager bmgr = ctx.getFormulaManager().getBooleanFormulaManager();
// Check the formula is not trivial
assertFalse(bmgr.isFalse(enc));
assertFalse(bmgr.isTrue(enc));
}
}
use of com.dat3m.dartagnan.parsers.program.ProgramParser in project Dat3M by hernanponcedeleon.
the class Dat3M method runTest.
private void runTest() {
UiOptions options = optionsPane.getOptions();
testResult = null;
try {
Editor programEditor = editorsPane.getEditor(EditorCode.PROGRAM);
Program program = new ProgramParser().parse(programEditor.getEditorPane().getText(), programEditor.getLoadedFormat());
try {
Wmm targetModel = new ParserCat().parse(editorsPane.getEditor(EditorCode.TARGET_MM).getEditorPane().getText());
testResult = new ReachabilityResult(program, targetModel, options);
} catch (Exception e) {
String msg = e.getMessage() == null ? "Memory model cannot be parsed" : e.getMessage();
showError(msg, "Target memory model error");
}
} catch (Exception e) {
String msg = e.getMessage() == null ? "Program cannot be parsed" : e.getMessage();
Throwable cause = e.getCause();
if (cause instanceof InputMismatchException) {
Token token = ((InputMismatchException) cause).getOffendingToken();
msg = "Problem with \"" + token.getText() + "\" at line " + token.getLine();
}
showError(msg, "Program error");
}
}
Aggregations