Search in sources :

Example 6 with TestScanner

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

the class DSN method repairVsRebuild.

// @Test
public void repairVsRebuild() throws Exception {
    TestScanner sc = newScanner();
    Bench.population = 500;
    Bench.scale = 10;
    Path path = Paths.get(root, "mode_stable.csv");
    Files.deleteIfExists(path);
    boolean first = true;
    for (boolean repair : new boolean[] { false, true }) {
        if (first) {
            Bench.mode = Bench.Mode.SAVE;
            first = !first;
        } else {
            Bench.mode = Bench.Mode.REPLAY;
        }
        System.out.println("--- Repair: " + repair + "; replay= " + first + " ---");
        Bench.report = new CSVReport(path, repair ? "enabled" : "disabled");
        sc.test(Bench.class).forEach(x -> {
            x.schedulerParams().doRepair(true);
            System.out.println(x.go());
        });
    }
}
Also used : Path(java.nio.file.Path) Bench(org.btrplace.safeplace.testing.Bench) TestScanner(org.btrplace.safeplace.testing.TestScanner) CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport)

Example 7 with TestScanner

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

the class DSN method fuzzingScalability.

// @Test
public void fuzzingScalability() throws Exception {
    TestScanner sc = newScanner();
    // Warm-up
    Bench.transitions = true;
    Path p = Paths.get(root, "testing-speed-notrans.csv");
    Files.deleteIfExists(p);
    /*   for (int i = 10; i <= 30; i+=2) {
            Bench.transitions = false;
            Bench.population = 100;
            Bench.scale = i;
            System.out.println("--- scaling factor " + i + "; transitions= " + Bench.transitions +" ---");
            Bench.report = new CSVReport(p,"");
            System.out.println(sc.test(Bench.class).stream().mapToInt(TestCampaign::go).sum());
        }*/
    // GOGO
    p = Paths.get(root, "testing-speed-notrans.csv");
    Files.deleteIfExists(p);
    Bench.mode = Bench.Mode.DEFAULT;
    for (int i = 1; i <= 30; i += 2) {
        Bench.transitions = false;
        Bench.population = 100;
        Bench.scale = i;
        System.out.println("--- scaling factor " + i + "; transitions= " + Bench.transitions + " ---");
        Bench.report = new CSVReport(p, "");
        sc.test(Bench.class).forEach(c -> System.out.println(c.go().toString()));
    }
    p = Paths.get(root, "testing-speed-trans.csv");
    Files.deleteIfExists(p);
    for (int i = 1; i <= 30; i += 2) {
        System.out.println("--- scaling factor " + i + "; transitions= " + Bench.transitions + " ---");
        Bench.transitions = true;
        Bench.population = 100;
        Bench.scale = i;
        Bench.report = new CSVReport(p, "");
        sc.test(Bench.class).forEach(c -> System.out.println(c.go().toString()));
    }
}
Also used : Path(java.nio.file.Path) Bench(org.btrplace.safeplace.testing.Bench) TestScanner(org.btrplace.safeplace.testing.TestScanner) CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport) Constraint(org.btrplace.safeplace.spec.Constraint)

Example 8 with TestScanner

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

the class DSN method fuzzingSizing.

// //@Test
public void fuzzingSizing() throws Exception {
    TestScanner sc = newScanner();
    Path path = Paths.get(root, "fuzz.csv");
    Files.deleteIfExists(path);
    for (int p = 100; p <= 1000; p += 100) {
        for (int s = 2; s <= 20; s += 2) {
            System.out.println("--- Population: " + p + " scale: " + s + " ---");
            Bench.report = new CSVReport(path, Integer.toString(p));
            Bench.population = p;
            Bench.scale = s;
            List<TestCampaign> campaigns = sc.testGroups("sides");
            if (campaigns.isEmpty()) {
                Assert.fail("Nothing to test");
            }
            campaigns.stream().forEach(c -> System.out.println(c.go().toString()));
        }
    }
}
Also used : Path(java.nio.file.Path) TestScanner(org.btrplace.safeplace.testing.TestScanner) CSVReport(org.btrplace.safeplace.testing.reporting.CSVReport) TestCampaign(org.btrplace.safeplace.testing.TestCampaign) Constraint(org.btrplace.safeplace.spec.Constraint)

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