Search in sources :

Example 1 with MeasureVersionAction

use of de.dagere.peass.ci.MeasureVersionAction in project peass-ci-plugin by jenkinsci.

the class MeasureVersionBuilderTest method testFullBuild.

@Test
public void testFullBuild() throws Exception {
    // Windows tends to create some strange errors when trying to copy .git-folders; therefore, windows builds are currently not fully supported
    Assume.assumeFalse(EnvironmentVariables.isWindows());
    // On Github actions, this test currently fails because of timeout - try to use higher timeout
    jenkins.timeout = 5 * 60;
    FreeStyleProject project = jenkins.createFreeStyleProject();
    initProjectFolder(project);
    MeasureVersionBuilder builder = createSimpleBuilder();
    project.getBuildersList().add(builder);
    project = jenkins.configRoundtrip(project);
    FreeStyleBuild build = jenkins.buildAndAssertSuccess(project);
    MeasureVersionAction action = build.getActions(MeasureVersionAction.class).get(0);
    Assert.assertEquals(ITERATIONS, action.getConfig().getIterations());
    Assert.assertEquals(VMS, action.getConfig().getVms());
    Assert.assertEquals(REPETITIONS, action.getConfig().getRepetitions());
    Assert.assertEquals(WARMUP, action.getConfig().getWarmup());
    Assert.assertEquals(0.05, action.getConfig().getStatisticsConfig().getType1error(), 0.01);
}
Also used : MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) FreeStyleBuild(hudson.model.FreeStyleBuild) FreeStyleProject(hudson.model.FreeStyleProject) MeasureVersionBuilder(de.dagere.peass.ci.MeasureVersionBuilder) Test(org.junit.Test)

Example 2 with MeasureVersionAction

use of de.dagere.peass.ci.MeasureVersionAction in project peass-ci-plugin by jenkinsci.

the class TestMeasureVersionAction method testPrefix.

@Test
public void testPrefix() {
    final ProjectChanges changes = getChanges();
    HashMap<String, HistogramValues> measurements = new HashMap<String, HistogramValues>();
    measurements.put("de.package.ClassA#method1", null);
    measurements.put("de.package.ClassA#method2", null);
    measurements.put("de.package.ClassB#method2", null);
    measurements.put("de.package.otherpackage.ClassC#method2", null);
    MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), measurements, new HashMap<>());
    Assert.assertEquals("ClassA", action.getReducedName("de.package.ClassA"));
    Assert.assertEquals("otherpackage.ClassC", action.getReducedName("de.package.otherpackage.ClassC"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HashMap(java.util.HashMap) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.Test)

Example 3 with MeasureVersionAction

use of de.dagere.peass.ci.MeasureVersionAction in project peass-ci-plugin by jenkinsci.

the class TestMeasureVersionAction method testIsChanged.

@Test
public void testIsChanged() {
    final ProjectChanges changes = getChanges();
    MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), new HashMap<>(), new HashMap<>());
    Assert.assertTrue(action.testIsChanged("de.package.ClassA#method1"));
    Assert.assertTrue(action.testIsChanged("de.package.ClassA#method2"));
    Assert.assertTrue(action.testIsChanged("de.package.ClassB#method2"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) Test(org.junit.Test)

Example 4 with MeasureVersionAction

use of de.dagere.peass.ci.MeasureVersionAction in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testHistogramCreation.

@Test
public void testHistogramCreation() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("b02c92af73e3297be617f4c973a7a63fb603565b");
    measurementConfig.getExecutionConfig().setVersionOld("e80d8a1bf747d1f70dc52260616b36cac9e44561");
    measurementConfig.setWarmup(2);
    measurementConfig.setIterations(2);
    measurementConfig.setRepetitions(2);
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "b02c92af73e3297be617f4c973a7a63fb603565b"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    double[] valuesBefore = measurements.get("de.test.CalleeTest#onlyCallMethod1").getValuesBefore();
    double[] valuesCurrent = measurements.get("de.test.CalleeTest#onlyCallMethod1").getValuesCurrent();
    MeasureVersionAction measureVersionActionMock = Mockito.mock(MeasureVersionAction.class);
    when(measureVersionActionMock.getValuesReadable(any(double[].class))).thenCallRealMethod();
    Assert.assertEquals(2, measureVersionActionMock.getValuesReadable(valuesBefore).split(",").length);
    Assert.assertEquals(2, measureVersionActionMock.getValuesReadable(valuesCurrent).split(",").length);
    Assert.assertFalse(reader.measurementConfigurationUpdated());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Example 5 with MeasureVersionAction

use of de.dagere.peass.ci.MeasureVersionAction in project peass-ci-plugin by jenkinsci.

the class LocalPeassProcessManager method visualizeMeasurementResults.

public ProjectChanges visualizeMeasurementResults(final Run<?, ?> run) throws JAXBException, IOException, JsonParseException, JsonMappingException, JsonGenerationException {
    File dataFolder = results.getVersionFullResultsFolder(peassConfig.getMeasurementConfig());
    final HistogramReader histogramReader = new HistogramReader(peassConfig.getMeasurementConfig(), dataFolder);
    final Map<String, HistogramValues> measurements = histogramReader.readMeasurements();
    final ProjectChanges changes = getChanges();
    final ProjectStatistics statistics = readStatistics();
    TrendFileUtil.persistTrend(run, localWorkspace, statistics);
    Map<String, TestcaseStatistic> noWarmupStatistics = createPureMeasurementVisualization(run, dataFolder, measurements);
    Changes versionChanges = changes.getVersion(peassConfig.getMeasurementConfig().getExecutionConfig().getVersion());
    final MeasureVersionAction action = new MeasureVersionAction(peassConfig.getMeasurementConfig(), versionChanges, statistics, noWarmupStatistics, measurements, histogramReader.getUpdatedConfigurations());
    run.addAction(action);
    return changes;
}
Also used : ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) Changes(de.dagere.peass.analysis.changes.Changes) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues)

Aggregations

MeasureVersionAction (de.dagere.peass.ci.MeasureVersionAction)6 HistogramValues (de.dagere.peass.ci.helper.HistogramValues)4 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)4 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)3 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)3 HistogramReader (de.dagere.peass.ci.helper.HistogramReader)3 File (java.io.File)3 Test (org.junit.Test)3 Test (org.junit.jupiter.api.Test)2 Changes (de.dagere.peass.analysis.changes.Changes)1 MeasureVersionBuilder (de.dagere.peass.ci.MeasureVersionBuilder)1 TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)1 FreeStyleBuild (hudson.model.FreeStyleBuild)1 FreeStyleProject (hudson.model.FreeStyleProject)1 HashMap (java.util.HashMap)1