Search in sources :

Example 1 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class ReadProperties method call.

@Override
public Void call() throws Exception {
    final RepoFolders folders = new RepoFolders();
    final String projectName = projectFolder.getName();
    SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile, folders.getDependencyFile(projectName));
    if (!projectFolder.exists()) {
        GitUtils.downloadProject(selectedTests.getUrl(), projectFolder);
    }
    System.out.println("Read all: " + ReadAllProperties.readAll);
    if (ReadAllProperties.readAll) {
        final ExecutionData changedTests = executionFile != null ? Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class) : folders.getExecutionData(projectName);
        final File resultFile = new File("results" + File.separator + projectName + File.separator + "properties_alltests.json");
        out = resultFile;
        ResultsFolders resultsFolders = new ResultsFolders(out, projectName);
        final PropertyReader reader = new PropertyReader(resultsFolders, projectFolder, changedTests, new ExecutionConfig());
        reader.readAllTestsProperties();
    } else {
        final File changefile;
        if (this.changefile != null) {
            changefile = this.changefile;
        } else {
            changefile = folders.getChangeFile(projectName);
        }
        if (out == null) {
            out = folders.getProjectPropertyFile(projectName);
            if (!out.getParentFile().exists()) {
                out.getParentFile().mkdirs();
            }
        }
        if (!changefile.exists()) {
            LOG.error("Changefile {} needs to exist.", changefile);
            System.exit(1);
        }
        if (!viewfolder.exists()) {
            LOG.error("ViewFolder {} needs to exist.", viewfolder);
            System.exit(1);
        }
        StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
        readChangeProperties(changefile, projectFolder, viewfolder, new ExecutionData(dependencies));
    }
    return null;
}
Also used : SelectedTests(de.dagere.peass.dependency.persistence.SelectedTests) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) File(java.io.File) RepoFolders(de.dagere.peass.analysis.all.RepoFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 2 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class GetAllChanges method main.

public static void main(final String[] args) throws JAXBException, JsonParseException, JsonMappingException, IOException {
    final RepoFolders folders = new RepoFolders();
    // "commons-imaging", "commons-io", "commons-numbers", "commons-pool", "commons-text" }) {
    for (final String project : new String[] { "commons-fileupload" }) {
        final File dependencyFile = new File(folders.getDependencyFolder(), ResultsFolders.STATIC_SELECTION_PREFIX + project + ".json");
        if (dependencyFile.exists()) {
            final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
            getChangesForProject(folders, project, dependencies);
        // ProjectChanges.reset();
        } else {
            System.out.println("Dependencyfile does not exist: " + dependencyFile);
        }
    }
}
Also used : File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 3 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class ContinuousDependencyReader method getTests.

public RTSResult getTests(final VersionIterator iterator, final String url, final String version, final MeasurementConfig measurementConfig) {
    final StaticTestSelection dependencies = getDependencies(iterator, url);
    RTSResult result;
    final Set<TestCase> tests;
    if (dependencies.getVersions().size() > 0) {
        VersionStaticSelection versionInfo = dependencies.getVersions().get(version);
        LOG.debug("Versioninfo for version {}, running was: {}", version, versionInfo != null ? versionInfo.isRunning() : "null");
        if (dependencyConfig.isGenerateTraces()) {
            tests = selectResults(version);
            result = new RTSResult(tests, versionInfo.isRunning());
        } else {
            tests = versionInfo.getTests().getTests();
            result = new RTSResult(tests, versionInfo.isRunning());
        }
        // final Set<TestCase> tests = selectIncludedTests(dependencies);
        NonIncludedTestRemover.removeNotIncluded(tests, measurementConfig.getExecutionConfig());
    } else {
        tests = new HashSet<>();
        result = new RTSResult(tests, true);
        LOG.info("No test executed - version did not contain changed tests.");
    }
    return result;
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 4 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class ContinuousDependencyReader method doFullyLoadDependencies.

private StaticTestSelection doFullyLoadDependencies(final String url, final VersionIterator iterator, final VersionKeeper nonChanges) throws IOException, InterruptedException, XmlPullParserException, JsonParseException, JsonMappingException, ParseException, ViewNotFoundException {
    final DependencyReader reader = new DependencyReader(dependencyConfig, folders, resultsFolders, url, iterator, nonChanges, executionConfig, kiekerConfig, env);
    iterator.goToPreviousCommit();
    if (!reader.readInitialVersion()) {
        LOG.error("Analyzing first version was not possible");
    } else {
        reader.readDependencies();
    }
    StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(resultsFolders.getStaticTestSelectionFile(), StaticTestSelection.class);
    return dependencies;
}
Also used : DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Example 5 with StaticTestSelection

use of de.dagere.peass.dependency.persistence.StaticTestSelection in project peass by DaGeRe.

the class FindLowestPossibleIterations method call.

@Override
public Void call() throws InterruptedException, StreamReadException, DatabindException, IOException {
    final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFile, StaticTestSelection.class);
    VersionComparator.setDependencies(dependencies);
    for (File fullDataFolder : data) {
        LOG.info("Loading: {}", fullDataFolder);
        if (!fullDataFolder.exists()) {
            LOG.error("Ordner existiert nicht!");
            System.exit(1);
        }
        final LinkedBlockingQueue<TestData> measurements = new LinkedBlockingQueue<>();
        DataReader.startReadVersionDataMap(fullDataFolder, measurements);
        TestData measurementEntry = measurements.take();
        while (measurementEntry != DataReader.POISON_PILL) {
            processTestdata(measurementEntry);
            measurementEntry = measurements.take();
        }
    }
    LOG.debug("Final minimal VM executions for same result: " + vmDeterminer.getMinNeccessaryValue() + " Average: " + ((double) vmDeterminer.getSum() / vmDeterminer.getCount()));
    LOG.debug(vmDeterminer.getValues());
    return null;
// LOG.debug("Final minimal measurement executions for same result: " + exDeterminer.minNeccessaryValue + " Average: " + ((double) exDeterminer.sum / exDeterminer.count));
// LOG.debug(exDeterminer.values);
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Aggregations

StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)56 File (java.io.File)24 Test (org.junit.jupiter.api.Test)22 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)14 PeassFolders (de.dagere.peass.folders.PeassFolders)14 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)12 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)12 LinkedList (java.util.LinkedList)9 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)8 KiekerConfig (de.dagere.peass.config.KiekerConfig)7 InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)7 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)7 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)7 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)6 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)6 GitCommit (de.dagere.peass.vcs.GitCommit)6 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)5 ResultsFolders (de.dagere.peass.folders.ResultsFolders)5 GitUtils (de.dagere.peass.vcs.GitUtils)5 ChangeManager (de.dagere.peass.dependency.ChangeManager)4