Search in sources :

Example 1 with TestScanner

use of org.btrplace.safeplace.testing.TestScanner in project scheduler by btrplace.

the class DSN method discreteVsContinuous.

// @Test
public void discreteVsContinuous() throws Exception {
    TestScanner sc = newScanner();
    Bench.population = 500;
    Bench.scale = 10;
    Path path = Paths.get(root, "restriction_stable.csv");
    Files.deleteIfExists(path);
    boolean first = true;
    for (Restriction r : EnumSet.allOf(Restriction.class)) {
        if (first) {
            Bench.mode = Bench.Mode.SAVE;
            first = !first;
        } else {
            Bench.mode = Bench.Mode.REPLAY;
        }
        System.out.println("--- Restriction: " + r + "; replay= " + first + " ---");
        Bench.report = new CSVReport(path, r.toString());
        sc.testGroups("bi").forEach(x -> {
            Bench.restrictions = EnumSet.of(r);
            System.out.println(x.go());
        });
    }
    // restore
    Bench.restrictions = EnumSet.allOf(Restriction.class);
}
Also used : Path(java.nio.file.Path) Restriction(org.btrplace.safeplace.testing.fuzzer.Restriction) TestScanner(org.btrplace.safeplace.testing.TestScanner) CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport)

Example 2 with TestScanner

use of org.btrplace.safeplace.testing.TestScanner in project scheduler by btrplace.

the class DSN method prettyErrors.

// @Test
public void prettyErrors() throws Exception {
    TestScanner sc = newScanner();
    Bench.mode = Bench.Mode.REPLAY;
    Bench.population = 1000;
    Bench.scale = 5;
    sc.test(Bench.class).forEach(x -> {
        x.reportTo(new StoredReport(Paths.get("xp-dsn", "errors.txt"), r -> !r.result().equals(Result.SUCCESS)));
        System.out.println(x.go());
    });
}
Also used : CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport) java.util(java.util) VoidVisitorAdapter(com.github.javaparser.ast.visitor.VoidVisitorAdapter) AnnotationExpr(com.github.javaparser.ast.expr.AnnotationExpr) Restriction(org.btrplace.safeplace.testing.fuzzer.Restriction) Constraint(org.btrplace.safeplace.spec.Constraint) Matcher(java.util.regex.Matcher) Assert(org.testng.Assert) CompilationUnit(com.github.javaparser.ast.CompilationUnit) SpecScanner(org.btrplace.safeplace.spec.SpecScanner) Path(java.nio.file.Path) SpecVerifier(org.btrplace.safeplace.testing.verification.spec.SpecVerifier) TestScanner(org.btrplace.safeplace.testing.TestScanner) Files(java.nio.file.Files) PrettyPrinterConfiguration(com.github.javaparser.printer.PrettyPrinterConfiguration) Verifier(org.btrplace.safeplace.testing.verification.Verifier) Collectors(java.util.stream.Collectors) Bench(org.btrplace.safeplace.testing.Bench) StoredReport(org.btrplace.safeplace.testing.reporting.StoredReport) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) Paths(java.nio.file.Paths) Result(org.btrplace.safeplace.testing.Result) TestCampaign(org.btrplace.safeplace.testing.TestCampaign) Pattern(java.util.regex.Pattern) CheckerVerifier(org.btrplace.safeplace.testing.verification.btrplace.CheckerVerifier) JavaParser(com.github.javaparser.JavaParser) InputStream(java.io.InputStream) Bench(org.btrplace.safeplace.testing.Bench) StoredReport(org.btrplace.safeplace.testing.reporting.StoredReport) TestScanner(org.btrplace.safeplace.testing.TestScanner)

Example 3 with TestScanner

use of org.btrplace.safeplace.testing.TestScanner in project scheduler by btrplace.

the class DSN method newScanner.

public TestScanner newScanner() throws Exception {
    SpecScanner specScanner = new SpecScanner();
    List<Constraint> l = specScanner.scan();
    Bench.mode = Bench.Mode.REPLAY;
    return new TestScanner(l);
}
Also used : Constraint(org.btrplace.safeplace.spec.Constraint) TestScanner(org.btrplace.safeplace.testing.TestScanner) SpecScanner(org.btrplace.safeplace.spec.SpecScanner)

Example 4 with TestScanner

use of org.btrplace.safeplace.testing.TestScanner in project scheduler by btrplace.

the class DSN method errors.

// @Test
public void errors() throws Exception {
    TestScanner sc = newScanner();
    Bench.source = "xp-dsn";
    Bench.mode = Bench.Mode.REPLAY;
    Bench.population = 1000;
    Bench.scale = 5;
    Path p = Paths.get(root, "errors.csv");
    Files.deleteIfExists(p);
    Bench.report = new CSVReport(p, "");
    sc.test(Bench.class).stream().forEach(x -> System.out.println(x.go()));
}
Also used : Path(java.nio.file.Path) TestScanner(org.btrplace.safeplace.testing.TestScanner) CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport)

Example 5 with TestScanner

use of org.btrplace.safeplace.testing.TestScanner in project scheduler by btrplace.

the class DSN method specVsCheckers.

// @Test
public void specVsCheckers() throws Exception {
    TestScanner sc = newScanner();
    Bench.population = 500;
    Bench.scale = 10;
    Path p = Paths.get(root, "verifier_stable.csv");
    Files.deleteIfExists(p);
    boolean first = true;
    for (Verifier v : new Verifier[] { new SpecVerifier(), new CheckerVerifier() }) {
        if (first) {
            Bench.mode = Bench.Mode.SAVE;
            first = !first;
        } else {
            Bench.mode = Bench.Mode.REPLAY;
        }
        System.out.println("--- Verifier: " + v.getClass() + " ---");
        Bench.report = new CSVReport(p, v.id());
        sc.test(Bench.class).forEach(c -> {
            c.verifyWith(v);
            System.out.println(c.go().toString());
        });
    }
}
Also used : Path(java.nio.file.Path) SpecVerifier(org.btrplace.safeplace.testing.verification.spec.SpecVerifier) Bench(org.btrplace.safeplace.testing.Bench) CheckerVerifier(org.btrplace.safeplace.testing.verification.btrplace.CheckerVerifier) TestScanner(org.btrplace.safeplace.testing.TestScanner) CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport) SpecVerifier(org.btrplace.safeplace.testing.verification.spec.SpecVerifier) Verifier(org.btrplace.safeplace.testing.verification.Verifier) CheckerVerifier(org.btrplace.safeplace.testing.verification.btrplace.CheckerVerifier)

Aggregations

TestScanner (org.btrplace.safeplace.testing.TestScanner)8 Path (java.nio.file.Path)7 CSVReport (org.btrplace.safeplace.testing.reporting.CSVReport)7 Constraint (org.btrplace.safeplace.spec.Constraint)4 Bench (org.btrplace.safeplace.testing.Bench)4 SpecScanner (org.btrplace.safeplace.spec.SpecScanner)2 TestCampaign (org.btrplace.safeplace.testing.TestCampaign)2 Restriction (org.btrplace.safeplace.testing.fuzzer.Restriction)2 Verifier (org.btrplace.safeplace.testing.verification.Verifier)2 CheckerVerifier (org.btrplace.safeplace.testing.verification.btrplace.CheckerVerifier)2 SpecVerifier (org.btrplace.safeplace.testing.verification.spec.SpecVerifier)2 JavaParser (com.github.javaparser.JavaParser)1 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1 AnnotationExpr (com.github.javaparser.ast.expr.AnnotationExpr)1 VoidVisitorAdapter (com.github.javaparser.ast.visitor.VoidVisitorAdapter)1 PrettyPrinterConfiguration (com.github.javaparser.printer.PrettyPrinterConfiguration)1 InputStream (java.io.InputStream)1 Files (java.nio.file.Files)1 Paths (java.nio.file.Paths)1