Search in sources :

Example 26 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class TestDependencyIteratorBuilder method testRegularIteratorCreation.

@Test
public void testRegularIteratorCreation() {
    try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
        gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
        ExecutionConfig config = new ExecutionConfig();
        config.setVersionOld(SIMPLE_PREDECESSOR);
        config.setVersion("HEAD");
        StaticTestSelection dependencies = buildVersionDependencies(LAST_RUNNING_VERSION);
        VersionIteratorGit iterator = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER)).getIterator();
        Assert.assertEquals(2, iterator.getSize());
        Assert.assertEquals(VERSION_2, iterator.getTag());
        Assert.assertEquals(SIMPLE_PREDECESSOR, iterator.getPredecessor());
    }
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 27 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class RegressionTestSelectionStarter method readExecutions.

public void readExecutions(final String project, final List<GitCommit> commits) throws InterruptedException, IOException, JsonGenerationException, JsonMappingException, JAXBException {
    KiekerConfig kiekerConfig = kiekerConfigMixin.getKiekerConfig();
    ExecutionConfig executionConfig = executionConfigMixin.getExecutionConfig();
    final DependencyParallelReader reader = new DependencyParallelReader(config.getProjectFolder(), config.getResultBaseFolder(), project, commits, config.getDependencyConfig(), executionConfig, kiekerConfig, new EnvironmentVariables());
    final ResultsFolders[] outFiles = reader.readDependencies();
    LOG.debug("Files: {}", outFiles);
    ResultsFolders mergedFolders = new ResultsFolders(config.getResultBaseFolder(), project);
    final File out = mergedFolders.getStaticTestSelectionFile();
    final StaticTestSelection all = PartialDependenciesMerger.mergeVersions(out, outFiles);
    final PeassFolders folders = new PeassFolders(config.getProjectFolder());
    final File dependencyTempFiles = new File(folders.getTempProjectFolder().getParentFile(), "dependencyTempFiles");
    FileUtils.moveDirectory(folders.getTempProjectFolder(), dependencyTempFiles);
    ExecutionData executionData = PartialDependenciesMerger.mergeExecutions(mergedFolders, outFiles);
    mergeViews(outFiles, mergedFolders);
    if (!config.isDoNotGenerateProperties()) {
        ResultsFolders resultsFolders = new ResultsFolders(config.getResultBaseFolder(), project);
        final PropertyReader propertyReader = new PropertyReader(resultsFolders, config.getProjectFolder(), executionData, executionConfig);
        propertyReader.readAllTestsProperties();
    }
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) DependencyParallelReader(de.dagere.peass.dependency.reader.DependencyParallelReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) KiekerConfig(de.dagere.peass.config.KiekerConfig) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 28 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class ExecutionConfigMixin method getExecutionConfig.

public ExecutionConfig getExecutionConfig() {
    ExecutionConfig config = new ExecutionConfig(timeout);
    config.setVersion(version);
    config.setVersionOld(versionOld);
    config.setStartversion(getStartversion());
    config.setEndversion(getEndversion());
    config.setTestGoal(getTestGoal());
    if (getIncludes() != null) {
        for (String include : getIncludes()) {
            config.getIncludes().add(include);
        }
    }
    if (getExcludes() != null) {
        for (String exclude : getExcludes()) {
            config.getExcludes().add(exclude);
        }
    }
    if (getPl() != null) {
        config.setPl(pl);
    }
    boolean transformerSet = getTestTransformer() != null;
    boolean executorSet = getTestExecutor() != null;
    if (transformerSet && executorSet) {
        config.setTestTransformer(getTestTransformer());
        config.setTestExecutor(getTestExecutor());
    } else if (transformerSet != executorSet) {
        throw new RuntimeException("If the test transformer is set by CLI parameters, the test executor needs also be set!");
    } else {
        config.setTestTransformer(getWorkloadType().getTestTransformer());
        config.setTestExecutor(getWorkloadType().getTestExecutor());
    }
    config.setUseTieredCompilation(useTieredCompilation);
    config.setRemoveSnapshots(removeSnapshots);
    config.setUseAlternativeBuildfile(useAlternativeBuildfile);
    config.setRemoveSnapshots(removeSnapshots);
    config.setCreateDefaultConstructor(!skipDefaultConstructor);
    config.setExecuteBeforeClassInMeasurement(executeBeforeClassInMeasurement);
    config.setKiekerWaitTime(kiekerWaitTime);
    if (getClazzFolder() != null) {
        List<String> clazzFolders = ExecutionConfig.buildFolderList(getClazzFolder());
        config.setClazzFolders(clazzFolders);
    }
    if (getTestClazzFolder() != null) {
        List<String> testClazzFolders = ExecutionConfig.buildFolderList(getTestClazzFolder());
        config.setTestClazzFolders(testClazzFolders);
    }
    config.setExcludeLog4j(excludeLog4j);
    config.setRedirectToNull(!dontRedirectToNull);
    return config;
}
Also used : ExecutionConfig(de.dagere.peass.config.ExecutionConfig)

Example 29 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class JmhDependencyReaderMultiParamTest method mockIterator.

private FakeFileIterator mockIterator() {
    List<File> versionList = Arrays.asList(JmhTestConstants.MULTIPARAM_VERSION, JmhTestConstants.MULTIPARAM_VERSION_CHANGE);
    FakeFileIterator fakeIterator = new FakeFileIterator(TestConstants.CURRENT_FOLDER, versionList);
    fakeIterator.goToFirstCommit();
    FakeFileIterator iteratorspied = Mockito.spy(fakeIterator);
    VersionDiff fakedDiff = new VersionDiff(Arrays.asList(TestConstants.CURRENT_FOLDER), TestConstants.CURRENT_FOLDER);
    ExecutionConfig defaultConfig = new ExecutionConfig();
    fakedDiff.addChange("src/test/java/de/dagere/peass/ExampleBenchmark.java", defaultConfig);
    Mockito.doReturn(fakedDiff).when(iteratorspied).getChangedClasses(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
    return iteratorspied;
}
Also used : FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) File(java.io.File)

Example 30 with ExecutionConfig

use of de.dagere.peass.config.ExecutionConfig in project peass by DaGeRe.

the class JmhDependencyReaderMultiParamTest method testVersionReading.

@Test
public void testVersionReading() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
        FakeGitUtil.prepareGitUtils(gitUtilsMock);
        FakeFileIterator iterator = mockIterator();
        ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
        TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
        ExecutionConfig jmhConfig = new ExecutionConfig();
        jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
        jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
        DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, new KiekerConfig(true), new EnvironmentVariables());
        reader.readInitialVersion();
        checkInitialVersion(resultsFolders);
        reader.readDependencies();
        checkChangedVersion(resultsFolders);
    }
}
Also used : TestSelectionConfig(de.dagere.peass.config.TestSelectionConfig) VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Aggregations

ExecutionConfig (de.dagere.peass.config.ExecutionConfig)74 Test (org.junit.jupiter.api.Test)49 File (java.io.File)40 PeassFolders (de.dagere.peass.folders.PeassFolders)29 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)23 KiekerConfig (de.dagere.peass.config.KiekerConfig)21 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)20 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)14 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)14 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)13 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)12 ProjectModules (de.dagere.peass.execution.utils.ProjectModules)12 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)11 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)11 GitUtils (de.dagere.peass.vcs.GitUtils)10 ResultsFolders (de.dagere.peass.folders.ResultsFolders)9 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)7 VersionIterator (de.dagere.peass.vcs.VersionIterator)7 HashSet (java.util.HashSet)7 ChangeManager (de.dagere.peass.dependency.ChangeManager)6