Search in sources :

Example 6 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass by DaGeRe.

the class PartialDependenciesMerger method mergeExecutions.

public static ExecutionData mergeExecutions(final ResultsFolders mergedOut, final ResultsFolders[] outFiles) throws JsonParseException, JsonMappingException, IOException {
    List<File> executionOutFiles = new LinkedList<>();
    List<File> coverageSelectionOutFiles = new LinkedList<>();
    for (ResultsFolders resultFolder : outFiles) {
        if (resultFolder != null) {
            if (resultFolder.getTraceTestSelectionFile().exists()) {
                executionOutFiles.add(resultFolder.getTraceTestSelectionFile());
            }
            if (resultFolder.getCoverageSelectionFile() != null && resultFolder.getCoverageSelectionFile().exists()) {
                coverageSelectionOutFiles.add(resultFolder.getCoverageSelectionFile());
            }
        }
    }
    ExecutionData mergedExecutions = mergeExecutionFiles(executionOutFiles);
    Constants.OBJECTMAPPER.writeValue(mergedOut.getTraceTestSelectionFile(), mergedExecutions);
    if (coverageSelectionOutFiles.size() > 0) {
        ExecutionData mergedCoverage = mergeExecutionFiles(coverageSelectionOutFiles);
        Constants.OBJECTMAPPER.writeValue(mergedOut.getCoverageSelectionFile(), mergedCoverage);
    }
    return mergedExecutions;
}
Also used : ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) LinkedList(java.util.LinkedList) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 7 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass by DaGeRe.

the class TestContinuousDependencyReader method testNoChangeHappened.

@Test
public void testNoChangeHappened() throws JsonGenerationException, JsonMappingException, IOException {
    ResultsFolders resultsFolders = new ResultsFolders(new File("target/current_results"), "current");
    StaticTestSelection value = new StaticTestSelection();
    value.setInitialversion(new InitialVersion());
    value.getVersions().put("A", new VersionStaticSelection());
    Constants.OBJECTMAPPER.writeValue(resultsFolders.getStaticTestSelectionFile(), value);
    ContinuousDependencyReader reader = new ContinuousDependencyReader(new TestSelectionConfig(1, false), new ExecutionConfig(), new KiekerConfig(), new PeassFolders(new File("target/current")), resultsFolders, new EnvironmentVariables());
    reader.getDependencies(null, "git:dummyUrl");
}
Also used : TestSelectionConfig(de.dagere.peass.config.TestSelectionConfig) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 8 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders 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 9 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders 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)

Example 10 with ResultsFolders

use of de.dagere.peass.folders.ResultsFolders in project peass by DaGeRe.

the class JmhDependencyReaderTest method testVersionReading.

@ParameterizedTest
@ArgumentsSource(KiekerConfigurationProvider.class)
public void testVersionReading(final KiekerConfig kiekerConfig) 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, kiekerConfig, 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) PeassFolders(de.dagere.peass.folders.PeassFolders) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Aggregations

ResultsFolders (de.dagere.peass.folders.ResultsFolders)36 File (java.io.File)30 Test (org.junit.jupiter.api.Test)14 PeassFolders (de.dagere.peass.folders.PeassFolders)13 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)9 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)8 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)7 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)7 VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)6 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)6 KiekerConfig (de.dagere.peass.config.KiekerConfig)5 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)5 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)5 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)5 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)4 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)4 IOException (java.io.IOException)4 List (java.util.List)4 PropertyReader (de.dagere.peass.analysis.properties.PropertyReader)3 VersionKeeper (de.dagere.peass.dependency.reader.VersionKeeper)3